@libxai/board 1.9.43 → 1.9.44

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'),qb=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 qb__default=/*#__PURE__*/_interopDefault(qb);var Bi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var $i=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [$i.Translate.toString(e),$i.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Oi(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 Gb(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function yc(e,t){return e.length===0?1e3:t===0?Oi(null,e[0].position):t>=e.length?Oi(e[e.length-1].position,null):Oi(e[t-1].position,e[t].position)}function ap(e,t=100){return e>t}var Vb=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 jb(e,t,a,r){let n=t*Math.pow(a,e-1),s=n*.2*Math.random();return Math.min(n+s,r)}async function Hi(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Vb,onRetry:i}=t,c,l=0;for(let u=1;u<=a;u++){l=u;try{return {data:await e(),attempts:l,success:!0}}catch(p){if(c=p,u===a||!o(c,u))return {error:c,attempts:l,success:false};let m=jb(u,r,n,s);if(i)try{i(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:l,success:false}}function _b(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(n){if(a=n,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Kb(e,t={}){return async(...a)=>Hi(()=>e(...a),t)}var xc=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var rp=(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))(rp||{}),Eo=class Eo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(i,n,c?o:"");break;case "INFO":console.info(i,n,c?o:"");break;case "WARN":console.warn(i,n,c?o:"");break;case "ERROR":console.error(i,n,c?o:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Eo.globalOptions};}static configure(t){Eo.globalOptions={...Eo.globalOptions,...t};}child(t){return new Eo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ui((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ui(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:rp[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};Eo.globalOptions={};var vc=Eo,Ui=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},np=new vc;function Yb(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Xb(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let o=e.columns.find(i=>i.id===s.columnId);return [s.id,wc(s.title),wc(s.description||""),wc(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function Jb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await qb__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=o.toDataURL("image/png"),c=297,l=210,u=o.width/o.height,p=c-20,d=p/u;d>l-20&&(d=l-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(i,"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 i=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,i.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):i.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 l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.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}`),l.push(u.join(" \u2192 "));}l.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(l.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function wc(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function sp(e,t,a,r){switch(t){case "json":return Yb(e,r);case "csv":return Xb(e);case "pdf":return await Jb(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ip(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:o[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Qb(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Zb(e){try{let t=e.trim().split(`
4
- `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=lp(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let i=lp(t[o]||"");if(i.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((m,f)=>{l[m]=i[f]||"";});let u=l.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:l["Card ID"]||`card-${o}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),p.cardIds.push(d.id);}catch(i){s.push(`Line ${o+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.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 lp(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function cp(e,t){switch(t){case "json":return Qb(e);case "csv":return Zb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dp(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var kc=react.createContext(null);function up(){return react.useContext(kc)}var pp=react.createContext(null);function mp({children:e,themeName:t}){return jsxRuntime.jsx(pp.Provider,{value:{themeName:t},children:e})}function Wi(){return react.useContext(pp)}function ma({children:e,container:t}){let[a,r]=react.useState(false),n=up(),s=Wi();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:i,themeName:c}=n,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,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 yp={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ih="#BDC3C7",lh=({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 Mo({priority:e,onChange:t,className:a}){let[r,n]=react.useState(false),[s,o]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useRef(null),l=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,b=160,h=220,y=4,x=m.right-b;x<10&&(x=m.left),x+b>v-10&&(x=v-b-10);let w=f-m.bottom,C=m.top,P;w>=h+y?P=m.bottom+y:C>=h+y?P=m.top-h-y:P=w>=C?m.bottom+y:Math.max(10,m.top-h-y),o({top:P,left:x}),n(true);};react.useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),react.useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let u=m=>{t(m),n(false);},p=e?yp[e]:null,d=p?.color||ih;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?n(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ma,{children:jsxRuntime.jsxs("div",{ref:i,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(yp).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(lh,{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 ch=[{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 Vs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=react.useState(false),[o,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),d=(Wi()?.themeName||"dark")==="dark",m=()=>{if(!l.current)return;let x=l.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,P=320,$=380,T=4,S=x.left;S+P>C-10&&(S=C-P-10),S<10&&(S=10);let M=w-x.bottom,N=x.top,U;M>=$+T?U=x.bottom+T:N>=$+T?U=x.top-$-T:U=M>=N?x.bottom+T:Math.max(10,x.top-$-T),i({top:U,left:S}),s(true);};react.useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!l.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,C=S=>{let M=S.getFullYear(),N=String(S.getMonth()+1).padStart(2,"0"),U=String(S.getDate()).padStart(2,"0");return `${M}-${N}-${U}`},P=C(w),$=new Date(w);$.setDate($.getDate()+x);let T=C($);a(P,T),s(false);},v=()=>{if(!e||!t)return "Set date";let x=$=>{if($ instanceof Date)return $;if(typeof $!="string"||!$.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=$.split("-").map(Number);if(T.length!==3||T.some(U=>isNaN(U)))return null;let S=T[0],M=T[1],N=T[2];return S===void 0||M===void 0||N===void 0?null:new Date(S,M-1,N)},w=x(e),C=x(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${P[w.getMonth()]} ${w.getDate()} \u2013 ${P[C.getMonth()]} ${C.getDate()}`},b=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 ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,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:b?`${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(ma,{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:ch.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=>a(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=>a(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:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter: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 Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[i,c]=react.useState(""),[l,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,C=300,P=380,$=4,T=y.right-C;T<10&&(T=y.left),T+C>w-10&&(T=w-C-10);let S=x-y.bottom,M=y.top,N;S>=P+$?N=y.bottom+$:M>=P+$?N=y.top-P-$:N=S>=M?y.bottom+$:Math.max(10,y.top-P-$),u({top:N,left:T}),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);a(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),b=e.slice(0,n),h=e.length-n;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,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:[b.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)),h>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):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(ma,{children:jsxRuntime.jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.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:i,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:()=>{a([]),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 zi(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(c.id,l);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,i=c=>{if(!s.has(c)){s.add(c),o.add(c);let l=r.get(c)||[];for(let u of l){if(!s.has(u)&&i(u))return true;if(o.has(u))return true}}return o.delete(c),false};return i(a)}function _s({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[i,c]=react.useState(false),[l,u]=react.useState(""),[p,d]=react.useState(t.length>0),[m,f]=react.useState({top:0,left:0}),[v,b]=react.useState(null),h=react.useRef(null),y=react.useRef(null),x=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),S=window.innerHeight,M=window.innerWidth,N=300,U=p?380:120,O=4,X=T.right-N;X<10&&(X=T.left),X+N>M-10&&(X=M-N-10);let A=S-T.bottom,Se=T.top,G;A>=U+O?G=T.bottom+O:Se>=U+O?G=T.top-U-O:G=A>=Se?T.bottom+O:Math.max(10,T.top-U-O),f({top:G,left:X}),c(true);};react.useEffect(()=>{if(!i||!y.current)return;let T=y.current.getBoundingClientRect(),S=window.innerHeight,M=window.innerWidth,N=300,U=p?380:120,O=4,X=T.right-N;X<10&&(X=T.left),X+N>M-10&&(X=M-N-10);let A=S-T.bottom,Se=T.top,G;A>=U+O?G=T.bottom+O:Se>=U+O?G=T.top-U-O:G=A>=Se?T.bottom+O:Math.max(10,T.top-U-O),f({top:G,left:X});},[p,i]),react.useEffect(()=>{let T=S=>{h.current&&!h.current.contains(S.target)&&!y.current?.contains(S.target)&&(c(false),u(""));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),react.useEffect(()=>{let T=S=>{S.key==="Escape"&&(c(false),u(""));};if(i)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]);let w=T=>{let S=t.includes(T),M=a.find(N=>N.id===T);if(b(null),S){let N=t.filter(U=>U!==T);r(N),N.length===0&&d(false);}else {if(s&&zi(a,T,e)){let U=`Cannot add "${M?.title||T}" as dependency - would create circular reference`;b(U),o?.(T,M?.title||T),setTimeout(()=>b(null),3e3);return}r([...t,T]),d(true);}},C=()=>{let T=!p;d(T),T||r([]);},P=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),$=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>i?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:$,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:$},children:t.length})]}),i&&jsxRuntime.jsx(ma,{children:jsxRuntime.jsxs("div",{ref:h,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:C,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:l,onChange:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:P.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"}):P.map(T=>{let S=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:S?"#00E5CC":"transparent",borderColor:S?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:S&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Un=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:$i.Transform.toString(d),transition:m};if(t)return jsxRuntime.jsx("div",{ref:p,style:v,...l,...u,onClick:()=>a?.(e),children:t(e)});let b=i.filter(w=>e.assignedUserIds?.includes(w.id)),h=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",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...u,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError: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,C)=>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:P=>{P.currentTarget.style.display="none";}}),C===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:h?"line-through":"none",opacity:h?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Mo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Vs,{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,C)=>o?.(e.id,{startDate:w,endDate:C})})}),i.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Fo,{assignedUsers:b,availableUsers:i,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(_s,{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(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Un.displayName="Card";var Gi={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"}},Ep=({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 Mp({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=react.useState(false),[o,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),u=[...Object.entries(Gi).map(([b,h])=>({id:b,label:h.label,color:h.color,icon:h.icon})),...r.filter(b=>!Object.keys(Gi).includes(b.id)).map(b=>({id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let b=Gi[e];if(b)return {...b,id:e};let h=r.find(y=>y.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Gi.todo,id:"todo"}},d=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,x=180,w=280,C=4,P=b.right-x;P<10&&(P=b.left),P+x>y-10&&(P=y-x-10);let $=h-b.bottom,T=b.top,S;$>=w+C?S=b.bottom+C:T>=w+C?S=b.top-w-C:S=$>=T?b.bottom+C:Math.max(10,b.top-w-C),i({top:S,left:P}),s(true);};react.useEffect(()=>{let b=h=>{c.current&&!c.current.contains(h.target)&&!l.current?.contains(h.target)&&s(false);};if(n)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]);let m=b=>{t(b),s(false);},f=p(),v=f.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,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(Ep,{icon:f.icon,color:v})}),n&&jsxRuntime.jsx(ma,{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(b=>jsxRuntime.jsxs("button",{onClick:()=>m(b.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:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ep,{icon:b.icon,color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:b.label}),e===b.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"})})]},b.id))})]})})]})}var Pp={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 Fp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Pp[s]||Pp.en,[i,c]=react.useState(false),[l,u]=react.useState(false),[p,d]=react.useState(e),[m,f]=react.useState({top:0,left:0}),v=react.useRef(null),b=react.useRef(null),h=react.useRef(null);react.useEffect(()=>{if(i&&b.current){let C=b.current.getBoundingClientRect();f({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),react.useEffect(()=>{let C=P=>{v.current&&!v.current.contains(P.target)&&!b.current?.contains(P.target)&&(c(false),u(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{let C=P=>{P.key==="Escape"&&(c(false),u(false),d(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),react.useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select());},[l]);let y=()=>{u(true),d(e);},x=()=>{let C=p.trim();C&&C!==e&&t(C),u(false),c(false),d(e);},w=C=>{C.key==="Enter"?x():C.key==="Escape"&&(u(false),d(e));};return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsx("button",{ref:b,onClick:()=>c(!i),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"})]})}),i&&jsxRuntime.jsx(ma,{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:l?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:h,type:"text",value:p,onChange:C=>d(C.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})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),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 ls=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:b=false,className:h,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),P=react.useRef(null),$=u??ap(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>P.current,estimateSize:()=>p,enabled:$}),S=t.filter(X=>!X.metadata?.isContainer).length;if(a)return jsxRuntime.jsx("div",{ref:w,className:h,children:a(e,t)});let N=(()=>{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}})(),U=N.state==="exceeded",O=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",U&&"ring-2 ring-asakaa-accent-red",h),children:[n?n(e,S):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:[S,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&N.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${N.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[N.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"})]}),N.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"})]}),N.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"})}),N.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(Fp,{columnTitle:e.title,onRename:X=>f?.(e.id,X),onDelete:v?()=>v(e.id):void 0,isDeletable:b,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:P,className:"asakaa-column-cards",style:{maxHeight:$?"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"})}):$?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(X=>{let A=t[X.index];return A?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${X.start}px)`},children:jsxRuntime.jsx(Un,{card:A,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l})},A.id):null})}):t.map(X=>jsxRuntime.jsx(Un,{card:X,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l},X.id))})})]})});ls.displayName="Column";function Sc({title:e,onSave:t,className:a}){let[r,n]=react.useState(false),[s,o]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},l=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return r?jsxRuntime.jsx("input",{ref:i,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:l,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Mh(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function $p(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(l===s||c===s||u.some(p=>p===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Ph(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Fh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Lh=["\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 Op({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let b=i==="dark",[h,y]=react.useState(false),[x,w]=react.useState([]),[C,P]=react.useState(0),[$,T]=react.useState(null),[S,M]=react.useState(false),N=react.useRef(null),U=react.useRef(null),O=react.useRef(null),X=react.useRef(null),A=react.useCallback((ne,Be)=>{let ce=Mh(ne,Be);if(T(ce),ce){let Ne=r.filter(ze=>ze.name.toLowerCase().includes(ce.query)||ze.email&&ze.email.toLowerCase().includes(ce.query)).slice(0,5);w(Ne),y(Ne.length>0),P(0);}else y(false),w([]);},[r]),Se=ne=>{let Be=ne.target.value;if(t(Be),A(Be,ne.target.selectionStart||0),N.current){N.current.style.height="24px";let ce=N.current.scrollHeight,Ne=280,ze=Math.min(ce,Ne);N.current.style.height=`${ze}px`,N.current.style.overflowY=ce>Ne?"auto":"hidden";}},G=()=>{N.current&&A(e,N.current.selectionStart||0);},ve=react.useCallback(ne=>{if(!$||!N.current)return;let Be=e.slice(0,$.start),ce=e.slice($.end),Ne=`@${ne.name.replace(/\s+/g,"")} `,ze=Be+Ne+ce;t(ze),y(false),T(null),setTimeout(()=>{if(N.current){let Le=$.start+Ne.length;N.current.selectionStart=Le,N.current.selectionEnd=Le,N.current.focus();}},0);},[$,e,t]),R=ne=>{if(h&&x.length>0)switch(ne.key){case "ArrowDown":ne.preventDefault(),P(Be=>Be<x.length-1?Be+1:0);break;case "ArrowUp":ne.preventDefault(),P(Be=>Be>0?Be-1:x.length-1);break;case "Enter":{ne.preventDefault();let Be=x[C];Be&&ve(Be);break}case "Tab":{ne.preventDefault();let Be=x[C];Be&&ve(Be);break}case "Escape":ne.preventDefault(),y(false);break}else ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),a());};react.useEffect(()=>{let ne=Be=>{U.current&&!U.current.contains(Be.target)&&N.current&&!N.current.contains(Be.target)&&y(false),X.current&&!X.current.contains(Be.target)&&M(false);};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[]);let ye=react.useCallback(ne=>{if(!N.current)return;let Be=N.current.selectionStart||e.length,ce=e.slice(0,Be)+ne+e.slice(Be);t(ce),M(false),setTimeout(()=>{if(N.current){let Ne=Be+ne.length;N.current.selectionStart=Ne,N.current.selectionEnd=Ne,N.current.focus();}},0);},[e,t]),V=react.useCallback(ne=>{if(!m||!ne.target.files)return;let Be=Array.from(ne.target.files),ce=v*1024*1024,Ne=Be.filter(ze=>ze.size>ce?(console.warn(`File ${ze.name} exceeds max size of ${v}MB`),false):true);Ne.length>0&&m(Ne),ne.target.value="";},[m,v]),Ue=react.useCallback(ne=>ne.type.startsWith("image/")?lucideReact.Image:ne.type.includes("pdf")||ne.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(h&&U.current){let ne=U.current.children[C];ne&&ne.scrollIntoView({block:"nearest"});}},[C,h]),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(ne=>{let Be=Ue(ne.file),ce=ne.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",b?"bg-white/10":"bg-gray-100"),children:[ce&&ne.preview?jsxRuntime.jsx("img",{src:ne.preview,alt:ne.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(Be,{className:g("w-4 h-4",b?"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",b?"text-white":"text-gray-900"),children:ne.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Fh(ne.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(ne.id),className:g("p-0.5 rounded-full transition-colors",b?"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"})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[l&&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:l.color||"#8B5CF6"},children:l.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",b?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>M(!S),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",b?"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:S&&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",b?"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:Lh.map(ne=>jsxRuntime.jsx("button",{type:"button",onClick:()=>ye(ne),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",b?"hover:bg-white/10":"hover:bg-gray-100"),children:ne},ne))})})})]}),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",b?"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:V,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:N,value:e,onChange:Se,onSelect:G,onKeyDown:R,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",b?"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:a,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]":b?"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:h&&x.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:U,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",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((ne,Be)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>ve(ne),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Be===C?b?"bg-white/10":"bg-gray-100":b?"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:ne.color||"#8B5CF6"},children:Ph(ne.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:g("text-sm font-medium truncate",b?"text-white":"text-gray-900"),children:ne.name}),ne.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",b?"text-[#6B7280]":"text-gray-500"),children:ne.email})]})]},ne.id))})})]})]})]})}function Hp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsxRuntime.jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:i.value},c):jsxRuntime.jsx("span",{children:i.value},c))})}var qi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function cs({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[i,c]=react.useState(false),[l,u]=react.useState(""),[p,d]=react.useState(false),[m,f]=react.useState(qi[10]||"#00E5CC"),[v,b]=react.useState({top:0,left:0}),h=react.useRef(null),y=react.useRef(null),x=react.useRef(null),w=react.useRef(null),C=t.filter(N=>N.name.toLowerCase().includes(l.toLowerCase())),P=t.some(N=>N.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(i&&y.current){let N=y.current.getBoundingClientRect();b({top:N.bottom+6,left:N.left});}},[i]),react.useEffect(()=>{let N=U=>{let O=U.target,X=h.current?.contains(O),A=x.current?.contains(O);!X&&!A&&(c(false),u(""),d(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),react.useEffect(()=>{i&&w.current&&w.current.focus();},[i]);let $=N=>{let U=e.some(O=>O.id===N.id);a(U?e.filter(O=>O.id!==N.id):[...e,N]);},T=async()=>{if(!(!r||!l.trim())){d(true);try{let N=await r(l.trim(),m);N&&(a([...e,N]),u(""),f(qi[Math.floor(Math.random()*qi.length)]||"#00E5CC"));}finally{d(false);}}},S=(N,U)=>{U.stopPropagation(),a(e.filter(O=>O.id!==N));},M={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,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(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.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:i&&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:l,onChange:N=>u(N.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:N=>{N.key==="Enter"&&l.trim()&&!P&&r&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>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:`${N.color}20`,color:N.color},onClick:U=>S(N.id,U),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(N=>{let U=e.some(O=>O.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>$(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:U?`${N.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{U||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{U||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):l.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"})}),l.trim()&&!P&&r&&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:qi.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:m===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,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 "',l.trim(),'"']})]})]})}),document.body)]})}function Mc({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="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 Wp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(Mc,{tag:s,size:a},s.id)),n>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="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 Ao=[{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 zp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Wh(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 zh({className:e}){return jsxRuntime.jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function Pc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=Wh(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"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=zp(e.loggedMinutes),l=e.estimateMinutes?zp(e.estimateMinutes):null,u=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"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],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(zh,{className:i[t]}),jsxRuntime.jsx("span",{children:u})]})}function Gh(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Xi(e){let t=Gh(e);return t!==null?String(t):e}function Vp(e){let a=Xi(e).trim().toLowerCase();if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ji(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function _h(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Kh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function qh({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 jp({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 Yh({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:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:u,className:p}){let[d,m]=react.useState(""),[f,v]=react.useState(t.estimateMinutes?Ji(t.estimateMinutes):""),[b,h]=react.useState(""),[y,x]=react.useState(false),[w,C]=react.useState(false),P=react.useRef(null);react.useEffect(()=>{P.current?.focus();},[]);let $=async()=>{let M=Vp(d);if(!(M<=0||!s)){x(true);try{await s({durationMinutes:M,note:b.trim()||void 0,source:"manual"}),m(""),h("");}finally{x(false);}}},T=async()=>{if(!o)return;let M=f.trim()?Vp(f):null;await o(M),C(false);},S=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),$()),M.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(jp,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?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:_h(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(qh,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:l,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(jp,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:i,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(Kh,{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(Yh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:P,type:"text",value:d,onChange:M=>m(M.target.value),onKeyDown:S,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:$,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:b,onChange:M=>h(M.target.value),onKeyDown:S,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:Ji(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:M=>v(M.target.value),onKeyDown:M=>{M.key==="Enter"&&T(),M.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ji(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)}%`}})})]})]}),a.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:a.slice(0,3).map(M=>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:M.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Ji(M.durationMinutes)})]},M.id))})]})]})}function ey(e){let a=Xi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function ty(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function En({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[i,c]=react.useState(ty(r)),[l,u]=react.useState(""),[p,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=ey(i);await n(x&&x>0?x:null,l||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},b=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},h={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:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"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:a?"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:a?"#007FFF":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:h[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"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:i,onChange:x=>c(x.target.value),onKeyDown:b,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"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:l,onChange:x=>u(x.target.value),onKeyDown:b,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:p||!i.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:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&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:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function ay(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 ry(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 Ac({summary:e,showLabel:t=false,size:a="md",className:r}){let n=ay(e.health),s=ry(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),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",r),children:[jsxRuntime.jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),l&&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:[i,"%"]})]})}function ds(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function oy(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 sy(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 iy(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 ly({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"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",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",ds(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:g("text-xs mt-1",i),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",i),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:a?"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:a?"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:a?"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",i),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:i,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:ds(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:ds(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function cy({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(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",i),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?ds(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:ds(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?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[n,ds(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?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),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",sy(e.status,a),oy(e.status,a)),children:iy(e.status,t)})})]})}function Ic({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",i=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",l=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:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:g("space-y-6 p-6",i,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:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(ly,{summary:e.summary,locale:a,isDark:o}),jsxRuntime.jsx("div",{className:g("rounded-lg border overflow-hidden",c,l),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:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="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:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",l),children:m.map(f=>jsxRuntime.jsx(cy,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",p),children:a==="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 us(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Cy(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function tm(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Ty(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 Io({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:b,mentionableUsers:h=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:P=false,timerElapsedSeconds:$=0,onTimeLog:T,onEstimateUpdate:S,onSoldEffortUpdate:M,onTimerStart:N,onTimerStop:U,onTimerDiscard:O,blurFinancials:X=false}){let A=s==="dark",Se={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},G=e&&"title"in e&&!("name"in e),ve=e,[R,ye]=react.useState(e?tm(e,i):null),[V,Ue]=react.useState(false),[ne,Be]=react.useState(false),[ce,Ne]=react.useState(false),[ze,Le]=react.useState(null),[$e,Ve]=react.useState(new Date),[oe,je]=react.useState(false),[et,Re]=react.useState(false),[ut,Nt]=react.useState(""),[lt,Ee]=react.useState(false),[ct,xt]=react.useState(false),[Ke,st]=react.useState(false),[L,J]=react.useState(false),[Ce,I]=react.useState(""),K=react.useRef(null),we=react.useRef(null),[Ge,pe]=react.useState(""),rt=react.useRef(null),[bt,qe]=react.useState(""),[ht,Yt]=react.useState(false),[kt,de]=react.useState([]),[De,tt]=react.useState(""),[Bt,Wt]=react.useState(false),Qe=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=tm(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),ye(D),I(D.description||""),pe(D.name||"");}},[e?.id,e?.quotedMinutes,i,t]),react.useEffect(()=>{if(!t||!Ce)return;let D=setTimeout(()=>{let W=we.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,Ce]),react.useEffect(()=>()=>{K.current&&clearTimeout(K.current),rt.current&&clearTimeout(rt.current);},[]),react.useEffect(()=>{t&&Qe.current&&f.length>0&&setTimeout(()=>{Qe.current&&(Qe.current.scrollTop=Qe.current.scrollHeight);},100);},[t,f.length]);let vt=react.useCallback(D=>{ye(D),G&&n&&ve?n(Ty(D,ve)):r&&r(D);},[G,ve,n,r]),xa=react.useCallback(()=>{Ue(false),Be(false),Ne(false),Le(null),Re(false),Nt(""),Ee(false);},[]),At=react.useCallback((D,W)=>{if(!R)return;let ue={...R,[D]:W};vt(ue);},[R,vt]),er=react.useCallback(()=>{let D=we.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),fa=react.useCallback(D=>{I(D),setTimeout(er,0),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{if(R){let W={...R,description:D};vt(W);}},800);},[R,vt,er]),hr=react.useCallback(D=>{pe(D),rt.current&&clearTimeout(rt.current),rt.current=setTimeout(()=>{if(R&&D.trim()){let W={...R,name:D.trim()};vt(W);}},800);},[R,vt]),Ye=react.useCallback(D=>{let W=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});de(ue=>[...ue,...W]);},[]),Ze=react.useCallback(D=>{de(W=>{let ue=W.find(ke=>ke.id===D);return ue?.preview&&URL.revokeObjectURL(ue.preview),W.filter(ke=>ke.id!==D)});},[]),Aa=react.useCallback(async()=>{if(!(!R||!bt.trim()&&kt.length===0||!v)){Yt(true);try{let D=$p(bt,h),W=[];if(kt.length>0&&y){let ue=kt.map(ke=>ke.file);W=await y(ue);}await v(R.id,bt.trim(),D.length>0?D:void 0,W.length>0?W:void 0),qe(""),kt.forEach(ue=>{ue.preview&&URL.revokeObjectURL(ue.preview);}),de([]);}finally{Yt(false);}}},[R,bt,kt,v,h,y]),Ia=react.useCallback(()=>{if(!R||!De.trim())return;let D=R.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:De.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},ue=[...D,W],ke={...R,subtasks:ue};vt(ke),tt(""),Wt(false);},[R,De,vt]),sr=react.useCallback(D=>{if(!R?.subtasks)return;let W=R.subtasks.map(ke=>ke.id===D?{...ke,progress:ke.progress===100?0:100}:ke),ue={...R,subtasks:W};vt(ue);},[R,vt]),Ta=react.useCallback(D=>{if(!R?.subtasks)return;let W=R.subtasks.filter(ke=>ke.id!==D),ue={...R,subtasks:W};vt(ue);},[R,vt]),Rr=react.useCallback(D=>{let W=typeof D=="string"?new Date(D):D,ke=new Date().getTime()-W.getTime(),ot=Math.floor(ke/6e4),be=Math.floor(ke/36e5),_=Math.floor(ke/864e5);return ot<1?o==="es"?"Ahora":"Just now":ot<60?o==="es"?`Hace ${ot} min`:`${ot}m ago`:be<24?o==="es"?`Hace ${be}h`:`${be}h ago`:_<7?o==="es"?`Hace ${_}d`:`${_}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),ie=react.useCallback(D=>{if(!R)return;let W=R.progress||0;D==="completed"?W=100:D==="in-progress"&&W===0?W=10:D==="todo"&&(W=0);let ue={...R,status:D,progress:W};vt(ue),Ue(false);},[R,vt]),fe=react.useCallback((D,W)=>{if(!R)return;let ue={...R,startDate:D,endDate:W};vt(ue);},[R,vt]),pt=react.useCallback(()=>{let D=$e.getFullYear(),W=$e.getMonth(),ue=new Date(D,W,1),ot=new Date(D,W+1,0).getDate(),be=ue.getDay(),_=[],gt=new Date(D,W,0).getDate();for(let _t=be-1;_t>=0;_t--)_.push({date:new Date(D,W-1,gt-_t),isCurrentMonth:false});for(let _t=1;_t<=ot;_t++)_.push({date:new Date(D,W,_t),isCurrentMonth:true});let yt=42-_.length;for(let _t=1;_t<=yt;_t++)_.push({date:new Date(D,W+1,_t),isCurrentMonth:false});return _},[$e]),j=react.useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),st(false),!R||!p)return;let W=Array.from(D.dataTransfer.files);if(W.length!==0){J(true);try{await p(R.id,W);}finally{J(false);}}},[R,p]),he=react.useCallback(async D=>{if(!R||!p||!D.target.files)return;let W=Array.from(D.target.files);if(W.length!==0){J(true);try{await p(R.id,W);}finally{J(false);}D.target.value="";}},[R,p]),re=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),st(true);},[]),B=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),st(false);},[]),Z=react.useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),Te=react.useCallback(D=>D.startsWith("image/")?lucideReact.Image:D.includes("pdf")||D.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!R?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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",A?"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]",A?"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",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",A?"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",A?"text-[#6B7280]":"text-gray-400"),children:R.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=R.progress===100?0:100,ue={...R,progress:D,status:D===100?"completed":"todo"};vt(ue);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ge,onChange:D=>hr(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",R.progress===100?"line-through text-[#6B7280]":A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{xa(),Ue(!V);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&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]",A?"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:()=>ie(D.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",R.status===D.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{xa(),Ne(!ce);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[R.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)),R.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ne(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",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(D=>{let W=R.assignees?.some(ue=>ue.name===D.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ue=R.assignees||[],ke;W?ke=ue.filter(ot=>ot.name!==D.name):ke=[...ue,D],At("assignees",ke);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",W&&(A?"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",A?"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",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Le(ze?null:"start"),Ve(R.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:g("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(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",A?"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",A?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,W=new Date(D);W.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 ot=new Date(D);ot.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let be=new Date(D);be.setDate(D.getDate()+14);let _=new Date(D);return _.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: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:ot,display:ot.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:be,display:be.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:_,display:_.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((yt,_t)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ze==="start"){let Xt=R.endDate&&yt.date>R.endDate?yt.date:R.endDate;fe(yt.date,Xt),Le("end");}else {let Xt=R.startDate&&yt.date<R.startDate?yt.date:R.startDate;fe(Xt,yt.date),Le(null);}},children:[jsxRuntime.jsx("span",{children:yt.label}),jsxRuntime.jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:yt.display})]},_t))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{fe(void 0,void 0),Le(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"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",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ze==="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",A?"text-white":"text-gray-900"),children:$e.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:()=>Ve(new Date),className:g("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ve(new Date($e.getFullYear(),$e.getMonth()-1)),className:g("p-1 rounded",A?"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:()=>Ve(new Date($e.getFullYear(),$e.getMonth()+1)),className:g("p-1 rounded",A?"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",A?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:pt().map((D,W)=>{let ue=D.date.toDateString()===new Date().toDateString(),ke=R.startDate?.toDateString()===D.date.toDateString(),ot=R.endDate?.toDateString()===D.date.toDateString(),be=ke||ot,_=R.startDate&&R.endDate&&D.date>=R.startDate&&D.date<=R.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let gt=new Date(D.date);if(ze==="start"){let yt=R.endDate&&gt>R.endDate?gt:R.endDate;fe(gt,yt),Le("end");}else {let yt=R.startDate&&gt<R.startDate?gt:R.startDate;fe(yt,gt),Le(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(A?"text-white":"text-gray-900"),ue&&"ring-2 ring-[#00E5CC]",ke&&"bg-[#00E5CC] text-white",ot&&!ke&&"bg-[#7C3AED] text-white",_&&!be&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!be&&(A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{xa(),Be(!ne);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&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 min-w-[140px]",A?"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:()=>{At("priority",D.id),Be(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",R.priority===D.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.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",A?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[oe?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:D=>{let W=parseInt(D.target.value),ue=R.status;W===100?ue="completed":W>0?ue="in-progress":ue="todo";let ke={...R,progress:W,status:ue};vt(ke);},onBlur:()=>je(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"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:()=>je(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",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[R.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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"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:R.status==="completed"||R.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?us(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>xt("estimate"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:us(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>xt("estimate"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="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(En,{mode:"estimate",locale:o,isDark:A,currentValue:w?.estimateMinutes||null,onSave:async D=>{await S?.(R.id,D),xt(false);},onClose:()=>xt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"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",A?"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"}):R.status==="completed"||R.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?us(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>xt("quoted"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:us(R.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>xt("quoted"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="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(En,{mode:"quoted",locale:o,isDark:A,currentValue:R.quotedMinutes||null,onSave:async D=>{M?(await M(R.id,D),ye(W=>W?{...W,quotedMinutes:D}:null)):At("quotedMinutes",D),xt(false);},onClose:()=>xt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsxRuntime.jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"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"})}):P?jsxRuntime.jsxs("button",{type:"button",onClick:()=>U?.(R.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"}),Cy($||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>N?.(R.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"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"})}),R.status==="completed"||R.progress===100?jsxRuntime.jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"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:()=>xt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"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":A?"text-white":"text-gray-900"),children:[us(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",us(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:ct==="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(En,{mode:"log",locale:o,isDark:A,currentValue:null,onSave:async(D,W)=>{D&&await T?.(R.id,{durationMinutes:D,note:W,source:"manual"}),xt(false);},onClose:()=>xt(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(cs,{selectedTags:R.tags||[],availableTags:c,onChange:D=>{At("tags",D);},onCreateTag:l,theme:Se})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(D=>{let W=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",A?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[W?.name||D.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ue=(R.dependencies||[]).filter(ke=>ke!==D);At("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:()=>{xa(),Re(!et);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"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",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Re(false),Nt("");}}),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]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ut,onChange:D=>Nt(D.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",A?"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!==R.id).filter(D=>ut===""||D.name.toLowerCase().includes(ut.toLowerCase())).map(D=>{let W=R.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ue=R.dependencies||[],ke;W?ke=ue.filter(ot=>ot!==D.id):ke=[...ue,D.id],At("dependencies",ke);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",W&&(A?"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]":A?"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",A?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("span",{className:g("text-xs",A?"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",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{xa(),Ee(!lt);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"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:R.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:Ao.find(D=>D.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(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",A?"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:Ao.map(D=>{let W=R.color===D.value;return jsxRuntime.jsx("button",{onClick:()=>{At("color",D.value),Ee(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"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:R.isMilestone||false,onChange:D=>At("isMilestone",D.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":A?"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",A?"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",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:we,value:Ce,onChange:D=>fa(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",A?"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",A?"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",A?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(D=>D.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...R.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",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>sr(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":A?"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]":A?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("button",{onClick:()=>Ta(D.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"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))}),Bt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:De,onChange:D=>tt(D.target.value),onKeyDown:D=>{D.key==="Enter"&&De.trim()?Ia():D.key==="Escape"&&(Wt(false),tt(""));},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",A?"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:Ia,disabled:!De.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",De.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":A?"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:()=>{Wt(false),tt("");},className:g("p-2 rounded-lg transition-colors",A?"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:()=>Wt(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",A?"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",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",A?"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=Te(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",A?"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",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(W,{className:g("w-5 h-5",A?"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",A?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("p",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Z(D.size)})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(D.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"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:re,onDragLeave:B,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ke?A?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":A?"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:he,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",A?"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",Ke?"text-[#00E5CC]":A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:Ke?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",A?"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",A?"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]",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",A?"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'),qb=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 qb__default=/*#__PURE__*/_interopDefault(qb);var Bi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var $i=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [$i.Translate.toString(e),$i.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Oi(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 Gb(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function yc(e,t){return e.length===0?1e3:t===0?Oi(null,e[0].position):t>=e.length?Oi(e[e.length-1].position,null):Oi(e[t-1].position,e[t].position)}function ap(e,t=100){return e>t}var Vb=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,a,r){let n=t*Math.pow(a,e-1),s=n*.2*Math.random();return Math.min(n+s,r)}async function Hi(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Vb,onRetry:i}=t,c,l=0;for(let p=1;p<=a;p++){l=p;try{return {data:await e(),attempts:l,success:!0}}catch(u){if(c=u,p===a||!o(c,p))return {error:c,attempts:l,success:false};let m=_b(p,r,n,s);if(i)try{i(c,p,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:l,success:false}}function jb(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(n){if(a=n,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Kb(e,t={}){return async(...a)=>Hi(()=>e(...a),t)}var xc=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var rp=(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))(rp||{}),Eo=class Eo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(i,n,c?o:"");break;case "INFO":console.info(i,n,c?o:"");break;case "WARN":console.warn(i,n,c?o:"");break;case "ERROR":console.error(i,n,c?o:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Eo.globalOptions};}static configure(t){Eo.globalOptions={...Eo.globalOptions,...t};}child(t){return new Eo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ui((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ui(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:rp[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};Eo.globalOptions={};var vc=Eo,Ui=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},np=new vc;function Yb(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Xb(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let o=e.columns.find(i=>i.id===s.columnId);return [s.id,wc(s.title),wc(s.description||""),wc(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
+ `)}async function Jb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await qb__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=o.toDataURL("image/png"),c=297,l=210,p=o.width/o.height,u=c-20,d=u/p;d>l-20&&(d=l-20,u=d*p);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-u)/2;return m.addImage(i,"PNG",f,20,u,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 i=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,i.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):i.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 p=n.splitTextToSize(c.description,160);n.text(p,25,s),s+=p.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),l.push(p.join(" \u2192 "));}l.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(l.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function wc(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function sp(e,t,a,r){switch(t){case "json":return Yb(e,r);case "csv":return Xb(e);case "pdf":return await Jb(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ip(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:o[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Qb(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Zb(e){try{let t=e.trim().split(`
4
+ `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=lp(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let i=lp(t[o]||"");if(i.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((m,f)=>{l[m]=i[f]||"";});let p=l.Column||"Unnamed";n.has(p)||n.set(p,{id:`col-${n.size+1}`,title:p,position:n.size+1,cardIds:[]});let u=n.get(p),d={id:l["Card ID"]||`card-${o}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:u.id,position:u.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),u.cardIds.push(d.id);}catch(i){s.push(`Line ${o+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.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 lp(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function cp(e,t){switch(t){case "json":return Qb(e);case "csv":return Zb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dp(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var kc=react.createContext(null);function up(){return react.useContext(kc)}var pp=react.createContext(null);function mp({children:e,themeName:t}){return jsxRuntime.jsx(pp.Provider,{value:{themeName:t},children:e})}function Wi(){return react.useContext(pp)}function ba({children:e,container:t}){let[a,r]=react.useState(false),n=up(),s=Wi();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:i,themeName:c}=n,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,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 yp={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ih="#BDC3C7",lh=({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 Mo({priority:e,onChange:t,className:a}){let[r,n]=react.useState(false),[s,o]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useRef(null),l=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,b=160,h=220,y=4,x=m.right-b;x<10&&(x=m.left),x+b>v-10&&(x=v-b-10);let w=f-m.bottom,C=m.top,P;w>=h+y?P=m.bottom+y:C>=h+y?P=m.top-h-y:P=w>=C?m.bottom+y:Math.max(10,m.top-h-y),o({top:P,left:x}),n(true);};react.useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),react.useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let p=m=>{t(m),n(false);},u=e?yp[e]:null,d=u?.color||ih;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?n(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:u?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ba,{children:jsxRuntime.jsxs("div",{ref:i,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(yp).map(([m,f])=>jsxRuntime.jsxs("button",{onClick:()=>p(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(lh,{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:()=>p(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 ch=[{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 Vs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=react.useState(false),[o,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),d=(Wi()?.themeName||"dark")==="dark",m=()=>{if(!l.current)return;let x=l.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,P=320,O=380,N=4,S=x.left;S+P>C-10&&(S=C-P-10),S<10&&(S=10);let M=w-x.bottom,T=x.top,z;M>=O+N?z=x.bottom+N:T>=O+N?z=x.top-O-N:z=M>=T?x.bottom+N:Math.max(10,x.top-O-N),i({top:z,left:S}),s(true);};react.useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!l.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,C=S=>{let M=S.getFullYear(),T=String(S.getMonth()+1).padStart(2,"0"),z=String(S.getDate()).padStart(2,"0");return `${M}-${T}-${z}`},P=C(w),O=new Date(w);O.setDate(O.getDate()+x);let N=C(O);a(P,N),s(false);},v=()=>{if(!e||!t)return "Set date";let x=O=>{if(O instanceof Date)return O;if(typeof O!="string"||!O.match(/^\d{4}-\d{2}-\d{2}$/))return null;let N=O.split("-").map(Number);if(N.length!==3||N.some(z=>isNaN(z)))return null;let S=N[0],M=N[1],T=N[2];return S===void 0||M===void 0||T===void 0?null:new Date(S,M-1,T)},w=x(e),C=x(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${P[w.getMonth()]} ${w.getDate()} \u2013 ${P[C.getMonth()]} ${C.getDate()}`},b=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 ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,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:b?`${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(ba,{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:ch.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=>a(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=>a(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:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter: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 Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState({top:0,left:0}),u=react.useRef(null),d=react.useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,C=300,P=380,O=4,N=y.right-C;N<10&&(N=y.left),N+C>w-10&&(N=w-C-10);let S=x-y.bottom,M=y.top,T;S>=P+O?T=y.bottom+O:M>=P+O?T=y.top-P-O:T=S>=M?y.bottom+O:Math.max(10,y.top-P-O),p({top:T,left:N}),o(true);};react.useEffect(()=>{let y=x=>{u.current&&!u.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);a(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),b=e.slice(0,n),h=e.length-n;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,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:[b.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)),h>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):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(ba,{children:jsxRuntime.jsxs("div",{ref:u,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.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:i,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:()=>{a([]),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 zi(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let u=p;return u.taskId||u.targetId||""}).filter(Boolean);r.set(c.id,l);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,i=c=>{if(!s.has(c)){s.add(c),o.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(o.has(p))return true}}return o.delete(c),false};return i(a)}function js({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[i,c]=react.useState(false),[l,p]=react.useState(""),[u,d]=react.useState(t.length>0),[m,f]=react.useState({top:0,left:0}),[v,b]=react.useState(null),h=react.useRef(null),y=react.useRef(null),x=()=>{if(!y.current)return;let N=y.current.getBoundingClientRect(),S=window.innerHeight,M=window.innerWidth,T=300,z=u?380:120,$=4,J=N.right-T;J<10&&(J=N.left),J+T>M-10&&(J=M-T-10);let L=S-N.bottom,Ae=N.top,U;L>=z+$?U=N.bottom+$:Ae>=z+$?U=N.top-z-$:U=L>=Ae?N.bottom+$:Math.max(10,N.top-z-$),f({top:U,left:J}),c(true);};react.useEffect(()=>{if(!i||!y.current)return;let N=y.current.getBoundingClientRect(),S=window.innerHeight,M=window.innerWidth,T=300,z=u?380:120,$=4,J=N.right-T;J<10&&(J=N.left),J+T>M-10&&(J=M-T-10);let L=S-N.bottom,Ae=N.top,U;L>=z+$?U=N.bottom+$:Ae>=z+$?U=N.top-z-$:U=L>=Ae?N.bottom+$:Math.max(10,N.top-z-$),f({top:U,left:J});},[u,i]),react.useEffect(()=>{let N=S=>{h.current&&!h.current.contains(S.target)&&!y.current?.contains(S.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),react.useEffect(()=>{let N=S=>{S.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i]);let w=N=>{let S=t.includes(N),M=a.find(T=>T.id===N);if(b(null),S){let T=t.filter(z=>z!==N);r(T),T.length===0&&d(false);}else {if(s&&zi(a,N,e)){let z=`Cannot add "${M?.title||N}" as dependency - would create circular reference`;b(z),o?.(N,M?.title||N),setTimeout(()=>b(null),3e3);return}r([...t,N]),d(true);}},C=()=>{let N=!u;d(N),N||r([]);},P=a.filter(N=>N.id!==e).filter(N=>N.title.toLowerCase().includes(l.toLowerCase())||N.id.toLowerCase().includes(l.toLowerCase())),O=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>i?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:O,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:O},children:t.length})]}),i&&jsxRuntime.jsx(ba,{children:jsxRuntime.jsxs("div",{ref:h,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:C,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:u?"#00E5CC":"transparent",borderColor:u?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:u&&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"})]})}),u&&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:l,onChange:N=>p(N.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:P.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"}):P.map(N=>{let S=t.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>w(N.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:S?"#00E5CC":"transparent",borderColor:S?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:S&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:N.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:N.id})]})]},N.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Un=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:u,transform:d,transition:m,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:$i.Transform.toString(d),transition:m};if(t)return jsxRuntime.jsx("div",{ref:u,style:v,...l,...p,onClick:()=>a?.(e),children:t(e)});let b=i.filter(w=>e.assignedUserIds?.includes(w.id)),h=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:u,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError: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,C)=>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:P=>{P.currentTarget.style.display="none";}}),C===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:h?"line-through":"none",opacity:h?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Mo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Vs,{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,C)=>o?.(e.id,{startDate:w,endDate:C})})}),i.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Fo,{assignedUsers:b,availableUsers:i,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(js,{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(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Un.displayName="Card";var Gi={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"}},Ep=({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 Mp({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=react.useState(false),[o,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),p=[...Object.entries(Gi).map(([b,h])=>({id:b,label:h.label,color:h.color,icon:h.icon})),...r.filter(b=>!Object.keys(Gi).includes(b.id)).map(b=>({id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}))],u=()=>{let b=Gi[e];if(b)return {...b,id:e};let h=r.find(y=>y.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Gi.todo,id:"todo"}},d=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,x=180,w=280,C=4,P=b.right-x;P<10&&(P=b.left),P+x>y-10&&(P=y-x-10);let O=h-b.bottom,N=b.top,S;O>=w+C?S=b.bottom+C:N>=w+C?S=b.top-w-C:S=O>=N?b.bottom+C:Math.max(10,b.top-w-C),i({top:S,left:P}),s(true);};react.useEffect(()=>{let b=h=>{c.current&&!c.current.contains(h.target)&&!l.current?.contains(h.target)&&s(false);};if(n)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]);let m=b=>{t(b),s(false);},f=u(),v=f.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,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(Ep,{icon:f.icon,color:v})}),n&&jsxRuntime.jsx(ba,{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:p.map(b=>jsxRuntime.jsxs("button",{onClick:()=>m(b.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:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ep,{icon:b.icon,color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:b.label}),e===b.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"})})]},b.id))})]})})]})}var Pp={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 Fp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Pp[s]||Pp.en,[i,c]=react.useState(false),[l,p]=react.useState(false),[u,d]=react.useState(e),[m,f]=react.useState({top:0,left:0}),v=react.useRef(null),b=react.useRef(null),h=react.useRef(null);react.useEffect(()=>{if(i&&b.current){let C=b.current.getBoundingClientRect();f({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),react.useEffect(()=>{let C=P=>{v.current&&!v.current.contains(P.target)&&!b.current?.contains(P.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{let C=P=>{P.key==="Escape"&&(c(false),p(false),d(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),react.useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select());},[l]);let y=()=>{p(true),d(e);},x=()=>{let C=u.trim();C&&C!==e&&t(C),p(false),c(false),d(e);},w=C=>{C.key==="Enter"?x():C.key==="Escape"&&(p(false),d(e));};return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsx("button",{ref:b,onClick:()=>c(!i),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"})]})}),i&&jsxRuntime.jsx(ba,{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:l?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:h,type:"text",value:u,onChange:C=>d(C.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})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),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 ls=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:u=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:b=false,className:h,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),P=react.useRef(null),O=p??ap(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>P.current,estimateSize:()=>u,enabled:O}),S=t.filter(J=>!J.metadata?.isContainer).length;if(a)return jsxRuntime.jsx("div",{ref:w,className:h,children:a(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let J=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:J}:J>=80?{state:"warning",percentage:J}:J>=60?{state:"approaching",percentage:J}:{state:"ok",percentage:J}})(),z=T.state==="exceeded",$=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",z&&"ring-2 ring-asakaa-accent-red",h),children:[n?n(e,S):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($()),children:[S,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(Fp,{columnTitle:e.title,onRename:J=>f?.(e.id,J),onDelete:v?()=>v(e.id):void 0,isDeletable:b,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:P,className:"asakaa-column-cards",style:{maxHeight:O?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(J=>J.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"})}):O?jsxRuntime.jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(J=>{let L=t[J.index];return L?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${J.start}px)`},children:jsxRuntime.jsx(Un,{card:L,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l})},L.id):null})}):t.map(J=>jsxRuntime.jsx(Un,{card:J,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l},J.id))})})]})});ls.displayName="Column";function Sc({title:e,onSave:t,className:a}){let[r,n]=react.useState(false),[s,o]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):o(e),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(o(e),n(false));};return r?jsxRuntime.jsx("input",{ref:i,type:"text",value:s,onChange:p=>o(p.target.value),onBlur:c,onKeyDown:l,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Mh(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function $p(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(u=>u===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Ph(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Fh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Lh=["\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 Op({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:u=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let b=i==="dark",[h,y]=react.useState(false),[x,w]=react.useState([]),[C,P]=react.useState(0),[O,N]=react.useState(null),[S,M]=react.useState(false),T=react.useRef(null),z=react.useRef(null),$=react.useRef(null),J=react.useRef(null),L=react.useCallback((ne,Re)=>{let ce=Mh(ne,Re);if(N(ce),ce){let Be=r.filter(Le=>Le.name.toLowerCase().includes(ce.query)||Le.email&&Le.email.toLowerCase().includes(ce.query)).slice(0,5);w(Be),y(Be.length>0),P(0);}else y(false),w([]);},[r]),Ae=ne=>{let Re=ne.target.value;if(t(Re),L(Re,ne.target.selectionStart||0),T.current){T.current.style.height="24px";let ce=T.current.scrollHeight,Be=280,Le=Math.min(ce,Be);T.current.style.height=`${Le}px`,T.current.style.overflowY=ce>Be?"auto":"hidden";}},U=()=>{T.current&&L(e,T.current.selectionStart||0);},we=react.useCallback(ne=>{if(!O||!T.current)return;let Re=e.slice(0,O.start),ce=e.slice(O.end),Be=`@${ne.name.replace(/\s+/g,"")} `,Le=Re+Be+ce;t(Le),y(false),N(null),setTimeout(()=>{if(T.current){let Pe=O.start+Be.length;T.current.selectionStart=Pe,T.current.selectionEnd=Pe,T.current.focus();}},0);},[O,e,t]),R=ne=>{if(h&&x.length>0)switch(ne.key){case "ArrowDown":ne.preventDefault(),P(Re=>Re<x.length-1?Re+1:0);break;case "ArrowUp":ne.preventDefault(),P(Re=>Re>0?Re-1:x.length-1);break;case "Enter":{ne.preventDefault();let Re=x[C];Re&&we(Re);break}case "Tab":{ne.preventDefault();let Re=x[C];Re&&we(Re);break}case "Escape":ne.preventDefault(),y(false);break}else ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),a());};react.useEffect(()=>{let ne=Re=>{z.current&&!z.current.contains(Re.target)&&T.current&&!T.current.contains(Re.target)&&y(false),J.current&&!J.current.contains(Re.target)&&M(false);};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[]);let xe=react.useCallback(ne=>{if(!T.current)return;let Re=T.current.selectionStart||e.length,ce=e.slice(0,Re)+ne+e.slice(Re);t(ce),M(false),setTimeout(()=>{if(T.current){let Be=Re+ne.length;T.current.selectionStart=Be,T.current.selectionEnd=Be,T.current.focus();}},0);},[e,t]),G=react.useCallback(ne=>{if(!m||!ne.target.files)return;let Re=Array.from(ne.target.files),ce=v*1024*1024,Be=Re.filter(Le=>Le.size>ce?(console.warn(`File ${Le.name} exceeds max size of ${v}MB`),false):true);Be.length>0&&m(Be),ne.target.value="";},[m,v]),Ve=react.useCallback(ne=>ne.type.startsWith("image/")?lucideReact.Image:ne.type.includes("pdf")||ne.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(h&&z.current){let ne=z.current.children[C];ne&&ne.scrollIntoView({block:"nearest"});}},[C,h]),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(ne=>{let Re=Ve(ne.file),ce=ne.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",b?"bg-white/10":"bg-gray-100"),children:[ce&&ne.preview?jsxRuntime.jsx("img",{src:ne.preview,alt:ne.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(Re,{className:g("w-4 h-4",b?"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",b?"text-white":"text-gray-900"),children:ne.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Fh(ne.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(ne.id),className:g("p-0.5 rounded-full transition-colors",b?"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"})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[l&&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:l.color||"#8B5CF6"},children:l.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",b?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>M(!S),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",b?"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:S&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,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",b?"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:Lh.map(ne=>jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(ne),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",b?"hover:bg-white/10":"hover:bg-gray-100"),children:ne},ne))})})})]}),u&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:$,type:"file",multiple:true,onChange:G,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:Ae,onSelect:U,onKeyDown:R,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",b?"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:a,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]":b?"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:h&&x.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((ne,Re)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>we(ne),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Re===C?b?"bg-white/10":"bg-gray-100":b?"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:ne.color||"#8B5CF6"},children:Ph(ne.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:g("text-sm font-medium truncate",b?"text-white":"text-gray-900"),children:ne.name}),ne.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",b?"text-[#6B7280]":"text-gray-500"),children:ne.email})]})]},ne.id))})})]})]})]})}function Hp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsxRuntime.jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:i.value},c):jsxRuntime.jsx("span",{children:i.value},c))})}var qi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function cs({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[i,c]=react.useState(false),[l,p]=react.useState(""),[u,d]=react.useState(false),[m,f]=react.useState(qi[10]||"#00E5CC"),[v,b]=react.useState({top:0,left:0}),h=react.useRef(null),y=react.useRef(null),x=react.useRef(null),w=react.useRef(null),C=t.filter(T=>T.name.toLowerCase().includes(l.toLowerCase())),P=t.some(T=>T.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(i&&y.current){let T=y.current.getBoundingClientRect();b({top:T.bottom+6,left:T.left});}},[i]),react.useEffect(()=>{let T=z=>{let $=z.target,J=h.current?.contains($),L=x.current?.contains($);!J&&!L&&(c(false),p(""),d(false));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),react.useEffect(()=>{i&&w.current&&w.current.focus();},[i]);let O=T=>{let z=e.some($=>$.id===T.id);a(z?e.filter($=>$.id!==T.id):[...e,T]);},N=async()=>{if(!(!r||!l.trim())){d(true);try{let T=await r(l.trim(),m);T&&(a([...e,T]),p(""),f(qi[Math.floor(Math.random()*qi.length)]||"#00E5CC"));}finally{d(false);}}},S=(T,z)=>{z.stopPropagation(),a(e.filter($=>$.id!==T));},M={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,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:i&&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:l,onChange:T=>p(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"&&l.trim()&&!P&&r&&N();}})}),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:z=>S(T.id,z),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:C.length>0?C.map(T=>{let z=e.some($=>$.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>O(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${T.color}15`:"transparent",color:n.textPrimary},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:$=>{z||($.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}),z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):l.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"})}),l.trim()&&!P&&r&&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:qi.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:N,disabled:u,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:u?.7:1},children:[u?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 "',l.trim(),'"']})]})]})}),document.body)]})}function Mc({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="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 Wp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(Mc,{tag:s,size:a},s.id)),n>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="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 Ao=[{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 zp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Wh(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 zh({className:e}){return jsxRuntime.jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function Pc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=Wh(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"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=zp(e.loggedMinutes),l=e.estimateMinutes?zp(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"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],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(zh,{className:i[t]}),jsxRuntime.jsx("span",{children:p})]})}function Gh(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Xi(e){let t=Gh(e);return t!==null?String(t):e}function Vp(e){let a=Xi(e).trim().toLowerCase();if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ji(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function jh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Kh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function qh({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 _p({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 Yh({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:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:u}){let[d,m]=react.useState(""),[f,v]=react.useState(t.estimateMinutes?Ji(t.estimateMinutes):""),[b,h]=react.useState(""),[y,x]=react.useState(false),[w,C]=react.useState(false),P=react.useRef(null);react.useEffect(()=>{P.current?.focus();},[]);let O=async()=>{let M=Vp(d);if(!(M<=0||!s)){x(true);try{await s({durationMinutes:M,note:b.trim()||void 0,source:"manual"}),m(""),h("");}finally{x(false);}}},N=async()=>{if(!o)return;let M=f.trim()?Vp(f):null;await o(M),C(false);},S=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),O()),M.key==="Escape"&&p?.();};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",u),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:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(_p,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?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:jh(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(qh,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:l,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(_p,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:i,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(Kh,{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(Yh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:P,type:"text",value:d,onChange:M=>m(M.target.value),onKeyDown:S,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:O,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:b,onChange:M=>h(M.target.value),onKeyDown:S,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:Ji(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:M=>v(M.target.value),onKeyDown:M=>{M.key==="Enter"&&N(),M.key==="Escape"&&C(false);},onBlur:N,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:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ji(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)}%`}})})]})]}),a.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:a.slice(0,3).map(M=>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:M.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Ji(M.durationMinutes)})]},M.id))})]})]})}function ey(e){let a=Xi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function ty(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function En({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[i,c]=react.useState(ty(r)),[l,p]=react.useState(""),[u,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=ey(i);await n(x&&x>0?x:null,l||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},b=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},h={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:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"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:a?"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:a?"#007FFF":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:h[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"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:i,onChange:x=>c(x.target.value),onKeyDown:b,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"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:l,onChange:x=>p(x.target.value),onKeyDown:b,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:u||!i.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:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:u?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:v,disabled:u,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function ay(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 ry(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 Ac({summary:e,showLabel:t=false,size:a="md",className:r}){let n=ay(e.health),s=ry(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),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",r),children:[jsxRuntime.jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),l&&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:[i,"%"]})]})}function ds(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function oy(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 sy(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 iy(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 ly({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"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",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",ds(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:g("text-xs mt-1",i),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",i),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:a?"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:a?"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:a?"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",i),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:i,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:ds(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:ds(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function cy({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(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",i),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?ds(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:ds(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?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[n,ds(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?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),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",sy(e.status,a),oy(e.status,a)),children:iy(e.status,t)})})]})}function Ic({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",i=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",l=o?"border-white/[0.08]":"border-gray-200",p=o?"text-white/[0.92]":"text-gray-900",u=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",u,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",u,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:g("space-y-6 p-6",i,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",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",u),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(ly,{summary:e.summary,locale:a,isDark:o}),jsxRuntime.jsx("div",{className:g("rounded-lg border overflow-hidden",c,l),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",u),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",l),children:m.map(f=>jsxRuntime.jsx(cy,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",u),children:a==="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 us(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Cy(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function tm(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Ty(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 Io({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:u,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:b,mentionableUsers:h=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:P=false,timerElapsedSeconds:O=0,onTimeLog:N,onEstimateUpdate:S,onSoldEffortUpdate:M,onTimerStart:T,onTimerStop:z,onTimerDiscard:$,blurFinancials:J=false}){let L=s==="dark",Ae={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},U=e&&"title"in e&&!("name"in e),we=e,[R,xe]=react.useState(e?tm(e,i):null),[G,Ve]=react.useState(false),[ne,Re]=react.useState(false),[ce,Be]=react.useState(false),[Le,Pe]=react.useState(null),[Oe,dt]=react.useState(new Date),[Z,ze]=react.useState(false),[Xe,$e]=react.useState(false),[St,mt]=react.useState(""),[gt,De]=react.useState(false),[ft,Ct]=react.useState(false),[_e,ut]=react.useState(false),[A,q]=react.useState(false),[Ce,I]=react.useState(""),K=react.useRef(null),ve=react.useRef(null),[Ue,pe]=react.useState(""),tt=react.useRef(null),[ht,qe]=react.useState(""),[wt,qt]=react.useState(false),[Tt,Pt]=react.useState([]),[_t,be]=react.useState(""),[Ee,Qe]=react.useState(false),at=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=tm(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),xe(D),I(D.description||""),pe(D.name||"");}},[e?.id,e?.quotedMinutes,i,t]),react.useEffect(()=>{if(!t||!Ce)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,Ce]),react.useEffect(()=>()=>{K.current&&clearTimeout(K.current),tt.current&&clearTimeout(tt.current);},[]),react.useEffect(()=>{t&&at.current&&f.length>0&&setTimeout(()=>{at.current&&(at.current.scrollTop=at.current.scrollHeight);},100);},[t,f.length]);let Nt=react.useCallback(D=>{xe(D),U&&n&&we?n(Ty(D,we)):r&&r(D);},[U,we,n,r]),Ft=react.useCallback(()=>{Ve(false),Re(false),Be(false),Pe(null),$e(false),mt(""),De(false);},[]),kt=react.useCallback((D,W)=>{if(!R)return;let de={...R,[D]:W};Nt(de);},[R,Nt]),Ia=react.useCallback(()=>{let D=ve.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),ra=react.useCallback(D=>{I(D),setTimeout(Ia,0),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{if(R){let W={...R,description:D};Nt(W);}},800);},[R,Nt,Ia]),ir=react.useCallback(D=>{pe(D),tt.current&&clearTimeout(tt.current),tt.current=setTimeout(()=>{if(R&&D.trim()){let W={...R,name:D.trim()};Nt(W);}},800);},[R,Nt]),Ye=react.useCallback(D=>{let W=D.map(de=>{let ke={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:de};return de.type.startsWith("image/")&&(ke.preview=URL.createObjectURL(de)),ke});Pt(de=>[...de,...W]);},[]),et=react.useCallback(D=>{Pt(W=>{let de=W.find(ke=>ke.id===D);return de?.preview&&URL.revokeObjectURL(de.preview),W.filter(ke=>ke.id!==D)});},[]),Ra=react.useCallback(async()=>{if(!(!R||!ht.trim()&&Tt.length===0||!v)){qt(true);try{let D=$p(ht,h),W=[];if(Tt.length>0&&y){let de=Tt.map(ke=>ke.file);W=await y(de);}await v(R.id,ht.trim(),D.length>0?D:void 0,W.length>0?W:void 0),qe(""),Tt.forEach(de=>{de.preview&&URL.revokeObjectURL(de.preview);}),Pt([]);}finally{qt(false);}}},[R,ht,Tt,v,h,y]),Ba=react.useCallback(()=>{if(!R||!_t.trim())return;let D=R.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:_t.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},de=[...D,W],ke={...R,subtasks:de};Nt(ke),be(""),Qe(false);},[R,_t,Nt]),lr=react.useCallback(D=>{if(!R?.subtasks)return;let W=R.subtasks.map(ke=>ke.id===D?{...ke,progress:ke.progress===100?0:100}:ke),de={...R,subtasks:W};Nt(de);},[R,Nt]),Na=react.useCallback(D=>{if(!R?.subtasks)return;let W=R.subtasks.filter(ke=>ke.id!==D),de={...R,subtasks:W};Nt(de);},[R,Nt]),Rr=react.useCallback(D=>{let W=typeof D=="string"?new Date(D):D,ke=new Date().getTime()-W.getTime(),st=Math.floor(ke/6e4),fe=Math.floor(ke/36e5),j=Math.floor(ke/864e5);return st<1?o==="es"?"Ahora":"Just now":st<60?o==="es"?`Hace ${st} min`:`${st}m ago`:fe<24?o==="es"?`Hace ${fe}h`:`${fe}h ago`:j<7?o==="es"?`Hace ${j}d`:`${j}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),ie=react.useCallback(D=>{if(!R)return;let W=R.progress||0;D==="completed"?W=100:D==="in-progress"&&W===0?W=10:D==="todo"&&(W=0);let de={...R,status:D,progress:W};Nt(de),Ve(false);},[R,Nt]),ge=react.useCallback((D,W)=>{if(!R)return;let de={...R,startDate:D,endDate:W};Nt(de);},[R,Nt]),bt=react.useCallback(()=>{let D=Oe.getFullYear(),W=Oe.getMonth(),de=new Date(D,W,1),st=new Date(D,W+1,0).getDate(),fe=de.getDay(),j=[],yt=new Date(D,W,0).getDate();for(let Xt=fe-1;Xt>=0;Xt--)j.push({date:new Date(D,W-1,yt-Xt),isCurrentMonth:false});for(let Xt=1;Xt<=st;Xt++)j.push({date:new Date(D,W,Xt),isCurrentMonth:true});let xt=42-j.length;for(let Xt=1;Xt<=xt;Xt++)j.push({date:new Date(D,W+1,Xt),isCurrentMonth:false});return j},[Oe]),_=react.useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),ut(false),!R||!u)return;let W=Array.from(D.dataTransfer.files);if(W.length!==0){q(true);try{await u(R.id,W);}finally{q(false);}}},[R,u]),he=react.useCallback(async D=>{if(!R||!u||!D.target.files)return;let W=Array.from(D.target.files);if(W.length!==0){q(true);try{await u(R.id,W);}finally{q(false);}D.target.value="";}},[R,u]),se=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),ut(true);},[]),B=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),ut(false);},[]),te=react.useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),Te=react.useCallback(D=>D.startsWith("image/")?lucideReact.Image:D.includes("pdf")||D.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!R?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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:R.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=R.progress===100?0:100,de={...R,progress:D,status:D===100?"completed":"todo"};Nt(de);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ue,onChange:D=>ir(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",R.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:()=>{Ft(),Ve(!G);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ve(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:()=>ie(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",R.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:()=>{Ft(),Be(!ce);},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:[R.assignees&&R.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[R.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)),R.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",R.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:ce&&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 min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(D=>{let W=R.assignees?.some(de=>de.name===D.name);return jsxRuntime.jsxs("button",{onClick:()=>{let de=R.assignees||[],ke;W?ke=de.filter(st=>st.name!==D.name):ke=[...de,D],kt("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",W&&(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}),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",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(Le?null:"start"),dt(R.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:[R.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"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick: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,W=new Date(D);W.setDate(D.getDate()+1);let de=new Date(D);de.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 st=new Date(D);st.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let fe=new Date(D);fe.setDate(D.getDate()+14);let j=new Date(D);return j.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:de,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:st,display:st.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:j,display:j.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((xt,Xt)=>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(Le==="start"){let Qt=R.endDate&&xt.date>R.endDate?xt.date:R.endDate;ge(xt.date,Qt),Pe("end");}else {let Qt=R.startDate&&xt.date<R.startDate?xt.date:R.startDate;ge(Qt,xt.date),Pe(null);}},children:[jsxRuntime.jsx("span",{children:xt.label}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:xt.display})]},Xt))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ge(void 0,void 0),Pe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Le==="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:Oe.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:()=>dt(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:()=>dt(new Date(Oe.getFullYear(),Oe.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:()=>dt(new Date(Oe.getFullYear(),Oe.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:bt().map((D,W)=>{let de=D.date.toDateString()===new Date().toDateString(),ke=R.startDate?.toDateString()===D.date.toDateString(),st=R.endDate?.toDateString()===D.date.toDateString(),fe=ke||st,j=R.startDate&&R.endDate&&D.date>=R.startDate&&D.date<=R.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let yt=new Date(D.date);if(Le==="start"){let xt=R.endDate&&yt>R.endDate?yt:R.endDate;ge(yt,xt),Pe("end");}else {let xt=R.startDate&&yt<R.startDate?yt:R.startDate;ge(xt,yt),Pe(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"),de&&"ring-2 ring-[#00E5CC]",ke&&"bg-[#00E5CC] text-white",st&&!ke&&"bg-[#7C3AED] text-white",j&&!fe&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!fe&&(L?"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",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:()=>{Ft(),Re(!ne);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden 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:()=>{kt("priority",D.id),Re(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",R.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:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.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:[Z?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:D=>{let W=parseInt(D.target.value),de=R.status;W===100?de="completed":W>0?de="in-progress":de="todo";let ke={...R,progress:W,status:de};Nt(ke);},onBlur:()=>ze(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ze(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[R.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:R.status==="completed"||R.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?us(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ct("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:us(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ct("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:ft==="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(En,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async D=>{await S?.(R.id,D),Ct(false);},onClose:()=>Ct(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:J?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"}):R.status==="completed"||R.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:R.quotedMinutes?us(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ct("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:us(R.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ct("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:ft==="quoted"&&!J&&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(En,{mode:"quoted",locale:o,isDark:L,currentValue:R.quotedMinutes||null,onSave:async D=>{M?(await M(R.id,D),xe(W=>W?{...W,quotedMinutes:D}:null)):kt("quotedMinutes",D),Ct(false);},onClose:()=>Ct(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:[R.status==="completed"||R.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"})}):P?jsxRuntime.jsxs("button",{type:"button",onClick:()=>z?.(R.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"}),Cy(O||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>T?.(R.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"})}),R.status==="completed"||R.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:()=>Ct("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:[us(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",us(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:ft==="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(En,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(D,W)=>{D&&await N?.(R.id,{durationMinutes:D,note:W,source:"manual"}),Ct(false);},onClose:()=>Ct(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(cs,{selectedTags:R.tags||[],availableTags:c,onChange:D=>{kt("tags",D);},onCreateTag:l,theme:Ae})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(D=>{let W=m.find(de=>de.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:[W?.name||D.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let de=(R.dependencies||[]).filter(ke=>ke!==D);kt("dependencies",de);},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:()=>{Ft(),$e(!Xe);},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:Xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$e(false),mt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:St,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!==R.id).filter(D=>St===""||D.name.toLowerCase().includes(St.toLowerCase())).map(D=>{let W=R.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{onClick:()=>{let de=R.dependencies||[],ke;W?ke=de.filter(st=>st!==D.id):ke=[...de,D.id],kt("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",W&&(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",W?"bg-[#00E5CC] border-[#00E5CC]":L?"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",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:()=>{Ft(),De(!gt);},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:R.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:Ao.find(D=>D.value===R.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:gt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>De(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden 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:Ao.map(D=>{let W=R.color===D.value;return jsxRuntime.jsx("button",{onClick:()=>{kt("color",D.value),De(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",L?"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",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:R.isMilestone||false,onChange:D=>kt("isMilestone",D.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.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:Ce,onChange:D=>ra(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",R.subtasks&&R.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(D=>D.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...R.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",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>lr(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:()=>Na(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))}),Ee?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:_t,onChange:D=>be(D.target.value),onKeyDown:D=>{D.key==="Enter"&&_t.trim()?Ba():D.key==="Escape"&&(Qe(false),be(""));},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:Ba,disabled:!_t.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",_t.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:()=>{Qe(false),be("");},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:()=>Qe(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",p.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(D=>{let W=Te(D.type),de=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:[de&&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(W,{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:te(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:se,onDragLeave:B,onDrop:_,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",_e?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",A&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:he,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!u||A}),A?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",_e?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:_e?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"})]})}),!u&&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:a,className:g("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
5
5
  .activity-comments-scroll::-webkit-scrollbar {
6
6
  width: 4px !important;
7
7
  }
@@ -13,10 +13,10 @@
13
13
  border-radius: 4px !important;
14
14
  }
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
- background: ${A?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
16
+ background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:Qe,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",A?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((D,W)=>{let ue=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,ke=typeof W.createdAt=="string"?new Date(W.createdAt):W.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",A?"text-white":"text-gray-900"),children:D.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Rr(D.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Hp,{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 ue=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",A?"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",A?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:g("text-xs truncate max-w-[100px]",A?"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",A?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:g("text-sm",A?"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",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Op,{value:bt,onChange:qe,onSubmit:Aa,users:h,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:ht,theme:s,locale:o,currentUser:b,enableEmoji:true,enableAttachments:!!y,pendingFiles:kt,onFilesSelect:Ye,onRemoveFile:Ze})})]})]})]})})}function Bc(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function lo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:i,isLoading:c,error:l,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:$,timeEntries:T,timerState:S,onLogTime:M,onUpdateEstimate:N,onUpdateSoldEffort:U,onStartTimer:O,onStopTimer:X,onDiscardTimer:A,blurFinancials:Se=false,sidePanel:G,renderColumnMetrics:ve,suppressDetailModal:R=false}){let[ye,V]=Bc(),[Ue,ne]=react.useState(null),[Be,ce]=react.useState(false),Ne=react.useRef(null),ze=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Le=n?.theme||"dark",$e=Le==="dark"||Le==="neutral",Ve=$e?"dark":"",oe=react.useCallback((L,J)=>{t.onCardUpdate?.(L,J);},[t]),je=react.useCallback((L,J)=>{t.onColumnUpdate?.(L,{title:J});},[t]),et=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})),Nt=react.useMemo(()=>{let L=new Map;return e.columns.forEach(J=>{let Ce=J.cardIds.map(I=>e.cards.find(K=>K.id===I)).filter(I=>I!==void 0).sort((I,K)=>I.position-K.position);L.set(J.id,Ce);}),L},[e.cards,e.columns]);react.useEffect(()=>{let L=Ne.current;if(!L)return;let J=we=>{let Ge=we.target,pe=we.button===1,rt=Ge===L||Ge.classList.contains("asakaa-column")&&!Ge.closest(".asakaa-card");(pe||we.button===0&&rt&&!ye.isDragging)&&(we.preventDefault(),ce(true),ze.current={x:we.clientX,y:we.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},Ce=we=>{if(!Be)return;let Ge=we.clientX-ze.current.x,pe=we.clientY-ze.current.y;L.scrollLeft=ze.current.scrollLeft-Ge,L.scrollTop=ze.current.scrollTop-pe;},I=()=>{Be&&(ce(false),L.style.cursor="",L.style.userSelect="");},K=()=>{Be&&(ce(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",J),document.addEventListener("mousemove",Ce),document.addEventListener("mouseup",I),L.addEventListener("mouseleave",K),()=>{L.removeEventListener("mousedown",J),document.removeEventListener("mousemove",Ce),document.removeEventListener("mouseup",I),L.removeEventListener("mouseleave",K);}},[Be,ye.isDragging]);let lt=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(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),Ee=react.useCallback(L=>{let{active:J}=L,Ce=e.cards.find(I=>I.id===J.id);Ce&&V({isDragging:true,draggedCardId:Ce.id,sourceColumnId:Ce.columnId,targetColumnId:Ce.columnId});},[e.cards,V]),ct=react.useCallback(L=>{let{active:J,over:Ce}=L;if(!Ce||!e.cards.find(we=>we.id===J.id))return;let K=null;Ce.data.current?.type==="column"?K=Ce.id:Ce.data.current?.type==="card"&&(K=e.cards.find(Ge=>Ge.id===Ce.id)?.columnId||null),K&&K!==ye.targetColumnId&&V({...ye,targetColumnId:K});},[e.cards,ye,V]),xt=react.useCallback(async L=>{let{active:J,over:Ce}=L;if(V({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Ce)return;let I=e.cards.find(pe=>pe.id===J.id);if(!I)return;let K,we;if(Ce.data.current?.type==="column"){K=Ce.id;let pe=Nt.get(K)||[];we=yc(pe,0);}else {let pe=e.cards.find(qe=>qe.id===Ce.id);if(!pe)return;K=pe.columnId;let rt=Nt.get(K)||[],bt=rt.findIndex(qe=>qe.id===Ce.id);we=yc(rt,bt);}let Ge=e.columns.find(pe=>pe.id===K);if(Ge&&Ge.wipLimit&&Ge.wipLimitType==="hard"){let pe=Nt.get(K)||[];if(I.columnId!==K&&pe.length>=Ge.wipLimit){t.onWipLimitExceeded?.(Ge,I);return}}(I.columnId!==K||I.position!==we)&&await t.onCardMove?.(I.id,K,we);},[e.cards,e.columns,Nt,t,V]),Ke=react.useCallback(L=>{R||ne(L),a?.(L),w?.(L.id);},[a,w,R]),st=react.useCallback(L=>{t.onCardUpdate?.(L.id,L),ne(L);},[t]);return c?jsxRuntime.jsx("div",{className:g("asakaa-board",Ve,o),style:i,children:jsxRuntime.jsx(By,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:g("asakaa-board",Ve,o),style:i,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 l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(mp,{themeName:Le,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",G?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ut,collisionDetection:core$1.closestCorners,onDragStart:Ee,onDragOver:ct,onDragEnd:xt,children:[jsxRuntime.jsxs("div",{ref:Ne,className:g("asakaa-board",G?"flex-1":"",Ve,o),style:{...i,cursor:Be?"grabbing":void 0},"data-theme":Le,children:[e.columns.sort((L,J)=>L.position-J.position).map(L=>{let J=Nt.get(L.id)||[],Ce=!Re.includes(L.id),I=r?.renderColumnFooter?.(L);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(ls,{column:L,cards:J,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:ve?(K,we)=>ve(K,we):void 0,onCardClick:Ke,onCardUpdate:oe,onColumnRename:t.onColumnUpdate?je:void 0,onColumnDelete:t.onColumnDelete?et:void 0,isDeletable:Ce,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(L.id)}),I]},L.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:ye.draggedCardId?jsxRuntime.jsx(Un,{card:e.cards.find(L=>L.id===ye.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),G]}),!R&&jsxRuntime.jsx(Io,{task:Ue,isOpen:!!Ue,onClose:()=>ne(null),onCardUpdate:st,theme:$e?"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:lt,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:$,timeEntries:T,isTimerRunning:S?.isRunning,timerElapsedSeconds:S?.elapsedSeconds,onTimeLog:M,onEstimateUpdate:N,onSoldEffortUpdate:U,onTimerStart:O,onTimerStop:X,onTimerDiscard:A,blurFinancials:Se})]})}function By({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Wy={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)"},zy={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)"},Gy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Vy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function jy({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let l=u=>{i.current&&!i.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),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:{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||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,u)=>l.position-u.position).map((l,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(l.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 ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.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:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function _y({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null);if(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]),!(a||r||n))return null;let p=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler: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: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:{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:i!==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:i===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 Ky({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 Oc({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:u,toolbarEndContent:p}){let d=r==="dark"?Wy:zy,m={...n==="es"?Gy:Vy,...l},f=o||i||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(_y,{theme:d,t:m,onExportCSV:o,onExportJSON:i,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsxRuntime.jsx(jy,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(Ky,{onClick:()=>t(),label:a||m.newTask}))]})})}function Uc({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=react.useState(false),[i,c]=react.useState(""),l=react.useCallback(()=>{let d=i.trim();d&&(e(d),c(""),o(false));},[i,e]),u=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(c(""),o(false));},[l]),p=react.useCallback(()=>{setTimeout(()=>{i.trim()||o(false);},150);},[i]);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:i,onChange:d=>c(d.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!i.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"})]}),r]})})}function ei({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:i="up"}){let[c,l]=react.useState(""),[u,p]=react.useState(void 0),[d,m]=react.useState(null),[f,v]=react.useState(null),[b,h]=react.useState(false),[y,x]=react.useState(false),[w,C]=react.useState(false),[P,$]=react.useState(s||new Date),T=react.useRef(null),S=n==="es",M=i==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let N=react.useCallback(()=>{h(false),x(false),C(false);},[]),U=react.useCallback(()=>{l(""),p(void 0),m(null),v(null),N(),t();},[t,N]),O=f||s||new Date,X=react.useCallback(()=>{let G=c.trim();if(!G)return;let ve=a.find(ye=>ye.id===d),R=O;e({name:G,priority:u,assignee:ve||void 0,assigneeId:d,startDate:R,endDate:R}),l(""),p(void 0),m(null),v(null),N(),T.current?.focus();},[c,u,d,O,a,e,N]),A=react.useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),X()),G.key==="Escape"&&U();},[X,U,c]),Se=O;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>N(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:c,onChange:G=>l(G.target.value),placeholder:S?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:A})}),jsxRuntime.jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",r?"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:G=>{G.stopPropagation(),h(!b),x(false),C(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":r?"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:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[{id:"urgent",label:S?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:S?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:S?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:S?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:S?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(G=>jsxRuntime.jsxs("button",{onClick:()=>{p(G.id),h(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",G.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:G.label})]},G.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),C(!w),h(false),x(false),$(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?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"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"}),Se.toLocaleDateString(S?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,ve=new Date(G);ve.setDate(G.getDate()+1);let R=new Date(G);R.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let ye=new Date(G);ye.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let V=new Date(G);V.setDate(G.getDate()+14);let Ue=new Date(G);Ue.setDate(G.getDate()+28);let ne=S?"es-ES":"en-US";return [{label:S?"Hoy":"Today",date:G,display:G.toLocaleDateString(ne,{weekday:"short"}).slice(0,3)+"."},{label:S?"Ma\xF1ana":"Tomorrow",date:ve,display:ve.toLocaleDateString(ne,{weekday:"short"}).slice(0,3)+"."},{label:S?"Este fin de semana":"This weekend",date:R,display:S?"s\xE1b.":"sat."},{label:S?"Pr\xF3xima semana":"Next week",date:ye,display:S?"lun.":"mon."},{label:S?"2 semanas":"2 weeks",date:V,display:V.toLocaleDateString(ne,{day:"numeric",month:"short"})},{label:S?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(ne,{day:"numeric",month:"short"})}].map((ce,Ne)=>jsxRuntime.jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(ce.date),C(false);},children:[jsxRuntime.jsx("span",{children:ce.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ce.display})]},Ne))})()}),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",r?"text-white":"text-gray-900"),children:P.toLocaleDateString(S?"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:()=>$(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:S?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>$(new Date(P.getFullYear(),P.getMonth()-1)),className:g("p-0.5 rounded",r?"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:()=>$(new Date(P.getFullYear(),P.getMonth()+1)),className:g("p-0.5 rounded",r?"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:(S?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(G=>jsxRuntime.jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:G},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let G=P.getFullYear(),ve=P.getMonth(),R=new Date(G,ve,1).getDay(),ye=new Date(G,ve+1,0).getDate(),V=new Date(G,ve,0).getDate(),Ue=new Date().toDateString(),ne=[];for(let ce=R-1;ce>=0;ce--)ne.push({dayNum:V-ce,isCurrent:false,date:new Date(G,ve-1,V-ce)});for(let ce=1;ce<=ye;ce++)ne.push({dayNum:ce,isCurrent:true,date:new Date(G,ve,ce)});let Be=42-ne.length;for(let ce=1;ce<=Be;ce++)ne.push({dayNum:ce,isCurrent:false,date:new Date(G,ve+1,ce)});return ne.map((ce,Ne)=>{let ze=ce.date.toDateString()===Ue,Le=(f||s)?.toDateString()===ce.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",!ce.isCurrent&&(r?"text-white/20":"text-gray-300"),ce.isCurrent&&(r?"text-white":"text-gray-900"),ze&&"ring-1 ring-[#007FFF]",Le&&"bg-[#007FFF] text-white",!Le&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(ce.date),C(false);},children:ce.dayNum},Ne)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),x(!y),h(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":r?"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:a.find(G=>G.id===d)?.color||"#007FFF"},children:a.find(G=>G.id===d)?.initials||a.find(G=>G.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:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="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",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.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",r?"hover:bg-white/5":"hover:bg-gray-50",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:S?"Sin asignar":"Unassigned"})]}),a.map(G=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{m(G.id),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",d===G.id&&(r?"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:G.color||"#007FFF"},children:G.initials||G.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:G.name})]},G.id)),a.length===0&&jsxRuntime.jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:S?"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":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:S?"Guardar":"Save"})]})]})}function jc({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:i="es"}){let[c,l]=react.useState(false),u=react.useRef(null),p=react.useRef(null),[d,m]=react.useState({}),[f,v]=react.useState(false),b=o==="dark",y={buttonLabel:n||(i==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!u.current)return;let w=90,C=()=>{let P=u.current.getBoundingClientRect(),T=window.innerHeight-P.bottom<w+8;v(T),m({position:"fixed",...T?{bottom:window.innerHeight-P.top+4}:{top:P.bottom+4},left:P.left,width:P.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),react.useEffect(()=>{if(!c)return;let w=C=>{let P=C.target;p.current&&!p.current.contains(P)&&u.current&&!u.current.contains(P)&&l(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",r),children:[jsxRuntime.jsxs("button",{onClick:()=>l(!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",b?"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(ei,{onSubmit:x,onCancel:()=>l(false),availableUsers:a,isDark:b,locale:i,dropdownDirection:"up"})})}),document.body)]})}var ai=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(lo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.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 r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function hm(e={}){return new ai(e)}var ps=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function _c(e,t){let a=r=>jsxRuntime.jsx(ps,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function qc({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:u=""}){let[p,d]=react.useState(false),[m,f]=react.useState(""),[v,b]=react.useState("home"),[h,y]=react.useState(""),[x,w]=react.useState("");react.useEffect(()=>{let T=S=>{(S.metaKey||S.ctrlKey)&&S.key===l&&(S.preventDefault(),d(M=>!M)),S.key==="Escape"&&(d(false),b("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),react.useEffect(()=>{p||(b("home"),f(""),y(""),w(""));},[p]);let C=react.useCallback(()=>{d(false);},[]),P=react.useCallback(T=>{let[S,M]=T.split(":");switch(S){case "create-card":b("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),C()):b("navigate");break;case "search":r?.(m),C();break;case "priority":b("priority");break;case "set-priority":x&&M&&(n?.(x,M),C());break;case "assign":b("assign");break;case "assign-user":x&&M&&(s?.(x,M),C());break;case "ai":b("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":b("home");break;}},[m,x,t,a,r,n,s,o,i,c,C]),$=react.useCallback(()=>{h&&m.trim()&&(t?.(h,m.trim()),C());},[h,m,t,C]);return p?jsxRuntime.jsx(ma,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:T=>T.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"&&h?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&v==="create-card"&&h&&$();}}),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:P,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:P,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:P,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:P,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},T.id))})]}),v==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),v==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let S=e.columns.find(M=>M.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:P,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},T.id)})})]}),v==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,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:P,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:P,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:P,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 vm(e,t,a,r,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:at,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,W)=>{let de=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,ke=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return de.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:Rr(D.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Hp,{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 de=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",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[de?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: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",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(Op,{value:ht,onChange:qe,onSubmit:Ra,users:h,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:wt,theme:s,locale:o,currentUser:b,enableEmoji:true,enableAttachments:!!y,pendingFiles:Tt,onFilesSelect:Ye,onRemoveFile:et})})]})]})]})})}function Bc(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function lo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:i,isLoading:c,error:l,children:p,availableTags:u=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:O,timeEntries:N,timerState:S,onLogTime:M,onUpdateEstimate:T,onUpdateSoldEffort:z,onStartTimer:$,onStopTimer:J,onDiscardTimer:L,blurFinancials:Ae=false,sidePanel:U,renderColumnMetrics:we,suppressDetailModal:R=false}){let[xe,G]=Bc(),[Ve,ne]=react.useState(null),[Re,ce]=react.useState(false),Be=react.useRef(null),Le=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Pe=n?.theme||"dark",Oe=Pe==="dark"||Pe==="neutral",dt=Oe?"dark":"",Z=react.useCallback((A,q)=>{t.onCardUpdate?.(A,q);},[t]),ze=react.useCallback((A,q)=>{t.onColumnUpdate?.(A,{title:q});},[t]),Xe=react.useCallback(A=>{t.onColumnDelete?.(A);},[t]),$e=["todo","in-progress","completed"],St=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 A=new Map;return e.columns.forEach(q=>{let Ce=q.cardIds.map(I=>e.cards.find(K=>K.id===I)).filter(I=>I!==void 0).sort((I,K)=>I.position-K.position);A.set(q.id,Ce);}),A},[e.cards,e.columns]);react.useEffect(()=>{let A=Be.current;if(!A)return;let q=ve=>{let Ue=ve.target,pe=ve.button===1,tt=Ue===A||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(pe||ve.button===0&&tt&&!xe.isDragging)&&(ve.preventDefault(),ce(true),Le.current={x:ve.clientX,y:ve.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},Ce=ve=>{if(!Re)return;let Ue=ve.clientX-Le.current.x,pe=ve.clientY-Le.current.y;A.scrollLeft=Le.current.scrollLeft-Ue,A.scrollTop=Le.current.scrollTop-pe;},I=()=>{Re&&(ce(false),A.style.cursor="",A.style.userSelect="");},K=()=>{Re&&(ce(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",q),document.addEventListener("mousemove",Ce),document.addEventListener("mouseup",I),A.addEventListener("mouseleave",K),()=>{A.removeEventListener("mousedown",q),document.removeEventListener("mousemove",Ce),document.removeEventListener("mouseup",I),A.removeEventListener("mouseleave",K);}},[Re,xe.isDragging]);let gt=react.useMemo(()=>e.cards.map(A=>({id:A.id,name:A.title,startDate:A.startDate?new Date(A.startDate):void 0,endDate:A.endDate?new Date(A.endDate):void 0,progress:A.progress||0,status:A.columnId,priority:A.priority?.toLowerCase(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),De=react.useCallback(A=>{let{active:q}=A,Ce=e.cards.find(I=>I.id===q.id);Ce&&G({isDragging:true,draggedCardId:Ce.id,sourceColumnId:Ce.columnId,targetColumnId:Ce.columnId});},[e.cards,G]),ft=react.useCallback(A=>{let{active:q,over:Ce}=A;if(!Ce||!e.cards.find(ve=>ve.id===q.id))return;let K=null;Ce.data.current?.type==="column"?K=Ce.id:Ce.data.current?.type==="card"&&(K=e.cards.find(Ue=>Ue.id===Ce.id)?.columnId||null),K&&K!==xe.targetColumnId&&G({...xe,targetColumnId:K});},[e.cards,xe,G]),Ct=react.useCallback(async A=>{let{active:q,over:Ce}=A;if(G({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Ce)return;let I=e.cards.find(pe=>pe.id===q.id);if(!I)return;let K,ve;if(Ce.data.current?.type==="column"){K=Ce.id;let pe=mt.get(K)||[];ve=yc(pe,0);}else {let pe=e.cards.find(qe=>qe.id===Ce.id);if(!pe)return;K=pe.columnId;let tt=mt.get(K)||[],ht=tt.findIndex(qe=>qe.id===Ce.id);ve=yc(tt,ht);}let Ue=e.columns.find(pe=>pe.id===K);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let pe=mt.get(K)||[];if(I.columnId!==K&&pe.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,I);return}}(I.columnId!==K||I.position!==ve)&&await t.onCardMove?.(I.id,K,ve);},[e.cards,e.columns,mt,t,G]),_e=react.useCallback(A=>{R||ne(A),a?.(A),w?.(A.id);},[a,w,R]),ut=react.useCallback(A=>{t.onCardUpdate?.(A.id,A),ne(A);},[t]);return c?jsxRuntime.jsx("div",{className:g("asakaa-board",dt,o),style:i,children:jsxRuntime.jsx(By,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:g("asakaa-board",dt,o),style:i,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 l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(mp,{themeName:Pe,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",U?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:St,collisionDetection:core$1.closestCorners,onDragStart:De,onDragOver:ft,onDragEnd:Ct,children:[jsxRuntime.jsxs("div",{ref:Be,className:g("asakaa-board",U?"flex-1":"",dt,o),style:{...i,cursor:Re?"grabbing":void 0},"data-theme":Pe,children:[e.columns.sort((A,q)=>A.position-q.position).map(A=>{let q=mt.get(A.id)||[],Ce=!$e.includes(A.id),I=r?.renderColumnFooter?.(A);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(ls,{column:A,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:we?(K,ve)=>we(K,ve):void 0,onCardClick:_e,onCardUpdate:Z,onColumnRename:t.onColumnUpdate?ze:void 0,onColumnDelete:t.onColumnDelete?Xe:void 0,isDeletable:Ce,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(A.id)}),I]},A.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:xe.draggedCardId?jsxRuntime.jsx(Un,{card:e.cards.find(A=>A.id===xe.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),U]}),!R&&jsxRuntime.jsx(Io,{task:Ve,isOpen:!!Ve,onClose:()=>ne(null),onCardUpdate:ut,theme:Oe?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:u,onCreateTag:d,attachments:Ve?m?.get(Ve.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:gt,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:O,timeEntries:N,isTimerRunning:S?.isRunning,timerElapsedSeconds:S?.elapsedSeconds,onTimeLog:M,onEstimateUpdate:T,onSoldEffortUpdate:z,onTimerStart:$,onTimerStop:J,onTimerDiscard:L,blurFinancials:Ae})]})}function By({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Wy={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)"},zy={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)"},Gy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Vy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function _y({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&o(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),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:{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||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,p)=>l.position-p.position).map((l,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function jy({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null);if(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]),!(a||r||n))return null;let u=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler: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: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:{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:u.map((m,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(m.id,m.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<u.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:i===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 Ky({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 Oc({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p,toolbarEndContent:u}){let d=r==="dark"?Wy:zy,m={...n==="es"?Gy:Vy,...l},f=o||i||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:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jy,{theme:d,t:m,onExportCSV:o,onExportJSON:i,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),u,t&&(s?jsxRuntime.jsx(_y,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(Ky,{onClick:()=>t(),label:a||m.newTask}))]})})}function Uc({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=react.useState(false),[i,c]=react.useState(""),l=react.useCallback(()=>{let d=i.trim();d&&(e(d),c(""),o(false));},[i,e]),p=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(c(""),o(false));},[l]),u=react.useCallback(()=>{setTimeout(()=>{i.trim()||o(false);},150);},[i]);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:i,onChange:d=>c(d.target.value),onKeyDown:p,onBlur:u,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!i.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"})]}),r]})})}function ei({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:i="up"}){let[c,l]=react.useState(""),[p,u]=react.useState(void 0),[d,m]=react.useState(null),[f,v]=react.useState(null),[b,h]=react.useState(false),[y,x]=react.useState(false),[w,C]=react.useState(false),[P,O]=react.useState(s||new Date),N=react.useRef(null),S=n==="es",M=i==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{N.current?.focus();},[]);let T=react.useCallback(()=>{h(false),x(false),C(false);},[]),z=react.useCallback(()=>{l(""),u(void 0),m(null),v(null),T(),t();},[t,T]),$=f||s||new Date,J=react.useCallback(()=>{let U=c.trim();if(!U)return;let we=a.find(xe=>xe.id===d),R=$;e({name:U,priority:p,assignee:we||void 0,assigneeId:d,startDate:R,endDate:R}),l(""),u(void 0),m(null),v(null),T(),N.current?.focus();},[c,p,d,$,a,e,T]),L=react.useCallback(U=>{U.key==="Enter"&&c.trim()&&(U.preventDefault(),J()),U.key==="Escape"&&z();},[J,z,c]),Ae=$;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:N,type:"text",value:c,onChange:U=>l(U.target.value),placeholder:S?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",r?"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",r?"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(),h(!b),x(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"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:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:U=>U.stopPropagation(),children:[{id:"urgent",label:S?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:S?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:S?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:S?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:S?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(U=>jsxRuntime.jsxs("button",{onClick:()=>{u(U.id),h(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===U.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",U.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:U.label})]},U.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),C(!w),h(false),x(false),O(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?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),Ae.toLocaleDateString(S?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",M,r?"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",r?"border-white/10":"border-gray-200"),children:(()=>{let U=new Date,we=new Date(U);we.setDate(U.getDate()+1);let R=new Date(U);R.setDate(U.getDate()+((6-U.getDay()+7)%7||7));let xe=new Date(U);xe.setDate(U.getDate()+((1-U.getDay()+7)%7||7));let G=new Date(U);G.setDate(U.getDate()+14);let Ve=new Date(U);Ve.setDate(U.getDate()+28);let ne=S?"es-ES":"en-US";return [{label:S?"Hoy":"Today",date:U,display:U.toLocaleDateString(ne,{weekday:"short"}).slice(0,3)+"."},{label:S?"Ma\xF1ana":"Tomorrow",date:we,display:we.toLocaleDateString(ne,{weekday:"short"}).slice(0,3)+"."},{label:S?"Este fin de semana":"This weekend",date:R,display:S?"s\xE1b.":"sat."},{label:S?"Pr\xF3xima semana":"Next week",date:xe,display:S?"lun.":"mon."},{label:S?"2 semanas":"2 weeks",date:G,display:G.toLocaleDateString(ne,{day:"numeric",month:"short"})},{label:S?"4 semanas":"4 weeks",date:Ve,display:Ve.toLocaleDateString(ne,{day:"numeric",month:"short"})}].map((ce,Be)=>jsxRuntime.jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(ce.date),C(false);},children:[jsxRuntime.jsx("span",{children:ce.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ce.display})]},Be))})()}),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",r?"text-white":"text-gray-900"),children:P.toLocaleDateString(S?"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:()=>O(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:S?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>O(new Date(P.getFullYear(),P.getMonth()-1)),className:g("p-0.5 rounded",r?"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:()=>O(new Date(P.getFullYear(),P.getMonth()+1)),className:g("p-0.5 rounded",r?"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:(S?["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",r?"text-white/30":"text-gray-400"),children:U},U))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=P.getFullYear(),we=P.getMonth(),R=new Date(U,we,1).getDay(),xe=new Date(U,we+1,0).getDate(),G=new Date(U,we,0).getDate(),Ve=new Date().toDateString(),ne=[];for(let ce=R-1;ce>=0;ce--)ne.push({dayNum:G-ce,isCurrent:false,date:new Date(U,we-1,G-ce)});for(let ce=1;ce<=xe;ce++)ne.push({dayNum:ce,isCurrent:true,date:new Date(U,we,ce)});let Re=42-ne.length;for(let ce=1;ce<=Re;ce++)ne.push({dayNum:ce,isCurrent:false,date:new Date(U,we+1,ce)});return ne.map((ce,Be)=>{let Le=ce.date.toDateString()===Ve,Pe=(f||s)?.toDateString()===ce.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",!ce.isCurrent&&(r?"text-white/20":"text-gray-300"),ce.isCurrent&&(r?"text-white":"text-gray-900"),Le&&"ring-1 ring-[#007FFF]",Pe&&"bg-[#007FFF] text-white",!Pe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(ce.date),C(false);},children:ce.dayNum},Be)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),x(!y),h(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":r?"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:a.find(U=>U.id===d)?.color||"#007FFF"},children:a.find(U=>U.id===d)?.initials||a.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:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="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",M,r?"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",r?"hover:bg-white/5":"hover:bg-gray-50",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:S?"Sin asignar":"Unassigned"})]}),a.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",r?"hover:bg-white/5":"hover:bg-gray-50",d===U.id&&(r?"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:r?"text-white":"text-gray-900",children:U.name})]},U.id)),a.length===0&&jsxRuntime.jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:S?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:J,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":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:S?"Guardar":"Save"})]})]})}function _c({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:i="es"}){let[c,l]=react.useState(false),p=react.useRef(null),u=react.useRef(null),[d,m]=react.useState({}),[f,v]=react.useState(false),b=o==="dark",y={buttonLabel:n||(i==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let w=90,C=()=>{let P=p.current.getBoundingClientRect(),N=window.innerHeight-P.bottom<w+8;v(N),m({position:"fixed",...N?{bottom:window.innerHeight-P.top+4}:{top:P.bottom+4},left:P.left,width:P.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),react.useEffect(()=>{if(!c)return;let w=C=>{let P=C.target;u.current&&!u.current.contains(P)&&p.current&&!p.current.contains(P)&&l(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:p,className:g("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>l(!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:u,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",b?"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(ei,{onSubmit:x,onCancel:()=>l(false),availableUsers:a,isDark:b,locale:i,dropdownDirection:"up"})})}),document.body)]})}var ai=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(lo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.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 r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function hm(e={}){return new ai(e)}var ps=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function jc(e,t){let a=r=>jsxRuntime.jsx(ps,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function qc({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[u,d]=react.useState(false),[m,f]=react.useState(""),[v,b]=react.useState("home"),[h,y]=react.useState(""),[x,w]=react.useState("");react.useEffect(()=>{let N=S=>{(S.metaKey||S.ctrlKey)&&S.key===l&&(S.preventDefault(),d(M=>!M)),S.key==="Escape"&&(d(false),b("home"),f(""));};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]),react.useEffect(()=>{u||(b("home"),f(""),y(""),w(""));},[u]);let C=react.useCallback(()=>{d(false);},[]),P=react.useCallback(N=>{let[S,M]=N.split(":");switch(S){case "create-card":b("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),C()):b("navigate");break;case "search":r?.(m),C();break;case "priority":b("priority");break;case "set-priority":x&&M&&(n?.(x,M),C());break;case "assign":b("assign");break;case "assign-user":x&&M&&(s?.(x,M),C());break;case "ai":b("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":b("home");break;}},[m,x,t,a,r,n,s,o,i,c,C]),O=react.useCallback(()=>{h&&m.trim()&&(t?.(h,m.trim()),C());},[h,m,t,C]);return u?jsxRuntime.jsx(ba,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:N=>N.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"&&h?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:N=>{N.key==="Enter"&&v==="create-card"&&h&&O();}}),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:P,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:P,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:P,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:P,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(N=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${N.id}`,onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:N.priority==="URGENT"?"#EF4444":N.priority==="HIGH"?"#F59E0B":N.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:N.title}),N.labels&&N.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:N.labels.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},N.id))})]}),v==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,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(N=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${N.id}`,onSelect:P,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:N.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[N.cardIds.length," cards"]})]},N.id))})]}),v==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,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(N=>{let S=e.columns.find(M=>M.id===N.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${N.id}`,onSelect:P,className:"command-palette-item",keywords:[N.title,N.description||"",...N.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:N.priority==="URGENT"?"#EF4444":N.priority==="HIGH"?"#F59E0B":N.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:N.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),N.labels&&N.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:N.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},N.id)})})]}),v==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,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:P,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:P,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:P,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 vm(e,t,a,r,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;
@@ -30,7 +30,7 @@
30
30
  max-height: 92vh !important;
31
31
  object-fit: contain !important;
32
32
  cursor: default !important;
33
- `,i.onclick=p=>p.stopPropagation();let c=document.createElement("div");c.className="attachment-lightbox-hint",c.textContent="Click anywhere or press ESC to close",c.style.cssText=`
33
+ `,i.onclick=u=>u.stopPropagation();let c=document.createElement("div");c.className="attachment-lightbox-hint",c.textContent="Click anywhere or press ESC to close",c.style.cssText=`
34
34
  position: absolute !important;
35
35
  bottom: 24px !important;
36
36
  left: 50% !important;
@@ -38,7 +38,7 @@
38
38
  font-size: 12px !important;
39
39
  color: rgba(255, 255, 255, 0.4) !important;
40
40
  pointer-events: none !important;
41
- `;let l=()=>{o.remove(),document.removeEventListener("keydown",u);},u=p=>{if(p.key==="Escape")l();else if(p.key==="ArrowLeft"&&a.length>1){let d=r>0?r-1:a.length-1;l(),n(d);}else if(p.key==="ArrowRight"&&a.length>1){let d=r<a.length-1?r+1:0;l(),n(d);}};if(o.onclick=l,document.addEventListener("keydown",u),a.length>1){let p=document.createElement("div");p.className="attachment-lightbox-dots",p.style.cssText=`
41
+ `;let l=()=>{o.remove(),document.removeEventListener("keydown",p);},p=u=>{if(u.key==="Escape")l();else if(u.key==="ArrowLeft"&&a.length>1){let d=r>0?r-1:a.length-1;l(),n(d);}else if(u.key==="ArrowRight"&&a.length>1){let d=r<a.length-1?r+1:0;l(),n(d);}};if(o.onclick=l,document.addEventListener("keydown",p),a.length>1){let u=document.createElement("div");u.className="attachment-lightbox-dots",u.style.cssText=`
42
42
  position: absolute !important;
43
43
  bottom: 48px !important;
44
44
  left: 50% !important;
@@ -48,7 +48,7 @@
48
48
  padding: 8px 12px !important;
49
49
  background: rgba(0, 0, 0, 0.4) !important;
50
50
  border-radius: 20px !important;
51
- `,p.onclick=f=>f.stopPropagation(),a.forEach((f,v)=>{let b=document.createElement("button");b.className=`attachment-lightbox-dot ${v===r?"active":""}`,b.style.cssText=`
51
+ `,u.onclick=f=>f.stopPropagation(),a.forEach((f,v)=>{let b=document.createElement("button");b.className=`attachment-lightbox-dot ${v===r?"active":""}`,b.style.cssText=`
52
52
  width: 8px !important;
53
53
  height: 8px !important;
54
54
  border-radius: 50% !important;
@@ -56,7 +56,7 @@
56
56
  border: none !important;
57
57
  padding: 0 !important;
58
58
  cursor: pointer !important;
59
- `,b.onclick=h=>{h.stopPropagation(),l(),n(v);},p.appendChild(b);});let d=document.createElement("button");d.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",d.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',d.style.cssText=`
59
+ `,b.onclick=h=>{h.stopPropagation(),l(),n(v);},u.appendChild(b);});let d=document.createElement("button");d.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",d.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',d.style.cssText=`
60
60
  position: absolute !important;
61
61
  left: 0 !important;
62
62
  top: 0 !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=r<a.length-1?r+1:0;l(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(i),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function lx(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function cx(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 Xc(e){return e.startsWith("image/")}function ms({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,i]=react.useState(false),[c,l]=react.useState(false),[u,p]=react.useState(null),d=react.useRef(null),m=react.useRef(e);m.current=e;let f=react.useCallback((T,S)=>{S.preventDefault(),S.stopPropagation();let M=m.current.filter(O=>Xc(O.type)),N=M.findIndex(O=>O.id===T.id),U=O=>{let X=m.current.filter(Se=>Xc(Se.type)),A=X[O];A&&vm(A.url,A.name,X,O,U);};vm(T.url,T.name,M,N,U);},[]),v=react.useCallback(T=>{let S=[],M=[];return e.length+T.length>s?(M.push(`Maximum ${s} files allowed`),{valid:S,errors:M}):(T.forEach(N=>{if(N.size/1048576>r){M.push(`${N.name} is too large (max ${r}MB)`);return}if(n&&!n.some(O=>N.type.match(O))){M.push(`${N.name} has invalid file type`);return}S.push(N);}),{valid:S,errors:M})},[e.length,s,r,n]),b=react.useCallback(async T=>{let{valid:S,errors:M}=v(T);if(M.length>0){p(M.join(", ")),setTimeout(()=>p(null),5e3);return}if(S.length!==0){l(true),p(null);try{await t?.(S);}catch(N){p(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{l(false);}}},[v,t]),h=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(true);},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);},[]),x=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);let S=Array.from(T.dataTransfer.files);b(S);},[b]),C=react.useCallback(T=>{let S=T.target.files?Array.from(T.target.files):[];b(S),d.current&&(d.current.value="");},[b]),P=react.useCallback(()=>{d.current?.click();},[]),$=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:h,onDragLeave:y,onDragOver:x,onDrop:w,onClick:P,children:[jsxRuntime.jsx("input",{ref:d,type:"file",multiple:true,onChange:C,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 ",r,"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(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Xc(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>f(T,S),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:cx(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:lx(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>$(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function hx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Qc({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hx,{})}),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}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,i)=>o+i.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,i)=>o+i.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,i)=>o+(i.planned||0),0)})]})]})]})}function Dx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Zc({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,l=o<=i;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(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(Dx,{})}),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:l?"#10B981":"#EF4444",fill:l?"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:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#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:l?"#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:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Rx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Em=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Bx({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,i=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Mm({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function ed({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,l)=>c+l.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Rx[c.name]||Em[e.indexOf(c)%Em.length]})),i=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:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?Bx:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Mm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let u=l.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(Mm,{})}),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,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))})]})}),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,l)=>l.value>c.value?l:c).name})]})]})]})}var cl=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,i]=react.useState(false),[c,l]=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=>{r.onBulkUpdate?.(f,{priority:w}),i(false);},b=w=>{r.onBulkMove?.(f,w),l(false),a();},h=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let C=new Set;e.forEach($=>{$.labels?.forEach(T=>C.add(T));});let P=Array.from(new Set([...C,...w]));r.onBulkUpdate?.(f,{labels:P}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!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:()=>l(!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:()=>b(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:()=>h([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:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});cl.displayName="BulkOperationsToolbar";function Wx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,i,c,l;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,i=f?.name||`User ${m}`,c=f?.color,l=f?.avatar,r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.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];i=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:i,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,i=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",i="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function td({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:i,config:c,onCardClick:l,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}),b=react.useMemo(()=>s||Wx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),h={callbacks:r,availableUsers:a,renderProps:i,config:c,onCardClick:l,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=react.useCallback(x=>{v(w=>{let C=new Set(w);return C.has(x)?C.delete(x):C.add(x),C});},[]);return !s&&(t.groupBy==="none"||b.length===0)?jsxRuntime.jsx(lo,{board:e,className:n,...h}):jsxRuntime.jsxs("div",{className:g("asakaa-swimlane-view",n),children:[b.map(x=>{let w=f.has(x.id),C=e.cards.filter($=>x.cardIds.includes($.id)),P={...e,cards:C};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(lo,{board:P,...h})})]},x.id)}),b.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 ad=[{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 rd({value:e,onChange:t,className:a}){let[r,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),i=ad.find(l=>l.value===e)||ad[0];react.useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),n(false);};return jsxRuntime.jsxs("div",{className:g("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:i.icon}),jsxRuntime.jsx("span",{children:i.label}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:ad.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.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:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ni=[{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 Vx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,i=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&i&&c}function Im(e={}){let{shortcuts:t=ni,enabled:a=true,preventDefault:r=true}=e,n=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=react.useCallback(c=>{n.current=[...n.current,c];},[]),i=react.useCallback(c=>{n.current=n.current.filter(l=>l.action!==c);},[]);return react.useEffect(()=>{function c(l){if(!s.current)return;let u=l.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let p of n.current)if(Vx(l,p)){r&&l.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)},[r]),{registerShortcut:o,unregisterShortcut:i,isEnabled:a}}function _x(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Kx(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function qx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Kx(e),r=t?_x(t):"";return a?`${a} + ${r}`:r}function Yx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function nd({shortcuts:e=ni,isOpen:t,onClose:a,className:r}){let[n,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!n||!t)return null;let o=Yx(e);return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),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:a,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(([i,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"}),i]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(l=>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:l.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:qx(l)})]},l.action))})]},i))})}),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 od=[{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=r<a.length-1?r+1:0;l(),n(v);},o.appendChild(u),o.appendChild(d),o.appendChild(m);}o.appendChild(i),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function lx(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function cx(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 Xc(e){return e.startsWith("image/")}function ms({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,i]=react.useState(false),[c,l]=react.useState(false),[p,u]=react.useState(null),d=react.useRef(null),m=react.useRef(e);m.current=e;let f=react.useCallback((N,S)=>{S.preventDefault(),S.stopPropagation();let M=m.current.filter($=>Xc($.type)),T=M.findIndex($=>$.id===N.id),z=$=>{let J=m.current.filter(Ae=>Xc(Ae.type)),L=J[$];L&&vm(L.url,L.name,J,$,z);};vm(N.url,N.name,M,T,z);},[]),v=react.useCallback(N=>{let S=[],M=[];return e.length+N.length>s?(M.push(`Maximum ${s} files allowed`),{valid:S,errors:M}):(N.forEach(T=>{if(T.size/1048576>r){M.push(`${T.name} is too large (max ${r}MB)`);return}if(n&&!n.some($=>T.type.match($))){M.push(`${T.name} has invalid file type`);return}S.push(T);}),{valid:S,errors:M})},[e.length,s,r,n]),b=react.useCallback(async N=>{let{valid:S,errors:M}=v(N);if(M.length>0){u(M.join(", ")),setTimeout(()=>u(null),5e3);return}if(S.length!==0){l(true),u(null);try{await t?.(S);}catch(T){u(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>u(null),5e3);}finally{l(false);}}},[v,t]),h=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),i(true);},[]),y=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),i(false);},[]),x=react.useCallback(N=>{N.preventDefault(),N.stopPropagation();},[]),w=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),i(false);let S=Array.from(N.dataTransfer.files);b(S);},[b]),C=react.useCallback(N=>{let S=N.target.files?Array.from(N.target.files):[];b(S),d.current&&(d.current.value="");},[b]),P=react.useCallback(()=>{d.current?.click();},[]),O=react.useCallback(N=>{confirm("Are you sure you want to delete this attachment?")&&a?.(N);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:h,onDragLeave:y,onDragOver:x,onDrop:w,onClick:P,children:[jsxRuntime.jsx("input",{ref:d,type:"file",multiple:true,onChange:C,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 ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(N=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Xc(N.type)&&N.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>f(N,S),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:N.thumbnailUrl||N.url,alt:N.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:cx(N.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:N.name,children:N.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:lx(N.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(N.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>O(N.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"})})})]},N.id))})]})}function hx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Qc({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hx,{})}),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}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,i)=>o+i.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,i)=>o+i.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,i)=>o+(i.planned||0),0)})]})]})]})}function Dx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Zc({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,l=o<=i;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(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(Dx,{})}),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:l?"#10B981":"#EF4444",fill:l?"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:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#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:l?"#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:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Rx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Em=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Bx({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,i=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Mm({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function ed({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,l)=>c+l.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Rx[c.name]||Em[e.indexOf(c)%Em.length]})),i=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:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?Bx:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Mm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,u=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${u}%)`}})]}):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(Mm,{})}),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,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))})]})}),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,l)=>l.value>c.value?l:c).name})]})]})]})}var cl=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,i]=react.useState(false),[c,l]=react.useState(false),[p,u]=react.useState(false),[d,m]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{r.onBulkUpdate?.(f,{priority:w}),i(false);},b=w=>{r.onBulkMove?.(f,w),l(false),a();},h=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),u(false);},y=w=>{let C=new Set;e.forEach(O=>{O.labels?.forEach(N=>C.add(N));});let P=Array.from(new Set([...C,...w]));r.onBulkUpdate?.(f,{labels:P}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!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:()=>l(!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:()=>b(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:()=>u(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([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:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});cl.displayName="BulkOperationsToolbar";function Wx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,i,c,l;switch(t){case "assignee":let p=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);p.length>0?p.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,i=f?.name||`User ${m}`,c=f?.color,l=f?.avatar,r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.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];i=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:i,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,i=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",i="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function td({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:i,config:c,onCardClick:l,suppressDetailModal:p,availableTags:u,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}),b=react.useMemo(()=>s||Wx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),h={callbacks:r,availableUsers:a,renderProps:i,config:c,onCardClick:l,suppressDetailModal:p,availableTags:u,attachmentsByCard:d,renderColumnMetrics:m},y=react.useCallback(x=>{v(w=>{let C=new Set(w);return C.has(x)?C.delete(x):C.add(x),C});},[]);return !s&&(t.groupBy==="none"||b.length===0)?jsxRuntime.jsx(lo,{board:e,className:n,...h}):jsxRuntime.jsxs("div",{className:g("asakaa-swimlane-view",n),children:[b.map(x=>{let w=f.has(x.id),C=e.cards.filter(O=>x.cardIds.includes(O.id)),P={...e,cards:C};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(lo,{board:P,...h})})]},x.id)}),b.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 ad=[{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 rd({value:e,onChange:t,className:a}){let[r,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),i=ad.find(l=>l.value===e)||ad[0];react.useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),n(false);};return jsxRuntime.jsxs("div",{className:g("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:i.icon}),jsxRuntime.jsx("span",{children:i.label}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:ad.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.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:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ni=[{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 Vx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,i=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&i&&c}function Im(e={}){let{shortcuts:t=ni,enabled:a=true,preventDefault:r=true}=e,n=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=react.useCallback(c=>{n.current=[...n.current,c];},[]),i=react.useCallback(c=>{n.current=n.current.filter(l=>l.action!==c);},[]);return react.useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let u of n.current)if(Vx(l,u)){r&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:u.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:o,unregisterShortcut:i,isEnabled:a}}function jx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Kx(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function qx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Kx(e),r=t?jx(t):"";return a?`${a} + ${r}`:r}function Yx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function nd({shortcuts:e=ni,isOpen:t,onClose:a,className:r}){let[n,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!n||!t)return null;let o=Yx(e);return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),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:a,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(([i,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"}),i]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(l=>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:l.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:qx(l)})]},l.action))})]},i))})}),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 od=[{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 sd({templates:e,onSelectTemplate:t,className:a}){let[r,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),n(false);},c=e.reduce((l,u)=>{let p=u.category||"Other";return l[p]||(l[p]=[]),l[p].push(u),l},{});return jsxRuntime.jsxs("div",{className:g("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,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:l})}),jsxRuntime.jsx("div",{children:u.map(p=>jsxRuntime.jsxs("button",{onClick:()=>i(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))})]},l)),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 ld({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,i]=react.useState("export"),[c,l]=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,b=await sp(e,c,v);ip(b,c);},f=async v=>{let b=v.target.files?.[0];if(b){try{let h=await dp(b),y=b.name.endsWith(".json")?"json":"csv",x=cp(h,y);p(x),x.success&&r&&r(x,h);}catch(h){p({success:false,errors:[`Failed to read file: ${h instanceof Error?h.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:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>i("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:()=>i("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:()=>l(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,b)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},b))})]})]})]})]})]})}var ev=["URGENT","HIGH","MEDIUM","LOW"],tv=[{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"}],av=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function cd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,b]=react.useState(true),h=react.useCallback(P=>{a({search:P.target.value});},[a]),y=react.useCallback(P=>{a({dateFilter:P.target.value});},[a]),x=react.useCallback(P=>{r({by:P.target.value});},[r]),w=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>b(!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:P=>{P.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:P=>{P.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"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!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"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange: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:P=>{let $=P.target.value;a({priorities:$==="all"?[]:[$]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ev.map(P=>jsxRuntime.jsx("option",{value:P,children:P},P))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:P=>{let $=P.target.value;a({assignees:$==="all"?[]:[$]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:P=>{let $=P.target.value;a({labels:$==="all"?[]:[$]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(P=>jsxRuntime.jsx("option",{value:P,children:P},P))]})}),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:tv.map(P=>jsxRuntime.jsx("option",{value:P.value,children:P.label},P.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:P=>f(P.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:av.map(P=>jsxRuntime.jsx("option",{value:P.value,children:P.label},P.value))})}),C&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function dd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return l&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[l]);let d=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:g("relative",r),ref:p,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!l),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":l,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"})]}),l&&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 i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 ud={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"}},pd={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"}},md={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"}},Bo={dark:ud,light:pd,neutral:md},ul="dark";var pl=react.createContext(void 0),pv="asakaa-theme";function $m({children:e,defaultTheme:t=ul,storageKey:a=pv}){let[r,n]=react.useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=react.useCallback(i=>{n(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Bo[r];Object.entries(c.colors).forEach(([u,p])=>{p&&i.style.setProperty(`--theme-${mv(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&&i.style.setProperty(p,d);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:Bo};return jsxRuntime.jsx(pl.Provider,{value:o,children:e})}function bs(){let e=react.useContext(pl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function mv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function gd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=bs();return e?jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Bo).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",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children: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"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var dt={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 Om(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var ml={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Hm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},fd={en:ml,es:Hm};function Um(e){return fd[e]||fd.en}function bd(e,t){let a=Um(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ys=react.createContext(ml);function Xr(){return react.useContext(ys)}function ii(e,t,a="left",r=208){let[n,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),i=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),n}function qm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[i,c]=react.useState(false),[l,u]=react.useState(null),p=react.useRef(null),d=react.useRef(null),m=Xr(),f=ii(p,i,"right",176);if(react.useEffect(()=>{if(!i)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)},[i]),!(t||a||r||n||s||o))return null;let b=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler: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),h=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(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#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:i?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&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:b.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>h(y.id,y.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<b.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:l===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 hd({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,i]=react.useState(false),[c,l]=react.useState(null),[u,p]=react.useState(false),d=react.useRef(null),m=react.useRef(null),f=Xr(),v=ii(d,o,"right",224),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",h=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!o)return;let C=P=>{let $=P.target;d.current&&!d.current.contains($)&&m.current&&!m.current.contains($)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[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:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),x=async(C,P)=>{if(P){l(C);try{await P();}catch($){console.error(`Export ${C} failed:`,$);}finally{l(null),i(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>i(!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:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((C,P)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:P*.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===C.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"})}):C.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"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:b?"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 Rv({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(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?r.textPrimary:r.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:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Bv({options:e,value:t,onChange:a,theme:r}){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:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children: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:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function yd({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=react.useState(false),o=react.useRef(null),i=react.useRef(null),c=Xr(),l=ii(o,n,"left");react.useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&i.current&&!i.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(r,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:i,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:l.top,left:l.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:()=>{a(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 xd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=react.useState(false),i=react.useRef(null),c=react.useRef(null),l=Xr(),u=ii(i,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=h=>{let y=h.target;i.current&&!i.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},b=h=>{h.key==="Escape"&&o(false);};document.addEventListener("mousedown",v),document.addEventListener("keydown",b),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",b);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:l.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:l.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,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:i,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:l.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:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(f=>{let v=t===f.value&&!r,b=()=>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:()=>{a(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:b()}),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(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?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:r?"#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:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function zm({value:e,onChange:t,theme:a}){let r=Xr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let i=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:i?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function $v({theme:e,forecast:t}){let a=Xr(),r=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,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,u=l!=null?l>=75?"#22C55E":l>=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,b=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,h=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#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||(r?"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:a.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:[a.toolbar.expectedFinish,": ",n]}),o&&i&&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:i})]})]}),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:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"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:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&b&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:h.bg,color:h.text,fontFamily:"'JetBrains Mono', monospace"},children:b})]})]})]})}function Gm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=react.useState(false),f=react.useRef(null),v=react.useRef(null),b=Xr(),h=ii(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!d)return;let P=$=>{let T=$.target;f.current&&!f.current.contains(T)&&v.current&&!v.current.contains(T)&&m(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[d]);let x=b.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,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:r,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:i,onChange:c}],C=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.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:b.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:h.top,left:h.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:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:w.map((P,$)=>{let T=P.icon,S=P.disabled,M=P.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!S&&P.onChange?.(!P.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:S?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:S?"not-allowed":"pointer"},whileHover:S?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:$*.03},title:M,children:[jsxRuntime.jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:S?y?"rgba(255,255,255,0.2)":"#D1D5DB":P.active?e.accent||"#00E5CC":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:P.label}),P.active&&!S&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.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:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((P,$)=>{let T=l===P.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(P.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+$)*.03},children:[jsxRuntime.jsx("span",{style:{color:T?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:P.label}),T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.value)})]})]})}),document.body)]})}function Ov({theme:e,etiqueta:t,children:a}){let[r,n]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},i=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i);}},[r]),jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,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"}),r&&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:a})]})}function gl({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:h,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:P="execution",onViewModeChange:$,projectForecast:T,hideForecastHud:S,onExportPNG:M,onExportPDF:N,onExportExcel:U,onExportCSV:O,onExportJSON:X,onExportMSProject:A,showCriticalPath:Se=true,onShowCriticalPathChange:G,showDependencies:ve=true,onShowDependenciesChange:R,highlightWeekends:ye=true,onHighlightWeekendsChange:V,showBaseline:Ue=false,onShowBaselineChange:ne,onCopySnapshotLink:Be,hasDependencies:ce=true}){let Ne=Xr(),ze=M||N||U||O||X||A,Le=!!t.glassToolbar,$e=[{value:"day",label:Ne.toolbar.day},{value:"week",label:Ne.toolbar.week},{value:"month",label:Ne.toolbar.month}],Ve=[{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"})}],oe=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(zm,{value:a,onChange:r,theme:t}),v&&jsxRuntime.jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y,jsxRuntime.jsx(Gm,{theme:t,showCriticalPath:Se,onShowCriticalPathChange:G,showBaseline:Ue,onShowBaselineChange:ne,highlightWeekends:ye,onHighlightWeekendsChange:V,showDependencies:ve,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:ce}),jsxRuntime.jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:U,onExportMSProject:A,onCopySnapshotLink:Be}),($||w)&&jsxRuntime.jsxs(Ov,{theme:t,etiqueta:Ne.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[$&&jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(je=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>$(je),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:P===je?oe?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[je==="execution"?Ne.toolbar.viewExecution:Ne.toolbar.viewOracle,P===je&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"})]},je))}),w&&jsxRuntime.jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsxRuntime.jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C})})]})]});if(Le){let je=oe?"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:$&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:oe?"#000000":t.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":t.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>$("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="execution"?oe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:P==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="execution"?{color:t.textSecondary}:{},children:Ne.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>$("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="oracle"?oe?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:P==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="oracle"?{color:t.textSecondary}:{},children:Ne.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(zm,{value:a,onChange:r,theme:t}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),w&&jsxRuntime.jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsxRuntime.jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),y]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),jsxRuntime.jsx(Gm,{theme:t,showCriticalPath:Se,onShowCriticalPathChange:G,showBaseline:Ue,onShowBaselineChange:ne,highlightWeekends:ye,onHighlightWeekendsChange:V,showDependencies:ve,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:ce}),jsxRuntime.jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:U,onExportMSProject:A,onCopySnapshotLink:Be}),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 ${oe?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${oe?"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||Ne.toolbar.createTask})]})]})]}),T&&!S&&jsxRuntime.jsx($v,{theme:t,forecast:T})]})}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(Bv,{options:$e,value:a,onChange:je=>r(je),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(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxRuntime.jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h})]})]}),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||Ne.toolbar.createTask})]}),(ze||u)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsxRuntime.jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:U,onExportMSProject:A,onCopySnapshotLink:Be}),u&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsxRuntime.jsx(Rv,{options:Ve,value:o,onChange:je=>i(je),theme:t})]})]})}function fl({columns:e,onToggleColumn:t,theme:a}){let[r,n]=react.useState(false),[s,o]=react.useState({x:0,y:0}),i=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=p=>{i.current&&!i.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let l=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(ma,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.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:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=a.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:a.accent}})]},u.id))]})})})})]})}function xs({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=react.useRef(null),[i,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,p=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,b=a;t+u+d>m&&(v=t-u,v<d&&(v=d)),a+p+d>f&&(b=f-p-d,b<d&&(b=d)),c({x:v,y:b});},[e,t,a,r.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 l=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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(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 ca={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 tg({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,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=[],C=P=>{for(let $ of P)w.push($),$.subtasks&&$.subtasks.length>0&&$.isExpanded&&C($.subtasks);};return C(x),w},[]),b=react.useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),h=react.useCallback((x,w)=>{let C=v(e);if(C.length===0)return;let P=b();if(!P){a(C[0].id,false);return}let $=C.findIndex(M=>M.id===P.id);if($===-1)return;let T=x==="up"?$-1:$+1;if(T<0||T>=C.length)return;let S=C[T];a(S.id,w);},[e,b,v,a]),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 $=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,T=Array.from(t),S=b();if(x.key==="ArrowUp"){x.preventDefault(),h("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),h("down",x.shiftKey);return}if(S&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!S.isExpanded||x.key==="ArrowLeft"&&S.isExpanded)&&u(S.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){T.length>0&&(x.preventDefault(),o(T,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){T.length>0&&(x.preventDefault(),i(T));return}if(x.key==="Tab"&&x.shiftKey){T.length>0&&(x.preventDefault(),c(T));return}if(x.key==="Enter"&&!x.shiftKey&&!$){S&&(x.preventDefault(),r(S.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!$){S&&(x.preventDefault(),r(S.id,"above"));return}if(x.key==="Enter"&&$){S&&(x.preventDefault(),p(S.id));return}if(x.key==="F2"){S&&(x.preventDefault(),l(S.id));return}if(x.key==="Delete"||x.key==="Backspace"&&$){T.length>0&&(x.preventDefault(),n(T));return}if(x.key==="d"&&$&&!x.shiftKey){T.length>0&&(x.preventDefault(),s(T));return}},[d,t,b,h,r,n,s,o,i,c,l,u,p]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function rg(e){let[t,a]=react.useState(new Set),[r,n]=react.useState(null);react.useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=react.useCallback(d=>{a(new Set([d])),n(d);},[]),o=react.useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),i=react.useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let b=Math.min(f,v),h=Math.max(f,v),y=m.slice(b,h+1);a(new Set(y)),n(d);},[r,s]),c=react.useCallback((d,m,f,v)=>{v?i(d,m):f?o(d):s(d);},[s,o,i]),l=react.useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=react.useCallback(()=>{a(new Set),n(null);},[]),p=react.useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:u,isTaskSelected:p}}function Td(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Td(t.subtasks):t.subtasks}))}function Uo(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<o.length;i++){let c={...o[i],parentId:n,level:s,position:o[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function vs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=vs(a.subtasks,t);if(r)return r}}return null}function Cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Cd(a.subtasks,t);if(r)return r}return null}function Nd(e,t){if(t.length===0)return e;let a=Uo(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(b=>{if(m.has(b.id))return f.push(b),false;if(b.subtasks){let h=o(b.subtasks,m);b.subtasks=h.tasks,f.push(...h.removed);}return true}),removed:f}},i=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:i(v.subtasks,m,f)}:v),c=new Set(t),{tasks:l,removed:u}=o(e,c),p=i(l,s.id,u);return Td(p)}function Dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Cd(a,r);if(!n)continue;let s=Cd(a,n.id),o=(l,u,p)=>{for(let d=0;d<l.length;d++){let m=l[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},i=(l,u,p)=>{let d=l.findIndex(m=>m.id===u);if(d!==-1)return l.splice(d+1,0,p),l;for(let m of l)m.subtasks&&i(m.subtasks,u,p);return l},c=o(a,n.id,r);c&&(s&&s.subtasks?i(s.subtasks,n.id,c):i(a,n.id,c));}return Td(a)}function Sd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,i,c)=>{let l=o.findIndex(p=>p.id===i);if(l===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,i,c))return true;return false}let u=c==="up"?l-1:l+1;return u<0||u>=o.length?false:([o[l],o[u]]=[o[u],o[l]],o[l]={...o[l],position:l},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function Ed(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ci(e,t){let a=[...e],r=[];for(let n of t){let s=(c,l)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:l,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let l=c.findIndex(m=>m.id===n);if(l===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[l],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(l+1,0,d),d},i=o(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function ng(e,t,a){let r=[...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"},i=c=>{let l=c.findIndex(p=>p.id===t);if(l===-1){for(let p of c)if(p.subtasks&&i(p.subtasks))return true;return false}let u=a==="above"?l:l+1;return c.splice(u,0,o),true};return i(r),{tasks:r,newTask:o}}function Md(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Md(r.subtasks,t,a)}:r)}function Pd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Pd(a.subtasks,t)}:a)}function Fd(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,i=r?.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},l=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(i),color:r?.color||"#00E5CC",position:l,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 og(e,t,a,r){if(t===a)return e;let n=vs(e,t);if(!n)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===l||i(u,l))return true;return false};if(i(n,a))return e}let s=i=>{let c=i.filter(u=>u.id!==t),l=c.length<i.length;return c.map((u,p)=>{let d=l?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let i=r!==void 0?r:o.length;o.splice(i,0,{...n,parentId:void 0}),o=o.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let u=l.subtasks||[],p=r!==void 0?r:u.length,d=[...u];d.splice(p,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...l,subtasks:m,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});o=i(o);}return o}function Jr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Jr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function hl({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:i,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:b,onTaskIndent:h,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:P,onTaskRename:$,onCreateSubtask:T,onOpenTaskModal:S,onDeleteRequest:M,onTaskReparent:N,allTasks:U,scrollContainerRef:O,showCriticalPath:X=false}){let A=react.useContext(ys),[Se,G]=react.useState(null),[ve,R]=react.useState(null),[ye,V]=react.useState(""),Ue=react.useRef(null),[ne,Be]=react.useState(null),[ce,Ne]=react.useState(0),[ze,Le]=react.useState(0),[$e,Ve]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[oe,je]=react.useState(null),[et,Re]=react.useState(null),[ut,Nt]=react.useState(null),lt=react.useRef(0),Ee=5,ct=react.useRef(false),[xt,Ke]=react.useState(null),[st,L]=react.useState(false),J=react.useRef(null),[Ce,I]=react.useState(null),[K,we]=react.useState(null),[Ge,pe]=react.useState(false),rt=react.useRef(null);react.useEffect(()=>{function ie(fe){rt.current&&!rt.current.contains(fe.target)&&pe(false);}if(Ge)return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[Ge]),react.useEffect(()=>{ve&&Ue.current&&(Ue.current.focus(),Ue.current.select());},[ve]),react.useEffect(()=>{if(!ne)return;let ie=pt=>{let j=pt.clientX-ce,he=ze+j;f?.(ne,he);},fe=()=>{Be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ce,ze,f]);let{selectedTaskIds:bt,handleTaskClick:qe,isTaskSelected:ht}=rg(i),{setIsEditing:Yt}=tg({tasks:e,selectedTaskIds:bt,onTaskSelect:(ie,fe)=>{let j=Uo(e).map(he=>he.id);qe(ie,j,fe||false,false),o?.(ie);},onTaskCreate:P||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ie=>{let fe=Uo(e).find(pt=>pt.id===ie);fe&&xa(fe);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:ie=>{let fe=Uo(e).find(pt=>pt.id===ie);fe&&S&&S(fe);},enableKeyboard:true}),kt=(ie,fe=0,pt="")=>{let j=[],he=[...ie].sort((re,B)=>(re.position??0)-(B.position??0));for(let re=0;re<he.length;re++){let B=he[re],Z=re+1,Te=pt?`${pt}.${Z}`:`${Z}.0`,D=B.wbsCode||Te;if(B.wbsCode=D,j.push({task:B,level:fe}),B.subtasks&&B.subtasks.length>0&&B.isExpanded){let ue=B.wbsCode?.replace(/\.0$/,"")||(pt?`${pt}.${Z}`:`${Z}`);j.push(...kt(B.subtasks,fe+1,ue));}}return j},de=kt(e),De=48,tt=Math.max(de.length*a,600-De),Bt=(ie,fe)=>fe==="assignees"?ie.assignees:fe==="startDate"?ie.startDate:ie.endDate,Wt=(ie,fe,pt,j)=>{ie.preventDefault(),ie.stopPropagation(),I({sourceTaskId:fe,column:pt,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let he=ie.currentTarget.closest("[data-grid-body]"),re=ot=>{let be=he?.getBoundingClientRect().top??0,_=Math.floor((ot-be)/a);return _=Math.max(0,Math.min(de.length-1,_)),_<j&&(_=j),_},B=ie.clientY,Z=O?.current??null,Te=()=>{J.current&&(cancelAnimationFrame(J.current),J.current=null);},D=()=>{let ot=re(B);I(be=>be&&{...be,targetIndex:ot});},W=()=>{if(Te(),!Z)return;let ot=Z.getBoundingClientRect(),be=60,_=12,gt=B-ot.top,yt=ot.bottom-B;if(yt<be&&Z.scrollTop<Z.scrollHeight-Z.clientHeight){let _t=Math.max(1,Math.round(_*(1-Math.max(0,yt)/be))),Xt=()=>{Z.scrollTop+=_t,D(),Z.scrollTop<Z.scrollHeight-Z.clientHeight&&(J.current=requestAnimationFrame(Xt));};J.current=requestAnimationFrame(Xt);}else if(gt<be&&Z.scrollTop>0){let _t=Math.max(1,Math.round(_*(1-Math.max(0,gt)/be))),Xt=()=>{Z.scrollTop-=_t,D(),Z.scrollTop>0&&(J.current=requestAnimationFrame(Xt));};J.current=requestAnimationFrame(Xt);}},ue=ot=>{B=ot.clientY,D(),W();},ke=ot=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",ke),Te(),document.body.style.cursor="",document.body.style.userSelect="",I(null);let be=re(ot.clientY),_=de.find(ir=>ir.task.id===fe)?.task;if(!_)return;let gt=Bt(_,pt),yt=Math.min(j,be),_t=Math.max(j,be),Xt=[];for(let ir=yt;ir<=_t;ir++){if(ir===j)continue;let yr=de[ir]?.task;!yr||yr.subtasks&&yr.subtasks.length>0||Xt.push(yr.id);}Xt.length!==0&&b?.(Xt,pt,gt);};window.addEventListener("mousemove",ue),window.addEventListener("mouseup",ke);},Qe=ie=>{if(!Ce)return false;let fe=Math.min(Ce.sourceIndex,Ce.targetIndex),pt=Math.max(Ce.sourceIndex,Ce.targetIndex);return ie>=fe&&ie<=pt},vt=ie=>!ie.startDate||!ie.endDate?"-":`${Math.ceil((ie.endDate.getTime()-ie.startDate.getTime())/(1e3*60*60*24))}d`,xa=ie=>{R(ie.id),V(ie.name),Yt(true);},At=ie=>{ye.trim()&&ye!==e.find(fe=>fe.id===ie)?.name&&$?.(ie,ye.trim()),R(null),V(""),Yt(false);},er=()=>{R(null),V(""),Yt(false);},fa=(ie,fe)=>{fe.stopPropagation(),T?.(ie.id);},hr=(ie,fe)=>{fe.preventDefault(),lt.current=fe.clientY,je(ie),ct.current=false,L(false),Ke({x:fe.clientX,y:fe.clientY});},Ye=ie=>{if(!oe||(Math.abs(ie.clientY-lt.current)>Ee&&!ct.current&&(ct.current=true,L(true)),Ke({x:ie.clientX,y:ie.clientY}),!ct.current))return;if(O?.current){let re=O.current,B=re.getBoundingClientRect(),Z=60,Te=12;J.current&&(cancelAnimationFrame(J.current),J.current=null);let D=ie.clientY-B.top,W=B.bottom-ie.clientY;if(D<Z&&re.scrollTop>0){let ue=Math.round(Te*(1-D/Z)),ke=()=>{re.scrollTop-=ue,ct.current&&re.scrollTop>0&&(J.current=requestAnimationFrame(ke));};J.current=requestAnimationFrame(ke);}else if(W<Z&&re.scrollTop<re.scrollHeight-re.clientHeight){let ue=Math.round(Te*(1-W/Z)),ke=()=>{re.scrollTop+=ue,ct.current&&re.scrollTop<re.scrollHeight-re.clientHeight&&(J.current=requestAnimationFrame(ke));};J.current=requestAnimationFrame(ke);}}let pt=document.querySelectorAll("[data-task-row]"),j=null,he=null;pt.forEach(re=>{let B=re.getBoundingClientRect(),Z=re.getAttribute("data-task-row");if(Z&&Z!==oe&&ie.clientY>=B.top&&ie.clientY<=B.bottom){j=Z;let Te=ie.clientY-B.top,D=B.height;Te<D*.25?he="above":Te>D*.75?he="below":he="child";}}),Re(j),Nt(he);},Ze=()=>{if(ct.current&&oe&&et&&ut){if(ut==="child")N?.(oe,et);else if(ut==="above"||ut==="below"){let ie=(re,B,Z=null)=>{for(let Te of re){if(Te.id===B)return Z;if(Te.subtasks){let D=ie(Te.subtasks,B,Te.id);if(D!==void 0)return D}}},fe=U&&U.length>0?U:e,pt=ie(fe,oe,null),j=ie(fe,et,null),he=(re,B,Z,Te)=>{let D=re.findIndex(ke=>ke.id===B),W=Te?re.findIndex(ke=>ke.id===Z):-1,ue=ut==="below"?D+1:D;return Te&&W!==-1&&W<D&&(ue-=1),Math.max(0,ue)};if(j===null){let B=he(fe,et,oe,pt===null);N?.(oe,null,B);}else {let re=vs(fe,j);if(re?.subtasks){let B=pt===j,Z=he(re.subtasks,et,oe,B);N?.(oe,j,Z);}}}}J.current&&(cancelAnimationFrame(J.current),J.current=null),je(null),Re(null),Nt(null),Ke(null),ct.current=false,L(false);};react.useEffect(()=>{if(oe)return document.addEventListener("mousemove",Ye),document.addEventListener("mouseup",Ze),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ye),document.removeEventListener("mouseup",Ze),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,et,ut]);let Aa=(ie,fe,pt)=>{let j=fe.subtasks&&fe.subtasks.length>0;switch(ie.id){case "name":let he=ve===fe.id,re=Se===fe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pt*20}px`},children:[N&&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:re?1:.3},onMouseDown:_=>hr(fe.id,_),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),u?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),he?jsxRuntime.jsx("input",{ref:Ue,type:"text",value:ye,onChange:_=>V(_.target.value),onKeyDown:_=>{_.key==="Enter"?At(fe.id):_.key==="Escape"&&er();},onBlur:()=>At(fe.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:_=>_.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.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:fe.name}),fe.subtasks&&fe.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(fe.progress||0),"%"]}),X&&fe.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),X&&fe.cpmData&&jsxRuntime.jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),re&&!he&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:_=>fa(fe,_),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:_=>{_.stopPropagation(),xa(fe);},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 Z=ie.id==="startDate"?"startDate":"endDate",Te=fe[Z],D=K?.taskId===fe.id&&K?.field===Z,W=_=>_?(typeof _=="string"?new Date(_):_).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:_=>_.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:_=>{if(!j)if(D)we(null);else {let gt=_.currentTarget.getBoundingClientRect();we({taskId:fe.id,field:Z,month:Te?typeof Te=="string"?new Date(Te):Te:new Date,position:{top:gt.bottom+4,left:gt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:W(Te)}),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:()=>we(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:K?.position.top,left:K?.position.left},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let _=new Date,gt=new Date(_);gt.setDate(_.getDate()+1);let yt=new Date(_);yt.setDate(_.getDate()+7);let _t=new Date(_);return _t.setDate(_.getDate()+14),[{label:"Hoy",date:_},{label:"Ma\xF1ana",date:gt},{label:"Pr\xF3xima semana",date:yt},{label:"2 semanas",date:_t}].map((ir,yr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Sr=>Sr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Sr=>Sr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(fe.id,{[Z]:ir.date}),we(null);},children:ir.label},yr))})(),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:_=>_.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_=>_.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(fe.id,{[Z]:void 0}),we(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:()=>we(_=>_?{..._,month:new Date(_.month.getFullYear(),_.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:K?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>we(_=>_?{..._,month:new Date(_.month.getFullYear(),_.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((_,gt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:_},gt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=K?.month||new Date,gt=_.getFullYear(),yt=_.getMonth(),_t=new Date(gt,yt,1).getDay(),Xt=new Date(gt,yt+1,0).getDate(),ir=new Date,yr=[];for(let ia=_t-1;ia>=0;ia--)yr.push({day:new Date(gt,yt,-ia).getDate(),date:new Date(gt,yt-1,new Date(gt,yt,-ia).getDate()),isCurrentMonth:false});for(let ia=1;ia<=Xt;ia++)yr.push({day:ia,date:new Date(gt,yt,ia),isCurrentMonth:true});let Sr=42-yr.length;for(let ia=1;ia<=Sr;ia++)yr.push({day:ia,date:new Date(gt,yt+1,ia),isCurrentMonth:false});return yr.map((ia,Qo)=>{let Bn=ia.date.toDateString()===ir.toDateString(),Qn=(Te?typeof Te=="string"?new Date(Te):Te:null)?.toDateString()===ia.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:ia.isCurrentMonth?Qn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Qn?"#00E5CC":"transparent",boxShadow:Bn&&!Qn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(fe.id,{[Z]:ia.date}),we(null);},children:ia.day},Qo)})})()})]})]})]}),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:vt(fe)})});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=r.filter(_=>fe.assignees?.some(gt=>gt.id?gt.id===_.id:gt.name===_.name||gt.initials===_.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(Fo,{assignedUsers:ue,availableUsers:r,onChange:_=>{let gt=_.map(yt=>({id:yt.id,name:yt.name,initials:yt.initials,color:yt.color}));v?.(fe.id,{assignees:gt});}})});case "status":if(j){let _=fe.progress===100?"\u2713":fe.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:_})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(Mp,{status:fe.status||"todo",onChange:_=>{v?.(fe.id,{status:_,progress:_==="completed"?100:fe.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:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let ke={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ot={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},be=ke[fe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(Mo,{priority:be,onChange:_=>{_&&v?.(fe.id,{priority:ot[_]||"medium"});}})});default:return null}},Ia=ie=>[{id:"hide",label:"Hide Column",icon:ca.Hide,onClick:()=>m(ie),disabled:ie==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ca.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ca.SortDesc,onClick:()=>{}}],sr=ie=>{let fe=ie.subtasks&&ie.subtasks.length>0,pt=Uo(e),j=bt.size>1&&bt.has(ie.id),he=j?pt.filter(D=>bt.has(D.id)):[ie],re=he.map(D=>D.id),B=he.filter(D=>!(D.subtasks&&D.subtasks.length>0)),Z=j?` (${re.length})`:"",Te=()=>{M?M(re,ie.name):w?.(re);};return fe?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{T?.(ie.id);}},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+Z,icon:ca.Duplicate,onClick:()=>{C?.(re);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+Z,icon:ca.Delete,onClick:Te}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{c?.(ie);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{T?.(ie.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(A?.contextMenu?.markIncomplete||"Mark Incomplete")+Z,icon:ca.MarkIncomplete,onClick:()=>{B.forEach(D=>v?.(D.id,{status:"todo",progress:0}));},disabled:B.length===0||B.every(D=>D.status==="todo")},{id:"setInProgress",label:(A?.contextMenu?.setInProgress||"Set In Progress")+Z,icon:ca.SetInProgress,onClick:()=>{B.forEach(D=>v?.(D.id,{status:"in-progress"}));},disabled:B.length===0||B.every(D=>D.status==="in-progress")},{id:"markComplete",label:(A?.contextMenu?.markComplete||"Mark Complete")+Z,icon:ca.MarkComplete,onClick:()=>{B.forEach(D=>v?.(D.id,{status:"completed",progress:100}));},disabled:B.length===0||B.every(D=>D.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+Z,icon:ca.Duplicate,onClick:()=>{C?.(re);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+Z,icon:ca.Delete,onClick:Te}]},Ta=d.filter(ie=>ie.visible),Rr=Ta.reduce((ie,fe)=>ie+fe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Rr},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${De}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:Ta.map((ie,fe)=>{let pt=fe===Ta.length-1,j=ie.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:`${ie.width}px`,minWidth:`${ie.minWidth??(j?200:60)}px`,maxWidth:`${ie.maxWidth??2e3}px`,flexShrink:j&&Ta.length===1?1:0,flexGrow:j&&Ta.length===1?1:0,borderRight:pt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:he=>{he.preventDefault(),Ve({isOpen:true,x:he.clientX,y:he.clientY,type:"header",columnId:ie.id});},onMouseEnter:he=>{he.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:he=>{he.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:ie.label,children:ie.label}),ie.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:ne===ie.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:he=>{he.preventDefault(),he.stopPropagation(),Be(ie.id),Ne(he.clientX),Le(ie.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:ne===ie.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ie.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(fl,{columns:d,onToggleColumn:m,theme:t}),jsxRuntime.jsx("button",{onClick:()=>pe(!Ge),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"})}),Ge&&jsxRuntime.jsxs("div",{ref:rt,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:ie=>ie.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:()=>pe(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:tt},children:de.map(({task:ie,level:fe},pt)=>{let j=ht(ie.id),he=Qe(pt),re=et===ie.id,B=re&&ut==="above",Z=re&&ut==="below",Te=re&&ut==="child",D={};return Te&&(D.backgroundColor=`${t.accent}15`,D.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ie.id,className:`flex items-center cursor-pointer group ${oe===ie.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:Te?`${t.accent}15`:pt%2===0?t.bgPrimary:t.bgGrid,opacity:X?ie.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...D},onMouseEnter:()=>G(ie.id),onMouseLeave:()=>G(null),onClick:W=>{let ke=Uo(e).map(_=>_.id),be=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;qe(ie.id,ke,be,W.shiftKey),o?.(ie.id),!be&&!W.shiftKey&&s?.(ie);},onDoubleClick:W=>{W.stopPropagation(),c?.(ie);},onContextMenu:W=>{W.preventDefault(),Ve({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:ie}),l?.(ie,W);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[B&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Z&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ta.map((W,ue)=>{let ke=ue===Ta.length-1,ot=W.id==="name",be=!!(ie.subtasks&&ie.subtasks.length>0),_=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,yt=!!_&&!be&&Se===ie.id&&!Ce,_t=he&&!!Ce&&Ce.column===W.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${ot?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(ot?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:ot&&Ta.length===1?1:0,flexGrow:ot&&Ta.length===1?1:0,borderRight:ke?"none":`1px solid ${Se===ie.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:_t?`${t.accent}22`:void 0,boxShadow:_t?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Aa(W,ie,ot?fe:0),yt&&_&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Xt=>Wt(Xt,ie.id,_,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}})]},`${ie.id}-${W.id}`)})]},ie.id)})}),jsxRuntime.jsx(xs,{isOpen:$e.isOpen,x:$e.x,y:$e.y,items:$e.type==="header"&&$e.columnId?Ia($e.columnId):$e.type==="task"&&$e.task?sr($e.task):[],onClose:()=>Ve({...$e,isOpen:false}),theme:t}),st&&xt&&oe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:xt.x+12,top:xt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ie=de.find(fe=>fe.task.id===oe)?.task;return ie?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:ie.name})}):null})()}),document.body)]})}function dg(e,t){let[a,r]=react.useState("none"),[n,s]=react.useState(0),[o,i]=react.useState(e),[c,l]=react.useState(t),[u,p]=react.useState(null),[d,m]=react.useState(null),[f,v]=react.useState(null),[b,h]=react.useState(null),[y,x]=react.useState(0),[w,C]=react.useState(0),[P,$]=react.useState(null),[T,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:b,setDraggedSegmentIndex:h,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:P,setHoveredSegmentIndex:$,isHovered:T,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(X,A)=>{r("none"),p(null),m(null),i(X),l(A),C(0),h(null),x(0);}}}function yl({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:i,onClick:c,onDoubleClick:l,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:b,showTaskBarLabels:h=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let C=dg(t,r),P=react.useRef(null),$=react.useRef(false),T=react.useRef(null),S=react.useRef(null),{dragMode:M,setDragMode:N,dragOffset:U,setDragOffset:O,ghostX:X,setGhostX:A,ghostWidth:Se,setGhostWidth:G,connectionLine:ve,setConnectionLine:R,hoveredTaskId:ye,setHoveredTaskId:V,activeZone:Ue,setActiveZone:ne,draggedSegmentIndex:Be,setDraggedSegmentIndex:ce,draggedSegmentStartX:Ne,setDraggedSegmentStartX:ze,segmentDragOffsetX:Le,setSegmentDragOffsetX:$e,hoveredSegmentIndex:Ve,setHoveredSegmentIndex:oe,isHovered:je,setIsHovered:et,isDragging:Re,isResizing:ut,isConnecting:Nt,resetDragState:lt}=C,Ee=18,ct=!!n.executionBarBg,xt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Ke=ct?3:6,st=e.subtasks&&e.subtasks.length>0,L=react.useRef(null),[J,Ce]=(()=>{let j=react.useRef(null),[,he]=react.useState(0);return [j.current,re=>{j.current=re,he(B=>B+1);}]})(),I=!!w&&!x&&!st&&!e.segments&&!!e.startDate&&!!e.endDate,K=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let he=new Date(e.endDate);return he.setHours(0,0,0,0),he<j})()&&e.progress<100,we=y&&e.isCriticalPath,Ge=n.name==="neutral"||n.today==="#1C1917",pe=e.status==="completed"||e.progress===100,rt={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},qe=y&&e.isCriticalPath||K?"#EF4444":e.color?e.color:e.priority&&rt[e.priority]?rt[e.priority]:n.taskBarPrimary,ht=x?"default":Re?Nt?"crosshair":ut?"ew-resize":"grabbing":"grab",Yt=x?"default":"ew-resize",de=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),De=r<50,tt=r<40;react.useEffect(()=>{v&&(!je||Re||e.segments)&&v(null);},[je,Re,e.segments,v]);let Bt=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Wt=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Qe=j=>Math.round(j/s)*s,vt=j=>{let he=Math.round(j/s),re=new Date(o);return re.setDate(re.getDate()+he),re},xa=(j,he)=>{for(let re of m){if(re.id===e.id)continue;let B=5;if(j>=re.x-B&&j<=re.x+re.width+B&&he>=re.y-B&&he<=re.y+re.height+B)return re.id}return null},At=react.useCallback((j,he,re)=>{if(x)return;j.preventDefault(),j.stopPropagation();let B=P.current?.ownerSVGElement;if(!B)return;let Z=B.createSVGPoint();Z.x=j.clientX,Z.y=j.clientY;let Te=Z.matrixTransform(B.getScreenCTM()?.inverse()),D=re!==void 0?re:t,W=he;if(!W){let ue=Te.x-D;j.shiftKey?(W="connect",R({x:t+r,y:a+Ee/2})):j.ctrlKey||j.metaKey?W="move":j.altKey?W=ue<r/2?"resize-start":"resize-end":tt?ue<r/2?W="move":W="resize-end":De?ue<=de/2?W="resize-start":ue>=r-de/2?W="resize-end":W="move":ue<=de?W="resize-start":ue>=r-de?W="resize-end":W="move";}$.current=false,N(W),et(false),ne(null),W==="move"?O(Te.x-D):W==="connect"?R({x:t+r,y:a+Ee/2}):O(0),A(D),G(r);},[t,r,a,Ee,x]),er=react.useCallback(j=>{let he=P.current?.ownerSVGElement;if(!he)return;let re=he.closest(".gantt-timeline-scroll");if(!re)return;let B=re.getBoundingClientRect(),Z=60,Te=15,D=0;if(j.clientX<B.left+Z){let W=B.left+Z-j.clientX;D=-Math.min(Te,W/2);}else if(j.clientX>B.right-Z){let W=j.clientX-(B.right-Z);D=Math.min(Te,W/2);}return D!==0&&(re.scrollLeft+=D),D!==0},[]),fa=react.useCallback(j=>{if(M==="none")return;$.current=true,S.current=j;let he=P.current?.ownerSVGElement;if(!he)return;if(M==="move"||M==="resize-start"||M==="resize-end"){let Z=er(j);Z&&!T.current?T.current=window.setInterval(()=>{S.current&&(er(S.current),fa(S.current));},16):!Z&&T.current&&(window.clearInterval(T.current),T.current=null);}let re=he.createSVGPoint();re.x=j.clientX,re.y=j.clientY;let B=re.matrixTransform(he.getScreenCTM()?.inverse());if(M==="connect"){R({x:B.x,y:B.y});let Z=xa(B.x,B.y);V(Z);}else if(M==="move"){let Z=B.x-U,Te=Qe(Z);A(Te),G(r);let D=Math.round((Te-t)/s);if(f?.(e.id,D,true),e.segments&&e.segments.length>0&&Be!==null){let W=Te-Ne;$e(W);}}else if(M==="resize-start"){let Z=B.x,Te=Qe(Z),D=t+r-Te;D>=s&&(A(Te),G(D));}else if(M==="resize-end"){let Z=B.x,D=Qe(Z)-t;D>=s&&G(D);}},[M,t,r,s,U,e,Qe,Be,Ne,xa,V,R,A,G,$e,f,er]),hr=react.useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),S.current=null,M!=="none"){if(M==="connect")ye&&d&&d(e,ye),R(null),V(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),he,re,B=true;if(M==="move"){if(he=vt(X),re=new Date(he.getTime()+j),e.segments&&e.segments.length>0&&Be!==null){let Z=Math.round(Le/s),Te=e.segments.map((ke,ot)=>{if(ot===Be){let be=new Date(ke.startDate),_=new Date(ke.endDate);return be.setDate(be.getDate()+Z),_.setDate(_.getDate()+Z),{startDate:be,endDate:_}}return ke}),D=Te.flatMap(ke=>[ke.startDate,ke.endDate]),W=new Date(Math.min(...D.map(ke=>ke.getTime()))),ue=new Date(Math.max(...D.map(ke=>ke.getTime())));p?.({...e,segments:Te},W,ue),lt(t,r);return}}else M==="resize-start"?(he=vt(X),re=e.endDate,he>re&&(console.warn("Invalid date range: start date must be before or equal to end date"),B=false)):M==="resize-end"?(he=e.startDate,re=vt(X+Se),re.setDate(re.getDate()-1),re<he&&(console.warn("Invalid date range: end date must be after or equal to start date"),B=false)):B=false;B&&he&&re&&(re.getTime()<he.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,he,re));}f?.(e.id,0,false),lt(t,r);}},[M,X,Se,e,p,ye,d,t,r,s,vt,Le,Be,lt,f]);react.useEffect(()=>{if(M==="none")return;let j=re=>{fa(re);},he=()=>{hr();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",he),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",he),T.current&&(window.clearInterval(T.current),T.current=null);}},[M,fa,hr]);let Ye=Re&&!Nt?X:t,Ze=Re&&!Nt?Se:r,Aa=i.taskClass(e),Ia=24,sr=y?e.isCriticalPath?1:.25:1,Ta=react.useCallback(j=>{if(!I)return;j.stopPropagation(),j.preventDefault();let re=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:re,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),Ce(e.progress||0);},[I,e.progress,Ce]),Rr=react.useCallback(j=>{let he=L.current;if(!he)return;let B=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??he.barRect;if(!B||B.width<=0)return;let Z=(j.clientX-B.left)/B.width,Te=Math.round(Math.max(0,Math.min(1,Z))*100);j.shiftKey&&(Te=Math.round(Te/25)*25),Ce(Te);},[Ce]),ie=react.useCallback(j=>{let he=L.current;if(!he)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let re=J;L.current=null,Ce(null),re!=null&&re!==he.initialPct&&w&&w(e,re);},[J,w,e,Ce]),fe=react.useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),pt=J??(e.progress||0);return jsxRuntime.jsxs("g",{ref:P,"data-task-bar":"true","data-estado":pe?"completed":K?"overdue":"planned","data-resumen":st?"true":void 0,style:{opacity:sr,transition:"opacity 300ms ease"},onClick:()=>{!Re&&!$.current&&c?.(e),$.current=false;},onDoubleClick:j=>{!Re&&!$.current&&(j.stopPropagation(),l?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!Re&&et(true),onMouseMove:j=>{v&&je&&!Re&&!e.segments&&v({task:e,x:t,y:a,width:r,height:Ee,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{Re||(et(false),ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+Ia,height:Ee,fill:"transparent",style:{pointerEvents:"all"}}),je&&!Re&&!De&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:de,height:Ee,fill:Ue==="resize-start"?n.accent:"transparent",opacity:Ue==="resize-start"?.15:0,style:{cursor:Yt,pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:j=>At(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+de,y:a,width:r-de*2,height:Ee,fill:Ue==="move"?n.accent:"transparent",opacity:Ue==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:j=>At(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-de,y:a,width:de,height:Ee,fill:Ue==="resize-end"?n.accent:"transparent",opacity:Ue==="resize-end"?.15:0,style:{cursor:Yt,pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:j=>At(j,"resize-end")})]}),je&&!Re&&tt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ee,fill:Ue==="move"?n.accent:"transparent",opacity:Ue==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:j=>At(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ee,fill:Ue==="resize-end"?n.accent:"transparent",opacity:Ue==="resize-end"?.2:0,style:{cursor:Yt,pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:j=>At(j,"resize-end")}),je&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ee-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Re&&!Nt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:X,y:a,width:Se,height:Ee,rx:Ke,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"}}),b&&e.baselineStartDate&&e.baselineEndDate&&!Re&&(()=>{let j=e.baselineStartDate.getTime(),he=e.baselineEndDate.getTime(),re=o.getTime(),B=864e5,Z=(j-re)/B,Te=(he-j)/B,D=Z*s,W=Math.max(Te*s,s),ue=Ye+Ze,ke=D+W,ot=e.endDate?.getTime()??0,be=Math.ceil((ot-he)/B),_=be>0,gt=be<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:D,y:a,width:W,height:Ee,rx:Ke,fill:"none",stroke:xt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),_&&ue>ke&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ue-ke,height:Ee,rx:0,fill:"#EF4444",opacity:.2}),_&&jsxRuntime.jsxs("text",{x:Math.max(ue,ke)+6,y:a+Ee/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",be,"d"]}),gt&&jsxRuntime.jsxs("text",{x:ue+6,y:a+Ee/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[be,"d"]})]})})(),!e.segments&&ct&&st&&(()=>{let he=a+(Ee-8)/2,re=4,B=e.progress||0,Z=new Date;Z.setHours(0,0,0,0);let Te=e.startDate&&Z>=e.startDate,D=e.endDate&&(()=>{let _=new Date(e.endDate);return _.setHours(0,0,0,0),Z>_})(),W=e.startDate&&Z<e.startDate,ue=1;if(Te&&e.startDate&&e.endDate&&!W){let _=new Date(e.startDate);_.setHours(0,0,0,0);let gt=new Date(e.endDate);gt.setHours(0,0,0,0);let yt=Math.max(1,(gt.getTime()-_.getTime())/(1e3*60*60*24)),Xt=Math.min((Z.getTime()-_.getTime())/(1e3*60*60*24),yt)/yt*100;ue=Xt>0?B/Xt:1;}let ke;B>=100?ke="#00E5CC":W?ke="#4B5563":D&&B<100?ke="#EF4444":ue>=.95?ke="#22C55E":ue>=.8?ke="#F59E0B":ke="#EF4444";let ot=Math.max(B/100*Ze,B>0?re*2:0),be=Ze>100&&B>0;return jsxRuntime.jsxs("g",{"data-task-class":Aa,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{"data-parte":"pista",x:Ye,y:he,width:Ze,height:8,rx:re,fill:"rgba(255,255,255,0.10)"}),B>0&&jsxRuntime.jsx("rect",{"data-parte":"avance",x:Ye,y:he,width:ot,height:8,rx:re,fill:ke}),be&&jsxRuntime.jsxs("text",{x:Ye+ot+6,y:he+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(B),"%"]})]})})(),!e.segments&&ct&&!st&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye,y:a,width:Ze,height:Ee,rx:Ke,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Aa,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Re&&!Nt?.15:e.parentId?.6:1,scale:je&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>At(j),style:{cursor:ht,pointerEvents:"all"}}),!e.segments&&!ct&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye,y:a,width:Ze,height:Ee,rx:Ke,fill:qe,"data-task-class":Aa,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Re&&!Nt?.15:e.parentId?.6:je?.9:.8,scale:je&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:st?void 0:j=>At(j),style:{cursor:st?"default":ht,pointerEvents:"all"}}),ct&&(K||we)&&!e.segments&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:Ze,height:Ee,rx:Ke,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),K&&!pe&&!e.segments&&!st&&jsxRuntime.jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Ye+Ze+4}, ${a+Ee/2-6})`,children:[jsxRuntime.jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!e.segments&&pt>0&&!st&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:Math.max(Ze*(pt/100),Ke*2),height:Ee,rx:Ke,fill:qe,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!st&&e.progress<100&&(()=>{let j=e.progress>0?Ze*(e.progress/100):0,he=Ye+j,re=Ze-j,B=e.progress===0?Ke:0,Z=e.progress===0?Ye:he,Te=e.progress===0?Ze:re;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Z,y:a,width:Te,height:Ee,rx:B,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Z,y:a,width:Te,height:Ee,rx:B,fill:"none",stroke:qe,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),ct&&!e.segments&&e.progress>0&&e.progress<100&&!st&&!Re&&J===null&&(()=>{let j=Ye+Ze*(e.progress/100),he=8,re=e.assignees?.[0];return jsxRuntime.jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:j,cy:a+Ee/2,r:he,fill:re?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:j,y:a+Ee/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:re?.initials||re?.name?.charAt(0)?.toUpperCase()||""})]})})(),I&&!Re&&Ze>=40&&(J!==null||pt<88)&&(()=>{let j=Ye+Ze*(pt/100),he=a+Ee/2,re=J!==null,B=re?7:je?6:5,Z=re||je?1:.35,Te=Ye+Ze-j,D=Math.max(4,Math.min(12,Te-10)),W=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-W,y:he-12,width:W+D,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Ta,onPointerMove:Rr,onPointerUp:ie,onPointerCancel:ie,onClick:fe,onDoubleClick:fe,onMouseDown:ue=>ue.stopPropagation()}),jsxRuntime.jsx("circle",{"data-parte":"asa-avance",cx:j,cy:he,r:B,fill:"#FFFFFF",stroke:qe,strokeWidth:2,opacity:Z,style:{pointerEvents:"none",filter:re?`drop-shadow(0 0 4px ${qe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),re&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:j-20,y:he-28,width:40,height:18,rx:4,fill:xt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:qe,strokeWidth:1}),jsxRuntime.jsxs("text",{x:j,y:he-16,textAnchor:"middle",dominantBaseline:"central",fill:xt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[J,"%"]})]})]})})(),e.segments&&e.segments.map((j,he)=>{let re=(j.startDate.getTime()-o.getTime())/864e5*s,Z=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-re+s,Te=Re&&M==="move"&&Be===he,D=Ve===he,W=Te?re+Le:re;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Re&&oe(he),onMouseLeave:()=>!Re&&oe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:W,y:a,width:Z,height:Ee,rx:Ke,fill:qe,initial:{opacity:0,scale:.95},animate:{opacity:Te||e.parentId?.6:D?.9:.8,scale:D&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ue=>{ue.stopPropagation(),ce(he),ze(re),At(ue,void 0,re);},style:{cursor:ht,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:W,y:a,width:Z*(e.progress/100),height:Ee,rx:Ke,fill:qe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${he}`)}),Ge&&(K||we)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[we&&!K&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:Ze,height:Ee,rx:Ke,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),K&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:Ze,height:Ee,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),h&&Ze>60&&!e.segments&&!(ct&&st)&&(()=>{let j=i.taskLabel(e),he=typeof j=="string"?j:e.name,re=he.length>Math.floor(Ze/8)?`${he.substring(0,Math.floor(Ze/8))}...`:he;return jsxRuntime.jsx("text",{"data-parte":"etiqueta",x:Ye+8,y:a+Ee/2,dominantBaseline:"middle",fill:pe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pe?"line-through":"none"},children:re})})(),!Re&&!e.segments&&!st&&e.progress>0&&e.progress<100&&(ct?jsxRuntime.jsxs("text",{x:Ye+Ze+6,y:a+Ee/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ze>100?jsxRuntime.jsxs("text",{x:Ye+Ze-12,y:a+Ee/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&&Ze>80&&!Re&&!e.segments&&!(ct&&st)&&jsxRuntime.jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ye+Ze-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ye+Ze-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(je||ut)&&!Nt&&!e.segments&&!st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ye-2,y:a,width:16,height:Ee,fill:"transparent",style:{cursor:Yt},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:j=>{j.stopPropagation(),At(j,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye+4,y:a+8,width:3,height:Ee-16,rx:1.5,fill:Ue==="resize-start"||M==="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:Ye+Ze-14,y:a,width:16,height:Ee,fill:"transparent",style:{cursor:Yt},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:j=>{j.stopPropagation(),At(j,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye+Ze-7,y:a+8,width:3,height:Ee-16,rx:1.5,fill:Ue==="resize-end"||M==="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:je&&!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+r+10,cy:a+Ee/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:j=>{j.stopPropagation(),At(j,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ee/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}})]})}),Nt&&ve&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ee/2,x2:ve.x,y2:ve.y,stroke:ye?n.statusCompleted:n.accent,strokeWidth:ye?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ye?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:ve.x,cy:ve.y,r:ye?8:6,fill:ye?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ye&&jsxRuntime.jsx(framerMotion.motion.text,{x:ve.x+15,y:ve.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ve.x+10},animate:{opacity:1,x:ve.x+15},transition:{duration:.2},children:"Connect"})]}),(je||Re)&&!Nt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye-1,y:a-1,width:Ze+2,height:Ee+2,rx:Ke+1,fill:"none",stroke:Re?n.accent:ct?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ct?1:2,opacity:Re||ct?.6:.4,initial:{opacity:0},animate:{opacity:Re||ct?.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+Se,y1:0,x2:X+Se,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&!Re&&!e.segments&&!v&&(()=>{let re=a<100,B=re?a+Ee+13:a-82-13,Z=re?`M ${Ye+Ze/2-6} ${a+Ee+3} L ${Ye+Ze/2} ${a+Ee+13} L ${Ye+Ze/2+6} ${a+Ee+3}`:`M ${Ye+Ze/2-6} ${a-13} L ${Ye+Ze/2} ${a-3} L ${Ye+Ze/2+6} ${a-13}`,Te=B+22,D=B+40,W=B+55,ue=B+70,ke=re?B+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:re?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:re?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Z,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ye+Ze/2-120,y:B,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:Ye+Ze/2,y:Te,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:Ye+Ze/2-110,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ye+Ze/2-70,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.startDate)}),jsxRuntime.jsx("text",{x:Ye+Ze/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ye+Ze/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.endDate)}),jsxRuntime.jsx("text",{x:Ye+Ze/2+10,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ye+Ze/2+65,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt()}),jsxRuntime.jsx("text",{x:Ye+Ze/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ye+Ze/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:Ye+Ze/2-110,y:ue,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ye+Ze/2-50,y:ue,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ot=>ot.name).join(", ").substring(0,30),e.assignees.map(ot=>ot.name).join(", ").length>30?"...":""]})]}),!re&&jsxRuntime.jsx("text",{x:Ye+Ze/2,y:ke,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:tt?"Left: move \u2022 Right: resize":De?"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 Ld=260,ks=8,mg=16,Sw=-12;function gg({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:C}=e,P=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,$=x.lastActivity!=null,T=(P?155:105)+($?28:0),S=w+mg,M=C+Sw-T;S+Ld>window.innerWidth-ks&&(S=w-Ld-mg),S<ks&&(S=ks);let N=M<ks;N&&(M=C+20),M+T>window.innerHeight-ks&&(M=window.innerHeight-ks-T),s({left:S,top:M,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,i=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},l=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let M=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${M} d\xEDa${M!==1?"s":""}`:`${M} day${M!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),C=M=>`${M.getFullYear()}-${String(M.getMonth()+1).padStart(2,"0")}-${String(M.getDate()).padStart(2,"0")}`,P=0,$=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;$.getTime()<=T.getTime();){let M=$.getDay();x[M]&&!w.has(C($))&&P++,$.setDate($.getDate()+1);}let S=Math.max(0,P);return a==="es"?`${S} d\xEDa${S!==1?"s":""}`:`${S} day${S!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),C=x%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",b=t.bgSecondary||"#1F2937",h=t.border||"#374151",y=jsxRuntime.jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Ld,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:b,border:`1px solid ${h}`,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(xl,{label:c.start,value:o.startDate?l(o.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(xl,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsxRuntime.jsx(xl,{label:c.end,value:o.endDate?l(o.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(xl,{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))})]}),i&&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:a==="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 sd({templates:e,onSelectTemplate:t,className:a}){let[r,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),n(false);},c=e.reduce((l,p)=>{let u=p.category||"Other";return l[u]||(l[u]=[]),l[u].push(p),l},{});return jsxRuntime.jsxs("div",{className:g("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsxRuntime.jsx("div",{children:p.map(u=>jsxRuntime.jsxs("button",{onClick:()=>i(u),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:u.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:u.name}),u.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:u.description})]})]},u.id))})]},l)),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 ld({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,i]=react.useState("export"),[c,l]=react.useState("json"),[p,u]=react.useState(null),d=react.useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,b=await sp(e,c,v);ip(b,c);},f=async v=>{let b=v.target.files?.[0];if(b){try{let h=await dp(b),y=b.name.endsWith(".json")?"json":"csv",x=cp(h,y);u(x),x.success&&r&&r(x,h);}catch(h){u({success:false,errors:[`Failed to read file: ${h instanceof Error?h.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:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>i("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:()=>i("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:()=>l(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"})]})]}),p&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((v,b)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},b))})]})]})]})]})]})}var ev=["URGENT","HIGH","MEDIUM","LOW"],tv=[{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"}],av=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function cd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:u=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,b]=react.useState(true),h=react.useCallback(P=>{a({search:P.target.value});},[a]),y=react.useCallback(P=>{a({dateFilter:P.target.value});},[a]),x=react.useCallback(P=>{r({by:P.target.value});},[r]),w=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>b(!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:P=>{P.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:P=>{P.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"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[u&&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"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange: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:P=>{let O=P.target.value;a({priorities:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ev.map(P=>jsxRuntime.jsx("option",{value:P,children:P},P))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:P=>{let O=P.target.value;a({assignees:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:P=>{let O=P.target.value;a({labels:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(P=>jsxRuntime.jsx("option",{value:P,children:P},P))]})}),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:tv.map(P=>jsxRuntime.jsx("option",{value:P.value,children:P.label},P.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:P=>f(P.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:av.map(P=>jsxRuntime.jsx("option",{value:P.value,children:P.label},P.value))})}),C&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function dd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=react.useState(false),u=react.useRef(null);react.useEffect(()=>{let m=f=>{u.current&&!u.current.contains(f.target)&&p(false);};return l&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[l]);let d=m=>{m(),p(false);};return jsxRuntime.jsxs("div",{className:g("relative",r),ref:u,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!l),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":l,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"})]}),l&&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 i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 ud={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"}},pd={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"}},md={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"}},Bo={dark:ud,light:pd,neutral:md},ul="dark";var pl=react.createContext(void 0),pv="asakaa-theme";function $m({children:e,defaultTheme:t=ul,storageKey:a=pv}){let[r,n]=react.useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=react.useCallback(i=>{n(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Bo[r];Object.entries(c.colors).forEach(([p,u])=>{u&&i.style.setProperty(`--theme-${mv(p)}`,u);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,u])=>{let d=c.colors[p];d&&i.style.setProperty(u,d);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:Bo};return jsxRuntime.jsx(pl.Provider,{value:o,children:e})}function bs(){let e=react.useContext(pl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function mv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function gd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=bs();return e?jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Bo).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",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children: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"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var pt={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 Om(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return pt[e]||pt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",pt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",pt[e].bgSecondary),bgGrid:r("--theme-bg-card",pt[e].bgGrid),bgWeekend:r("--theme-bg-hover",pt[e].bgWeekend),border:r("--theme-border-primary",pt[e].border),borderLight:r("--theme-border-subtle",pt[e].borderLight),textPrimary:r("--theme-text-primary",pt[e].textPrimary),textSecondary:r("--theme-text-secondary",pt[e].textSecondary),textTertiary:r("--theme-text-tertiary",pt[e].textTertiary),accent:r("--theme-accent-primary",pt[e].accent),accentHover:r("--theme-accent-hover",pt[e].accentHover),accentLight:r("--theme-accent-primary",pt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",pt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",pt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",pt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",pt[e].dependency),dependencyHover:r("--theme-border-secondary",pt[e].dependencyHover),criticalPath:r("--theme-error",pt[e].criticalPath),criticalPathLight:r("--theme-error",pt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",pt[e].today):e==="neutral"?r("--theme-text-primary",pt[e].today):r("--theme-error",pt[e].today),todayLight:e==="light"?r("--theme-accent-primary",pt[e].todayLight):e==="neutral"?r("--theme-text-primary",pt[e].todayLight):r("--theme-error",pt[e].todayLight),milestone:r("--theme-warning",pt[e].milestone),milestoneLight:r("--theme-warning",pt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",pt[e].statusTodo),statusInProgress:r("--theme-accent-primary",pt[e].statusInProgress),statusCompleted:r("--theme-success",pt[e].statusCompleted),hoverBg:r("--theme-bg-hover",pt[e].hoverBg),focusRing:r("--theme-accent-primary",pt[e].focusRing),...pt[e].dotGrid&&{dotGrid:pt[e].dotGrid},...pt[e].glassHeader&&{glassHeader:pt[e].glassHeader},...pt[e].glassToolbar&&{glassToolbar:pt[e].glassToolbar},...pt[e].forecastHud&&{forecastHud:pt[e].forecastHud},...pt[e].neonRedGlow&&{neonRedGlow:pt[e].neonRedGlow},...pt[e].executionBarBg&&{executionBarBg:pt[e].executionBarBg}}}var ml={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!",columns:"Columns"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Hm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!",columns:"Columnas"},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"}},fd={en:ml,es:Hm};function Um(e){return fd[e]||fd.en}function bd(e,t){let a=Um(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ys=react.createContext(ml);function Hr(){return react.useContext(ys)}function ii(e,t,a="left",r=208){let[n,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),i=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),n}function qm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[i,c]=react.useState(false),[l,p]=react.useState(null),u=react.useRef(null),d=react.useRef(null),m=Hr(),f=ii(u,i,"right",176);if(react.useEffect(()=>{if(!i)return;let y=x=>{let w=x.target;u.current&&!u.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),!(t||a||r||n||s||o))return null;let b=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler: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),h=async(y,x)=>{if(x){p(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{p(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:u,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#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:i?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&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:b.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>h(y.id,y.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<b.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:l===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 hd({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,i]=react.useState(false),[c,l]=react.useState(null),[p,u]=react.useState(false),d=react.useRef(null),m=react.useRef(null),f=Hr(),v=ii(d,o,"right",224),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",h=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!o)return;let C=P=>{let O=P.target;d.current&&!d.current.contains(O)&&m.current&&!m.current.contains(O)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[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:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),x=async(C,P)=>{if(P){l(C);try{await P();}catch(O){console.error(`Export ${C} failed:`,O);}finally{l(null),i(false);}}},w=()=>{s?.(),u(true),setTimeout(()=>u(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>i(!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:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((C,P)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:P*.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===C.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"})}):C.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"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:b?"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:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?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:p?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Rv({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(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?r.textPrimary:r.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:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Bv({options:e,value:t,onChange:a,theme:r}){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:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children: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:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function yd({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=react.useState(false),o=react.useRef(null),i=react.useRef(null),c=Hr(),l=ii(o,n,"left");react.useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&i.current&&!i.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],u=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"}: ${u}`,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:u})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(framerMotion.motion.div,{ref:i,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:l.top,left:l.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:p.map((d,m)=>{let f=t===d.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(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<p.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 xd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=react.useState(false),i=react.useRef(null),c=react.useRef(null),l=Hr(),p=ii(i,s,"left");react.useEffect(()=>{if(!s)return;let v=setTimeout(()=>{let b=y=>{let x=y.target;i.current&&!i.current.contains(x)&&c.current&&!c.current.contains(x)&&o(false);},h=y=>{y.key==="Escape"&&o(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[s]);let u=[{value:"all",label:l.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:l.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=(t!=="all"?1:0)+(r?1:0),f=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:i,onClick:v=>{v.stopPropagation(),o(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?f?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?f?"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.jsxs("span",{children:[l.toolbar.filter||"Filters",m>0?` \xB7 ${m}`:""]})]}),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:p.top,left:p.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${f?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:f?"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:f?"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:f?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(v=>{let b=t===v.value&&!r,h=()=>v.value==="all"?b?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"}):v.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(v.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:b?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?v.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:v.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},v.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"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(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"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:r?"#00E5CC":f?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function zm({value:e,onChange:t,theme:a}){let r=Hr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let i=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:i?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function $v({theme:e,forecast:t}){let a=Hr(),r=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,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,u=t?.costAtCompletion,d=t?.currency||"$",m=u!=null?u>=1e6?`${d}${(u/1e6).toFixed(2)}M`:u>=1e3?`${d}${(u/1e3).toFixed(1)}K`:`${d}${u.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,b=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,h=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#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||(r?"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:a.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:[a.toolbar.expectedFinish,": ",n]}),o&&i&&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:i})]})]}),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:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"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:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&b&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:h.bg,color:h.text,fontFamily:"'JetBrains Mono', monospace"},children:b})]})]})]})}function Gm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:u=true}){let[d,m]=react.useState(false),f=react.useRef(null),v=react.useRef(null),b=Hr(),h=ii(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!d)return;let P=O=>{let N=O.target;f.current&&!f.current.contains(N)&&v.current&&!v.current.contains(N)&&m(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[d]);let x=b.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!u,tooltip:u?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:r,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:i,onChange:c}],C=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.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:b.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:h.top,left:h.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:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:w.map((P,O)=>{let N=P.icon,S=P.disabled,M=P.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!S&&P.onChange?.(!P.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:S?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:S?"not-allowed":"pointer"},whileHover:S?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:O*.03},title:M,children:[jsxRuntime.jsx(N,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:S?y?"rgba(255,255,255,0.2)":"#D1D5DB":P.active?e.accent||"#00E5CC":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:P.label}),P.active&&!S&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.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:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((P,O)=>{let N=l===P.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(P.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+O)*.03},children:[jsxRuntime.jsx("span",{style:{color:N?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:P.label}),N&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.value)})]})]})}),document.body)]})}function Ov({theme:e,etiqueta:t,children:a}){let[r,n]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},i=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i);}},[r]),jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,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"}),r&&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:a})]})}function gl({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:p=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:h,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:P="execution",onViewModeChange:O,projectForecast:N,hideForecastHud:S,onExportPNG:M,onExportPDF:T,onExportExcel:z,onExportCSV:$,onExportJSON:J,onExportMSProject:L,showCriticalPath:Ae=true,onShowCriticalPathChange:U,showDependencies:we=true,onShowDependenciesChange:R,highlightWeekends:xe=true,onHighlightWeekendsChange:G,showBaseline:Ve=false,onShowBaselineChange:ne,onCopySnapshotLink:Re,hasDependencies:ce=true}){let Be=Hr(),Le=M||T||z||$||J||L,Pe=!!t.glassToolbar,Oe=[{value:"day",label:Be.toolbar.day},{value:"week",label:Be.toolbar.week},{value:"month",label:Be.toolbar.month}],dt=[{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"})}],Z=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(zm,{value:a,onChange:r,theme:t}),v&&jsxRuntime.jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y,jsxRuntime.jsx(Gm,{theme:t,showCriticalPath:Ae,onShowCriticalPathChange:U,showBaseline:Ve,onShowBaselineChange:ne,highlightWeekends:xe,onHighlightWeekendsChange:G,showDependencies:we,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:ce}),jsxRuntime.jsx(hd,{theme:t,onExportPNG:M,onExportPDF:T,onExportExcel:z,onExportMSProject:L,onCopySnapshotLink:Re}),(O||w)&&jsxRuntime.jsxs(Ov,{theme:t,etiqueta:Be.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[O&&jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(ze=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>O(ze),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:P===ze?Z?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[ze==="execution"?Be.toolbar.viewExecution:Be.toolbar.viewOracle,P===ze&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"})]},ze))}),w&&jsxRuntime.jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsxRuntime.jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C})})]})]});if(Pe){let ze=Z?"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:O&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Z?"#000000":t.bgSecondary,border:`1px solid ${Z?"rgba(255,255,255,0.08)":t.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>O("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="execution"?Z?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:P==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="execution"?{color:t.textSecondary}:{},children:Be.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>O("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="oracle"?Z?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:P==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="oracle"?{color:t.textSecondary}:{},children:Be.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(zm,{value:a,onChange:r,theme:t}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ze}}),w&&jsxRuntime.jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsxRuntime.jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ze}}),y]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ze}}),jsxRuntime.jsx(Gm,{theme:t,showCriticalPath:Ae,onShowCriticalPathChange:U,showBaseline:Ve,onShowBaselineChange:ne,highlightWeekends:xe,onHighlightWeekendsChange:G,showDependencies:we,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:ce}),jsxRuntime.jsx(hd,{theme:t,onExportPNG:M,onExportPDF:T,onExportExcel:z,onExportMSProject:L,onCopySnapshotLink:Re}),u&&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 ${Z?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Z?"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||Be.toolbar.createTask})]})]})]}),N&&!S&&jsxRuntime.jsx($v,{theme:t,forecast:N})]})}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(Bv,{options:Oe,value:a,onChange:ze=>r(ze),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(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxRuntime.jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h})]})]}),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}})]}),u&&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||Be.toolbar.createTask})]}),(Le||p)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsxRuntime.jsx(hd,{theme:t,onExportPNG:M,onExportPDF:T,onExportExcel:z,onExportMSProject:L,onCopySnapshotLink:Re}),p&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),p&&jsxRuntime.jsx(Rv,{options:dt,value:o,onChange:ze=>i(ze),theme:t})]})]})}function fl({columns:e,onToggleColumn:t,theme:a}){let r=Hr(),[n,s]=react.useState(false),[o,i]=react.useState({x:0,y:0}),c=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{if(!n)return;let u=d=>{c.current&&!c.current.contains(d.target)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let p=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:l,onClick:()=>{if(!n&&l.current){let u=l.current.getBoundingClientRect();i({x:u.left,y:u.bottom+4});}s(!n);},className:"p-2 rounded-md transition-colors flex items-center gap-1",title:r.toolbar.columns||"Columns","aria-label":r.toolbar.columns||"Columns",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Columns3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(ba,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${o.x}px`,top:`${o.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),p.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:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function xs({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=react.useRef(null),[i,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,u=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,b=a;t+p+d>m&&(v=t-p,v<d&&(v=d)),a+u+d>f&&(b=f-u-d,b<d&&(b=d)),c({x:v,y:b});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=d=>{o.current&&!o.current.contains(d.target)&&n();},u=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",u);}},[e,n]),!e)return null;let l=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),n());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:u=>{p.disabled||(u.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var ma={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 tg({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:u,enableKeyboard:d=true}){let m=react.useRef(false),f=react.useCallback(x=>{m.current=x;},[]),v=react.useCallback(x=>{let w=[],C=P=>{for(let O of P)w.push(O),O.subtasks&&O.subtasks.length>0&&O.isExpanded&&C(O.subtasks);};return C(x),w},[]),b=react.useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),h=react.useCallback((x,w)=>{let C=v(e);if(C.length===0)return;let P=b();if(!P){a(C[0].id,false);return}let O=C.findIndex(M=>M.id===P.id);if(O===-1)return;let N=x==="up"?O-1:O+1;if(N<0||N>=C.length)return;let S=C[N];a(S.id,w);},[e,b,v,a]),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 O=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,N=Array.from(t),S=b();if(x.key==="ArrowUp"){x.preventDefault(),h("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),h("down",x.shiftKey);return}if(S&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!S.isExpanded||x.key==="ArrowLeft"&&S.isExpanded)&&p(S.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){N.length>0&&(x.preventDefault(),o(N,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){N.length>0&&(x.preventDefault(),i(N));return}if(x.key==="Tab"&&x.shiftKey){N.length>0&&(x.preventDefault(),c(N));return}if(x.key==="Enter"&&!x.shiftKey&&!O){S&&(x.preventDefault(),r(S.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!O){S&&(x.preventDefault(),r(S.id,"above"));return}if(x.key==="Enter"&&O){S&&(x.preventDefault(),u(S.id));return}if(x.key==="F2"){S&&(x.preventDefault(),l(S.id));return}if(x.key==="Delete"||x.key==="Backspace"&&O){N.length>0&&(x.preventDefault(),n(N));return}if(x.key==="d"&&O&&!x.shiftKey){N.length>0&&(x.preventDefault(),s(N));return}},[d,t,b,h,r,n,s,o,i,c,l,p,u]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function rg(e){let[t,a]=react.useState(new Set),[r,n]=react.useState(null);react.useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=react.useCallback(d=>{a(new Set([d])),n(d);},[]),o=react.useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),i=react.useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let b=Math.min(f,v),h=Math.max(f,v),y=m.slice(b,h+1);a(new Set(y)),n(d);},[r,s]),c=react.useCallback((d,m,f,v)=>{v?i(d,m):f?o(d):s(d);},[s,o,i]),l=react.useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),p=react.useCallback(()=>{a(new Set),n(null);},[]),u=react.useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:p,isTaskSelected:u}}function Td(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Td(t.subtasks):t.subtasks}))}function Uo(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<o.length;i++){let c={...o[i],parentId:n,level:s,position:o[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function vs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=vs(a.subtasks,t);if(r)return r}}return null}function Cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Cd(a.subtasks,t);if(r)return r}return null}function Nd(e,t){if(t.length===0)return e;let a=Uo(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(b=>{if(m.has(b.id))return f.push(b),false;if(b.subtasks){let h=o(b.subtasks,m);b.subtasks=h.tasks,f.push(...h.removed);}return true}),removed:f}},i=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:i(v.subtasks,m,f)}:v),c=new Set(t),{tasks:l,removed:p}=o(e,c),u=i(l,s.id,p);return Td(u)}function Dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Cd(a,r);if(!n)continue;let s=Cd(a,n.id),o=(l,p,u)=>{for(let d=0;d<l.length;d++){let m=l[d];if(m.id===p&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===u);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,p,u);if(f)return f}}return null},i=(l,p,u)=>{let d=l.findIndex(m=>m.id===p);if(d!==-1)return l.splice(d+1,0,u),l;for(let m of l)m.subtasks&&i(m.subtasks,p,u);return l},c=o(a,n.id,r);c&&(s&&s.subtasks?i(s.subtasks,n.id,c):i(a,n.id,c));}return Td(a)}function Sd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,i,c)=>{let l=o.findIndex(u=>u.id===i);if(l===-1){for(let u of o)if(u.subtasks&&s(u.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=o.length?false:([o[l],o[p]]=[o[p],o[l]],o[l]={...o[l],position:l},o[p]={...o[p],position:p},true)};return s(r,n,a),r}function Ed(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ci(e,t){let a=[...e],r=[];for(let n of t){let s=(c,l)=>c.map((p,u)=>({...p,id:`${p.id}-copy-${Date.now()}-${u}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${u}`):void 0})),o=c=>{let l=c.findIndex(m=>m.id===n);if(l===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let p=c[l],u=`${p.id}-copy-${Date.now()}`,d={...p,id:u,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,u):void 0};return c.splice(l+1,0,d),d},i=o(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function ng(e,t,a){let r=[...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"},i=c=>{let l=c.findIndex(u=>u.id===t);if(l===-1){for(let u of c)if(u.subtasks&&i(u.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,o),true};return i(r),{tasks:r,newTask:o}}function Md(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Md(r.subtasks,t,a)}:r)}function Pd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Pd(a.subtasks,t)}:a)}function Fd(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,i=r?.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},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(i),color:r?.color||"#00E5CC",position:l,parentId:t},u=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,p],isExpanded:true}}return m.subtasks?{...m,subtasks:u(m.subtasks)}:m});return {tasks:u(e),newTask:p}}function og(e,t,a,r){if(t===a)return e;let n=vs(e,t);if(!n)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(n,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,u)=>{let d=l?{...p,position:u}:p;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let i=r!==void 0?r:o.length;o.splice(i,0,{...n,parentId:void 0}),o=o.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],u=r!==void 0?r:p.length,d=[...p];d.splice(u,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...l,subtasks:m,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});o=i(o);}return o}function Zr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Zr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function hl({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:i,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:p,scrollTop:u,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:b,onTaskIndent:h,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:P,onTaskRename:O,onCreateSubtask:N,onOpenTaskModal:S,onDeleteRequest:M,onTaskReparent:T,allTasks:z,scrollContainerRef:$,showCriticalPath:J=false}){let L=react.useContext(ys),[Ae,U]=react.useState(null),[we,R]=react.useState(null),[xe,G]=react.useState(""),Ve=react.useRef(null),[ne,Re]=react.useState(null),[ce,Be]=react.useState(0),[Le,Pe]=react.useState(0),[Oe,dt]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Z,ze]=react.useState(null),[Xe,$e]=react.useState(null),[St,mt]=react.useState(null),gt=react.useRef(0),De=5,ft=react.useRef(false),[Ct,_e]=react.useState(null),[ut,A]=react.useState(false),q=react.useRef(null),[Ce,I]=react.useState(null),[K,ve]=react.useState(null),[Ue,pe]=react.useState(false),tt=react.useRef(null);react.useEffect(()=>{function ie(ge){tt.current&&!tt.current.contains(ge.target)&&pe(false);}if(Ue)return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[Ue]),react.useEffect(()=>{we&&Ve.current&&(Ve.current.focus(),Ve.current.select());},[we]),react.useEffect(()=>{if(!ne)return;let ie=bt=>{let _=bt.clientX-ce,he=Le+_;f?.(ne,he);},ge=()=>{Re(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ge),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ce,Le,f]);let{selectedTaskIds:ht,handleTaskClick:qe,isTaskSelected:wt}=rg(i),{setIsEditing:qt}=tg({tasks:e,selectedTaskIds:ht,onTaskSelect:(ie,ge)=>{let _=Uo(e).map(he=>he.id);qe(ie,_,ge||false,false),o?.(ie);},onTaskCreate:P||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ie=>{let ge=Uo(e).find(bt=>bt.id===ie);ge&&Ft(ge);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:ie=>{let ge=Uo(e).find(bt=>bt.id===ie);ge&&S&&S(ge);},enableKeyboard:true}),Tt=(ie,ge=0,bt="")=>{let _=[],he=[...ie].sort((se,B)=>(se.position??0)-(B.position??0));for(let se=0;se<he.length;se++){let B=he[se],te=se+1,Te=bt?`${bt}.${te}`:`${te}.0`,D=B.wbsCode||Te;if(B.wbsCode=D,_.push({task:B,level:ge}),B.subtasks&&B.subtasks.length>0&&B.isExpanded){let de=B.wbsCode?.replace(/\.0$/,"")||(bt?`${bt}.${te}`:`${te}`);_.push(...Tt(B.subtasks,ge+1,de));}}return _},Pt=Tt(e),_t=48,be=Math.max(Pt.length*a,600-_t),Ee=(ie,ge)=>ge==="assignees"?ie.assignees:ge==="startDate"?ie.startDate:ie.endDate,Qe=(ie,ge,bt,_)=>{ie.preventDefault(),ie.stopPropagation(),I({sourceTaskId:ge,column:bt,sourceIndex:_,targetIndex:_}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let he=ie.currentTarget.closest("[data-grid-body]"),se=st=>{let fe=he?.getBoundingClientRect().top??0,j=Math.floor((st-fe)/a);return j=Math.max(0,Math.min(Pt.length-1,j)),j<_&&(j=_),j},B=ie.clientY,te=$?.current??null,Te=()=>{q.current&&(cancelAnimationFrame(q.current),q.current=null);},D=()=>{let st=se(B);I(fe=>fe&&{...fe,targetIndex:st});},W=()=>{if(Te(),!te)return;let st=te.getBoundingClientRect(),fe=60,j=12,yt=B-st.top,xt=st.bottom-B;if(xt<fe&&te.scrollTop<te.scrollHeight-te.clientHeight){let Xt=Math.max(1,Math.round(j*(1-Math.max(0,xt)/fe))),Qt=()=>{te.scrollTop+=Xt,D(),te.scrollTop<te.scrollHeight-te.clientHeight&&(q.current=requestAnimationFrame(Qt));};q.current=requestAnimationFrame(Qt);}else if(yt<fe&&te.scrollTop>0){let Xt=Math.max(1,Math.round(j*(1-Math.max(0,yt)/fe))),Qt=()=>{te.scrollTop-=Xt,D(),te.scrollTop>0&&(q.current=requestAnimationFrame(Qt));};q.current=requestAnimationFrame(Qt);}},de=st=>{B=st.clientY,D(),W();},ke=st=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",ke),Te(),document.body.style.cursor="",document.body.style.userSelect="",I(null);let fe=se(st.clientY),j=Pt.find(cr=>cr.task.id===ge)?.task;if(!j)return;let yt=Ee(j,bt),xt=Math.min(_,fe),Xt=Math.max(_,fe),Qt=[];for(let cr=xt;cr<=Xt;cr++){if(cr===_)continue;let yr=Pt[cr]?.task;!yr||yr.subtasks&&yr.subtasks.length>0||Qt.push(yr.id);}Qt.length!==0&&b?.(Qt,bt,yt);};window.addEventListener("mousemove",de),window.addEventListener("mouseup",ke);},at=ie=>{if(!Ce)return false;let ge=Math.min(Ce.sourceIndex,Ce.targetIndex),bt=Math.max(Ce.sourceIndex,Ce.targetIndex);return ie>=ge&&ie<=bt},Nt=ie=>!ie.startDate||!ie.endDate?"-":`${Math.ceil((ie.endDate.getTime()-ie.startDate.getTime())/(1e3*60*60*24))}d`,Ft=ie=>{R(ie.id),G(ie.name),qt(true);},kt=ie=>{xe.trim()&&xe!==e.find(ge=>ge.id===ie)?.name&&O?.(ie,xe.trim()),R(null),G(""),qt(false);},Ia=()=>{R(null),G(""),qt(false);},ra=(ie,ge)=>{ge.stopPropagation(),N?.(ie.id);},ir=(ie,ge)=>{ge.preventDefault(),gt.current=ge.clientY,ze(ie),ft.current=false,A(false),_e({x:ge.clientX,y:ge.clientY});},Ye=ie=>{if(!Z||(Math.abs(ie.clientY-gt.current)>De&&!ft.current&&(ft.current=true,A(true)),_e({x:ie.clientX,y:ie.clientY}),!ft.current))return;if($?.current){let se=$.current,B=se.getBoundingClientRect(),te=60,Te=12;q.current&&(cancelAnimationFrame(q.current),q.current=null);let D=ie.clientY-B.top,W=B.bottom-ie.clientY;if(D<te&&se.scrollTop>0){let de=Math.round(Te*(1-D/te)),ke=()=>{se.scrollTop-=de,ft.current&&se.scrollTop>0&&(q.current=requestAnimationFrame(ke));};q.current=requestAnimationFrame(ke);}else if(W<te&&se.scrollTop<se.scrollHeight-se.clientHeight){let de=Math.round(Te*(1-W/te)),ke=()=>{se.scrollTop+=de,ft.current&&se.scrollTop<se.scrollHeight-se.clientHeight&&(q.current=requestAnimationFrame(ke));};q.current=requestAnimationFrame(ke);}}let bt=document.querySelectorAll("[data-task-row]"),_=null,he=null;bt.forEach(se=>{let B=se.getBoundingClientRect(),te=se.getAttribute("data-task-row");if(te&&te!==Z&&ie.clientY>=B.top&&ie.clientY<=B.bottom){_=te;let Te=ie.clientY-B.top,D=B.height;Te<D*.25?he="above":Te>D*.75?he="below":he="child";}}),$e(_),mt(he);},et=()=>{if(ft.current&&Z&&Xe&&St){if(St==="child")T?.(Z,Xe);else if(St==="above"||St==="below"){let ie=(se,B,te=null)=>{for(let Te of se){if(Te.id===B)return te;if(Te.subtasks){let D=ie(Te.subtasks,B,Te.id);if(D!==void 0)return D}}},ge=z&&z.length>0?z:e,bt=ie(ge,Z,null),_=ie(ge,Xe,null),he=(se,B,te,Te)=>{let D=se.findIndex(ke=>ke.id===B),W=Te?se.findIndex(ke=>ke.id===te):-1,de=St==="below"?D+1:D;return Te&&W!==-1&&W<D&&(de-=1),Math.max(0,de)};if(_===null){let B=he(ge,Xe,Z,bt===null);T?.(Z,null,B);}else {let se=vs(ge,_);if(se?.subtasks){let B=bt===_,te=he(se.subtasks,Xe,Z,B);T?.(Z,_,te);}}}}q.current&&(cancelAnimationFrame(q.current),q.current=null),ze(null),$e(null),mt(null),_e(null),ft.current=false,A(false);};react.useEffect(()=>{if(Z)return document.addEventListener("mousemove",Ye),document.addEventListener("mouseup",et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ye),document.removeEventListener("mouseup",et),document.body.style.cursor="",document.body.style.userSelect="";}},[Z,Xe,St]);let Ra=(ie,ge,bt)=>{let _=ge.subtasks&&ge.subtasks.length>0;switch(ie.id){case "name":let he=we===ge.id,se=Ae===ge.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${bt*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:se?1:.3},onMouseDown:j=>ir(ge.id,j),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ge.subtasks&&ge.subtasks.length>0?jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),p?.(ge.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ge.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"}),he?jsxRuntime.jsx("input",{ref:Ve,type:"text",value:xe,onChange:j=>G(j.target.value),onKeyDown:j=>{j.key==="Enter"?kt(ge.id):j.key==="Escape"&&Ia();},onBlur:()=>kt(ge.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:j=>j.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ge.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ge.parentId?"13px":"14px",fontWeight:ge.isMilestone?600:ge.parentId?400:600,letterSpacing:ge.parentId?"0":"-0.01em"},title:ge.name,children:[ge.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ge.wbsCode}),ge.isHighlighted&&ge.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:ge.name}),ge.subtasks&&ge.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(ge.progress||0),"%"]}),J&&ge.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),J&&ge.cpmData&&jsxRuntime.jsxs("span",{style:{color:ge.cpmData.totalFloat<=0?"#EF4444":ge.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ge.cpmData.totalFloat),"d"]})]}),se&&!he&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:j=>j.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:j=>ra(ge,j),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:j=>{j.stopPropagation(),Ft(ge);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let te=ie.id==="startDate"?"startDate":"endDate",Te=ge[te],D=K?.taskId===ge.id&&K?.field===te,W=j=>j?(typeof j=="string"?new Date(j):j).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:j=>j.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:j=>{if(!_)if(D)ve(null);else {let yt=j.currentTarget.getBoundingClientRect();ve({taskId:ge.id,field:te,month:Te?typeof Te=="string"?new Date(Te):Te:new Date,position:{top:yt.bottom+4,left:yt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:W(Te)}),_&&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:K?.position.top,left:K?.position.left},onClick:j=>j.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let j=new Date,yt=new Date(j);yt.setDate(j.getDate()+1);let xt=new Date(j);xt.setDate(j.getDate()+7);let Xt=new Date(j);return Xt.setDate(j.getDate()+14),[{label:"Hoy",date:j},{label:"Ma\xF1ana",date:yt},{label:"Pr\xF3xima semana",date:xt},{label:"2 semanas",date:Xt}].map((cr,yr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Sr=>Sr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Sr=>Sr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(ge.id,{[te]:cr.date}),ve(null);},children:cr.label},yr))})(),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:j=>j.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(ge.id,{[te]: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(j=>j?{...j,month:new Date(j.month.getFullYear(),j.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:K?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ve(j=>j?{...j,month:new Date(j.month.getFullYear(),j.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((j,yt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:j},yt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let j=K?.month||new Date,yt=j.getFullYear(),xt=j.getMonth(),Xt=new Date(yt,xt,1).getDay(),Qt=new Date(yt,xt+1,0).getDate(),cr=new Date,yr=[];for(let ua=Xt-1;ua>=0;ua--)yr.push({day:new Date(yt,xt,-ua).getDate(),date:new Date(yt,xt-1,new Date(yt,xt,-ua).getDate()),isCurrentMonth:false});for(let ua=1;ua<=Qt;ua++)yr.push({day:ua,date:new Date(yt,xt,ua),isCurrentMonth:true});let Sr=42-yr.length;for(let ua=1;ua<=Sr;ua++)yr.push({day:ua,date:new Date(yt,xt+1,ua),isCurrentMonth:false});return yr.map((ua,Qo)=>{let Bn=ua.date.toDateString()===cr.toDateString(),Qn=(Te?typeof Te=="string"?new Date(Te):Te:null)?.toDateString()===ua.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:ua.isCurrentMonth?Qn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Qn?"#00E5CC":"transparent",boxShadow:Bn&&!Qn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(ge.id,{[te]:ua.date}),ve(null);},children:ua.day},Qo)})})()})]})]})]}),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:Nt(ge)})});case "assignees":if(_)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let de=r.filter(j=>ge.assignees?.some(yt=>yt.id?yt.id===j.id:yt.name===j.name||yt.initials===j.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:j=>j.stopPropagation(),children:jsxRuntime.jsx(Fo,{assignedUsers:de,availableUsers:r,onChange:j=>{let yt=j.map(xt=>({id:xt.id,name:xt.name,initials:xt.initials,color:xt.color}));v?.(ge.id,{assignees:yt});}})});case "status":if(_){let j=ge.progress===100?"\u2713":ge.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:j})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:j=>j.stopPropagation(),children:jsxRuntime.jsx(Mp,{status:ge.status||"todo",onChange:j=>{v?.(ge.id,{status:j,progress:j==="completed"?100:ge.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ge.progress}%`,backgroundColor:ge.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:[ge.progress,"%"]})]});case "priority":let ke={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},st={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},fe=ke[ge.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:j=>j.stopPropagation(),children:jsxRuntime.jsx(Mo,{priority:fe,onChange:j=>{j&&v?.(ge.id,{priority:st[j]||"medium"});}})});default:return null}},Ba=ie=>[{id:"hide",label:"Hide Column",icon:ma.Hide,onClick:()=>m(ie),disabled:ie==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ma.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ma.SortDesc,onClick:()=>{}}],lr=ie=>{let ge=ie.subtasks&&ie.subtasks.length>0,bt=Uo(e),_=ht.size>1&&ht.has(ie.id),he=_?bt.filter(D=>ht.has(D.id)):[ie],se=he.map(D=>D.id),B=he.filter(D=>!(D.subtasks&&D.subtasks.length>0)),te=_?` (${se.length})`:"",Te=()=>{M?M(se,ie.name):w?.(se);};return ge?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{N?.(ie.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:ma.Duplicate,onClick:()=>{C?.(se);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+te,icon:ma.Delete,onClick:Te}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{c?.(ie);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{N?.(ie.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+te,icon:ma.MarkIncomplete,onClick:()=>{B.forEach(D=>v?.(D.id,{status:"todo",progress:0}));},disabled:B.length===0||B.every(D=>D.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+te,icon:ma.SetInProgress,onClick:()=>{B.forEach(D=>v?.(D.id,{status:"in-progress"}));},disabled:B.length===0||B.every(D=>D.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+te,icon:ma.MarkComplete,onClick:()=>{B.forEach(D=>v?.(D.id,{status:"completed",progress:100}));},disabled:B.length===0||B.every(D=>D.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:ma.Duplicate,onClick:()=>{C?.(se);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+te,icon:ma.Delete,onClick:Te}]},Na=d.filter(ie=>ie.visible),Rr=Na.reduce((ie,ge)=>ie+ge.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Rr},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${_t}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:Na.map((ie,ge)=>{let bt=ge===Na.length-1,_=ie.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${ie.width}px`,minWidth:`${ie.minWidth??(_?200:60)}px`,maxWidth:`${ie.maxWidth??2e3}px`,flexShrink:_&&Na.length===1?1:0,flexGrow:_&&Na.length===1?1:0,borderRight:bt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:he=>{he.preventDefault(),dt({isOpen:true,x:he.clientX,y:he.clientY,type:"header",columnId:ie.id});},onMouseEnter:he=>{he.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:he=>{he.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:ie.label,children:ie.label}),ie.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:ne===ie.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:he=>{he.preventDefault(),he.stopPropagation(),Re(ie.id),Be(he.clientX),Pe(ie.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:ne===ie.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ie.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(fl,{columns:d,onToggleColumn:m,theme:t}),jsxRuntime.jsx("button",{onClick:()=>pe(!Ue),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"})}),Ue&&jsxRuntime.jsxs("div",{ref:tt,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:ie=>ie.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:()=>pe(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:be},children:Pt.map(({task:ie,level:ge},bt)=>{let _=wt(ie.id),he=at(bt),se=Xe===ie.id,B=se&&St==="above",te=se&&St==="below",Te=se&&St==="child",D={};return Te&&(D.backgroundColor=`${t.accent}15`,D.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ie.id,className:`flex items-center cursor-pointer group ${Z===ie.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Te?`${t.accent}15`:bt%2===0?t.bgPrimary:t.bgGrid,opacity:J?ie.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...D},onMouseEnter:()=>U(ie.id),onMouseLeave:()=>U(null),onClick:W=>{let ke=Uo(e).map(j=>j.id),fe=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;qe(ie.id,ke,fe,W.shiftKey),o?.(ie.id),!fe&&!W.shiftKey&&s?.(ie);},onDoubleClick:W=>{W.stopPropagation(),c?.(ie);},onContextMenu:W=>{W.preventDefault(),dt({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:ie}),l?.(ie,W);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[B&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Na.map((W,de)=>{let ke=de===Na.length-1,st=W.id==="name",fe=!!(ie.subtasks&&ie.subtasks.length>0),j=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,xt=!!j&&!fe&&Ae===ie.id&&!Ce,Xt=he&&!!Ce&&Ce.column===W.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${st?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(st?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:st&&Na.length===1?1:0,flexGrow:st&&Na.length===1?1:0,borderRight:ke?"none":`1px solid ${Ae===ie.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Xt?`${t.accent}22`:void 0,boxShadow:Xt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Ra(W,ie,st?ge:0),xt&&j&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Qt=>Qe(Qt,ie.id,j,bt),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}})]},`${ie.id}-${W.id}`)})]},ie.id)})}),jsxRuntime.jsx(xs,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,items:Oe.type==="header"&&Oe.columnId?Ba(Oe.columnId):Oe.type==="task"&&Oe.task?lr(Oe.task):[],onClose:()=>dt({...Oe,isOpen:false}),theme:t}),ut&&Ct&&Z&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ct.x+12,top:Ct.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ie=Pt.find(ge=>ge.task.id===Z)?.task;return ie?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:ie.name})}):null})()}),document.body)]})}function dg(e,t){let[a,r]=react.useState("none"),[n,s]=react.useState(0),[o,i]=react.useState(e),[c,l]=react.useState(t),[p,u]=react.useState(null),[d,m]=react.useState(null),[f,v]=react.useState(null),[b,h]=react.useState(null),[y,x]=react.useState(0),[w,C]=react.useState(0),[P,O]=react.useState(null),[N,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:u,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:b,setDraggedSegmentIndex:h,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:P,setHoveredSegmentIndex:O,isHovered:N,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,L)=>{r("none"),u(null),m(null),i(J),l(L),C(0),h(null),x(0);}}}function yl({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:u,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:b,showTaskBarLabels:h=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let C=dg(t,r),P=react.useRef(null),O=react.useRef(false),N=react.useRef(null),S=react.useRef(null),{dragMode:M,setDragMode:T,dragOffset:z,setDragOffset:$,ghostX:J,setGhostX:L,ghostWidth:Ae,setGhostWidth:U,connectionLine:we,setConnectionLine:R,hoveredTaskId:xe,setHoveredTaskId:G,activeZone:Ve,setActiveZone:ne,draggedSegmentIndex:Re,setDraggedSegmentIndex:ce,draggedSegmentStartX:Be,setDraggedSegmentStartX:Le,segmentDragOffsetX:Pe,setSegmentDragOffsetX:Oe,hoveredSegmentIndex:dt,setHoveredSegmentIndex:Z,isHovered:ze,setIsHovered:Xe,isDragging:$e,isResizing:St,isConnecting:mt,resetDragState:gt}=C,De=18,ft=!!n.executionBarBg,Ct=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",_e=ft?3:6,ut=e.subtasks&&e.subtasks.length>0,A=react.useRef(null),[q,Ce]=(()=>{let _=react.useRef(null),[,he]=react.useState(0);return [_.current,se=>{_.current=se,he(B=>B+1);}]})(),I=!!w&&!x&&!ut&&!e.segments&&!!e.startDate&&!!e.endDate,K=e.endDate&&(()=>{let _=new Date;_.setHours(0,0,0,0);let he=new Date(e.endDate);return he.setHours(0,0,0,0),he<_})()&&e.progress<100,ve=y&&e.isCriticalPath,Ue=n.name==="neutral"||n.today==="#1C1917",pe=e.status==="completed"||e.progress===100,tt={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},qe=y&&e.isCriticalPath||K?"#EF4444":e.color?e.color:e.priority&&tt[e.priority]?tt[e.priority]:n.taskBarPrimary,wt=x?"default":$e?mt?"crosshair":St?"ew-resize":"grabbing":"grab",qt=x?"default":"ew-resize",Pt=(_=>_>=80?20:_>=60?15:_>=50?12:10)(r),_t=r<50,be=r<40;react.useEffect(()=>{v&&(!ze||$e||e.segments)&&v(null);},[ze,$e,e.segments,v]);let Ee=_=>_.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Qe=()=>{let _=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${_} day${_!==1?"s":""}`},at=_=>Math.round(_/s)*s,Nt=_=>{let he=Math.round(_/s),se=new Date(o);return se.setDate(se.getDate()+he),se},Ft=(_,he)=>{for(let se of m){if(se.id===e.id)continue;let B=5;if(_>=se.x-B&&_<=se.x+se.width+B&&he>=se.y-B&&he<=se.y+se.height+B)return se.id}return null},kt=react.useCallback((_,he,se)=>{if(x)return;_.preventDefault(),_.stopPropagation();let B=P.current?.ownerSVGElement;if(!B)return;let te=B.createSVGPoint();te.x=_.clientX,te.y=_.clientY;let Te=te.matrixTransform(B.getScreenCTM()?.inverse()),D=se!==void 0?se:t,W=he;if(!W){let de=Te.x-D;_.shiftKey?(W="connect",R({x:t+r,y:a+De/2})):_.ctrlKey||_.metaKey?W="move":_.altKey?W=de<r/2?"resize-start":"resize-end":be?de<r/2?W="move":W="resize-end":_t?de<=Pt/2?W="resize-start":de>=r-Pt/2?W="resize-end":W="move":de<=Pt?W="resize-start":de>=r-Pt?W="resize-end":W="move";}O.current=false,T(W),Xe(false),ne(null),W==="move"?$(Te.x-D):W==="connect"?R({x:t+r,y:a+De/2}):$(0),L(D),U(r);},[t,r,a,De,x]),Ia=react.useCallback(_=>{let he=P.current?.ownerSVGElement;if(!he)return;let se=he.closest(".gantt-timeline-scroll");if(!se)return;let B=se.getBoundingClientRect(),te=60,Te=15,D=0;if(_.clientX<B.left+te){let W=B.left+te-_.clientX;D=-Math.min(Te,W/2);}else if(_.clientX>B.right-te){let W=_.clientX-(B.right-te);D=Math.min(Te,W/2);}return D!==0&&(se.scrollLeft+=D),D!==0},[]),ra=react.useCallback(_=>{if(M==="none")return;O.current=true,S.current=_;let he=P.current?.ownerSVGElement;if(!he)return;if(M==="move"||M==="resize-start"||M==="resize-end"){let te=Ia(_);te&&!N.current?N.current=window.setInterval(()=>{S.current&&(Ia(S.current),ra(S.current));},16):!te&&N.current&&(window.clearInterval(N.current),N.current=null);}let se=he.createSVGPoint();se.x=_.clientX,se.y=_.clientY;let B=se.matrixTransform(he.getScreenCTM()?.inverse());if(M==="connect"){R({x:B.x,y:B.y});let te=Ft(B.x,B.y);G(te);}else if(M==="move"){let te=B.x-z,Te=at(te);L(Te),U(r);let D=Math.round((Te-t)/s);if(f?.(e.id,D,true),e.segments&&e.segments.length>0&&Re!==null){let W=Te-Be;Oe(W);}}else if(M==="resize-start"){let te=B.x,Te=at(te),D=t+r-Te;D>=s&&(L(Te),U(D));}else if(M==="resize-end"){let te=B.x,D=at(te)-t;D>=s&&U(D);}},[M,t,r,s,z,e,at,Re,Be,Ft,G,R,L,U,Oe,f,Ia]),ir=react.useCallback(()=>{if(N.current&&(window.clearInterval(N.current),N.current=null),S.current=null,M!=="none"){if(M==="connect")xe&&d&&d(e,xe),R(null),G(null);else {let _=e.endDate.getTime()-e.startDate.getTime(),he,se,B=true;if(M==="move"){if(he=Nt(J),se=new Date(he.getTime()+_),e.segments&&e.segments.length>0&&Re!==null){let te=Math.round(Pe/s),Te=e.segments.map((ke,st)=>{if(st===Re){let fe=new Date(ke.startDate),j=new Date(ke.endDate);return fe.setDate(fe.getDate()+te),j.setDate(j.getDate()+te),{startDate:fe,endDate:j}}return ke}),D=Te.flatMap(ke=>[ke.startDate,ke.endDate]),W=new Date(Math.min(...D.map(ke=>ke.getTime()))),de=new Date(Math.max(...D.map(ke=>ke.getTime())));u?.({...e,segments:Te},W,de),gt(t,r);return}}else M==="resize-start"?(he=Nt(J),se=e.endDate,he>se&&(console.warn("Invalid date range: start date must be before or equal to end date"),B=false)):M==="resize-end"?(he=e.startDate,se=Nt(J+Ae),se.setDate(se.getDate()-1),se<he&&(console.warn("Invalid date range: end date must be after or equal to start date"),B=false)):B=false;B&&he&&se&&(se.getTime()<he.getTime()?console.warn("Invalid date range: end date cannot be before start date"):u?.(e,he,se));}f?.(e.id,0,false),gt(t,r);}},[M,J,Ae,e,u,xe,d,t,r,s,Nt,Pe,Re,gt,f]);react.useEffect(()=>{if(M==="none")return;let _=se=>{ra(se);},he=()=>{ir();};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",he),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",he),N.current&&(window.clearInterval(N.current),N.current=null);}},[M,ra,ir]);let Ye=$e&&!mt?J:t,et=$e&&!mt?Ae:r,Ra=i.taskClass(e),Ba=24,lr=y?e.isCriticalPath?1:.25:1,Na=react.useCallback(_=>{if(!I)return;_.stopPropagation(),_.preventDefault();let se=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:se,initialPct:e.progress||0},_.currentTarget.setPointerCapture(_.pointerId),Ce(e.progress||0);},[I,e.progress,Ce]),Rr=react.useCallback(_=>{let he=A.current;if(!he)return;let B=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??he.barRect;if(!B||B.width<=0)return;let te=(_.clientX-B.left)/B.width,Te=Math.round(Math.max(0,Math.min(1,te))*100);_.shiftKey&&(Te=Math.round(Te/25)*25),Ce(Te);},[Ce]),ie=react.useCallback(_=>{let he=A.current;if(!he)return;_.stopPropagation(),_.preventDefault();try{_.currentTarget.releasePointerCapture(_.pointerId);}catch{}let se=q;A.current=null,Ce(null),se!=null&&se!==he.initialPct&&w&&w(e,se);},[q,w,e,Ce]),ge=react.useCallback(_=>{_.stopPropagation(),_.preventDefault();},[]),bt=q??(e.progress||0);return jsxRuntime.jsxs("g",{ref:P,"data-task-bar":"true","data-estado":pe?"completed":K?"overdue":"planned","data-resumen":ut?"true":void 0,style:{opacity:lr,transition:"opacity 300ms ease"},onClick:()=>{!$e&&!O.current&&c?.(e),O.current=false;},onDoubleClick:_=>{!$e&&!O.current&&(_.stopPropagation(),l?.(e));},onContextMenu:_=>{_.preventDefault(),p?.(e,_);},onMouseEnter:()=>!$e&&Xe(true),onMouseMove:_=>{v&&ze&&!$e&&!e.segments&&v({task:e,x:t,y:a,width:r,height:De,showBelow:false,mouseX:_.clientX,mouseY:_.clientY});},onMouseLeave:()=>{$e||(Xe(false),ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+Ba,height:De,fill:"transparent",style:{pointerEvents:"all"}}),ze&&!$e&&!_t&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Pt,height:De,fill:Ve==="resize-start"?n.accent:"transparent",opacity:Ve==="resize-start"?.15:0,style:{cursor:qt,pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:_=>kt(_,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Pt,y:a,width:r-Pt*2,height:De,fill:Ve==="move"?n.accent:"transparent",opacity:Ve==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:_=>kt(_,"move")}),jsxRuntime.jsx("rect",{x:t+r-Pt,y:a,width:Pt,height:De,fill:Ve==="resize-end"?n.accent:"transparent",opacity:Ve==="resize-end"?.15:0,style:{cursor:qt,pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:_=>kt(_,"resize-end")})]}),ze&&!$e&&be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:De,fill:Ve==="move"?n.accent:"transparent",opacity:Ve==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:_=>kt(_,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:De,fill:Ve==="resize-end"?n.accent:"transparent",opacity:Ve==="resize-end"?.2:0,style:{cursor:qt,pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:_=>kt(_,"resize-end")}),ze&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+De-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$e&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:J,y:a,width:Ae,height:De,rx:_e,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"}}),b&&e.baselineStartDate&&e.baselineEndDate&&!$e&&(()=>{let _=e.baselineStartDate.getTime(),he=e.baselineEndDate.getTime(),se=o.getTime(),B=864e5,te=(_-se)/B,Te=(he-_)/B,D=te*s,W=Math.max(Te*s,s),de=Ye+et,ke=D+W,st=e.endDate?.getTime()??0,fe=Math.ceil((st-he)/B),j=fe>0,yt=fe<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:D,y:a,width:W,height:De,rx:_e,fill:"none",stroke:Ct?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),j&&de>ke&&jsxRuntime.jsx("rect",{x:ke,y:a,width:de-ke,height:De,rx:0,fill:"#EF4444",opacity:.2}),j&&jsxRuntime.jsxs("text",{x:Math.max(de,ke)+6,y:a+De/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",fe,"d"]}),yt&&jsxRuntime.jsxs("text",{x:de+6,y:a+De/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[fe,"d"]})]})})(),!e.segments&&ft&&ut&&(()=>{let he=a+(De-8)/2,se=4,B=e.progress||0,te=new Date;te.setHours(0,0,0,0);let Te=e.startDate&&te>=e.startDate,D=e.endDate&&(()=>{let j=new Date(e.endDate);return j.setHours(0,0,0,0),te>j})(),W=e.startDate&&te<e.startDate,de=1;if(Te&&e.startDate&&e.endDate&&!W){let j=new Date(e.startDate);j.setHours(0,0,0,0);let yt=new Date(e.endDate);yt.setHours(0,0,0,0);let xt=Math.max(1,(yt.getTime()-j.getTime())/(1e3*60*60*24)),Qt=Math.min((te.getTime()-j.getTime())/(1e3*60*60*24),xt)/xt*100;de=Qt>0?B/Qt:1;}let ke;B>=100?ke="#00E5CC":W?ke="#4B5563":D&&B<100?ke="#EF4444":de>=.95?ke="#22C55E":de>=.8?ke="#F59E0B":ke="#EF4444";let st=Math.max(B/100*et,B>0?se*2:0),fe=et>100&&B>0;return jsxRuntime.jsxs("g",{"data-task-class":Ra,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{"data-parte":"pista",x:Ye,y:he,width:et,height:8,rx:se,fill:"rgba(255,255,255,0.10)"}),B>0&&jsxRuntime.jsx("rect",{"data-parte":"avance",x:Ye,y:he,width:st,height:8,rx:se,fill:ke}),fe&&jsxRuntime.jsxs("text",{x:Ye+st+6,y:he+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(B),"%"]})]})})(),!e.segments&&ft&&!ut&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye,y:a,width:et,height:De,rx:_e,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Ra,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!mt?.15:e.parentId?.6:1,scale:ze&&!$e?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>kt(_),style:{cursor:wt,pointerEvents:"all"}}),!e.segments&&!ft&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye,y:a,width:et,height:De,rx:_e,fill:qe,"data-task-class":Ra,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!mt?.15:e.parentId?.6:ze?.9:.8,scale:ze&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ut?void 0:_=>kt(_),style:{cursor:ut?"default":wt,pointerEvents:"all"}}),ft&&(K||ve)&&!e.segments&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:et,height:De,rx:_e,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),K&&!pe&&!e.segments&&!ut&&jsxRuntime.jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Ye+et+4}, ${a+De/2-6})`,children:[jsxRuntime.jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!e.segments&&bt>0&&!ut&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:Math.max(et*(bt/100),_e*2),height:De,rx:_e,fill:qe,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!ut&&e.progress<100&&(()=>{let _=e.progress>0?et*(e.progress/100):0,he=Ye+_,se=et-_,B=e.progress===0?_e:0,te=e.progress===0?Ye:he,Te=e.progress===0?et:se;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:te,y:a,width:Te,height:De,rx:B,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:te,y:a,width:Te,height:De,rx:B,fill:"none",stroke:qe,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),ft&&!e.segments&&e.progress>0&&e.progress<100&&!ut&&!$e&&q===null&&(()=>{let _=Ye+et*(e.progress/100),he=8,se=e.assignees?.[0];return jsxRuntime.jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:_,cy:a+De/2,r:he,fill:se?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:_,y:a+De/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:se?.initials||se?.name?.charAt(0)?.toUpperCase()||""})]})})(),I&&!$e&&et>=40&&(q!==null||bt<88)&&(()=>{let _=Ye+et*(bt/100),he=a+De/2,se=q!==null,B=se?7:ze?6:5,te=se||ze?1:.35,Te=Ye+et-_,D=Math.max(4,Math.min(12,Te-10)),W=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:_-W,y:he-12,width:W+D,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Na,onPointerMove:Rr,onPointerUp:ie,onPointerCancel:ie,onClick:ge,onDoubleClick:ge,onMouseDown:de=>de.stopPropagation()}),jsxRuntime.jsx("circle",{"data-parte":"asa-avance",cx:_,cy:he,r:B,fill:"#FFFFFF",stroke:qe,strokeWidth:2,opacity:te,style:{pointerEvents:"none",filter:se?`drop-shadow(0 0 4px ${qe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),se&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:_-20,y:he-28,width:40,height:18,rx:4,fill:Ct?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:qe,strokeWidth:1}),jsxRuntime.jsxs("text",{x:_,y:he-16,textAnchor:"middle",dominantBaseline:"central",fill:Ct?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[q,"%"]})]})]})})(),e.segments&&e.segments.map((_,he)=>{let se=(_.startDate.getTime()-o.getTime())/864e5*s,te=(_.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-se+s,Te=$e&&M==="move"&&Re===he,D=dt===he,W=Te?se+Pe:se;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!$e&&Z(he),onMouseLeave:()=>!$e&&Z(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:W,y:a,width:te,height:De,rx:_e,fill:qe,initial:{opacity:0,scale:.95},animate:{opacity:Te||e.parentId?.6:D?.9:.8,scale:D&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:de=>{de.stopPropagation(),ce(he),Le(se),kt(de,void 0,se);},style:{cursor:wt,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:W,y:a,width:te*(e.progress/100),height:De,rx:_e,fill:qe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${he}`)}),Ue&&(K||ve)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ve&&!K&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:et,height:De,rx:_e,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),K&&jsxRuntime.jsx("rect",{x:Ye,y:a,width:et,height:De,rx:_e,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),h&&et>60&&!e.segments&&!(ft&&ut)&&(()=>{let _=i.taskLabel(e),he=typeof _=="string"?_:e.name,se=he.length>Math.floor(et/8)?`${he.substring(0,Math.floor(et/8))}...`:he;return jsxRuntime.jsx("text",{"data-parte":"etiqueta",x:Ye+8,y:a+De/2,dominantBaseline:"middle",fill:pe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pe?"line-through":"none"},children:se})})(),!$e&&!e.segments&&!ut&&e.progress>0&&e.progress<100&&(ft?jsxRuntime.jsxs("text",{x:Ye+et+6,y:a+De/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):et>100?jsxRuntime.jsxs("text",{x:Ye+et-12,y:a+De/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&&et>80&&!$e&&!e.segments&&!(ft&&ut)&&jsxRuntime.jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ye+et-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ye+et-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ze||St)&&!mt&&!e.segments&&!ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ye-2,y:a,width:16,height:De,fill:"transparent",style:{cursor:qt},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:_=>{_.stopPropagation(),kt(_,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye+4,y:a+8,width:3,height:De-16,rx:1.5,fill:Ve==="resize-start"||M==="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:Ye+et-14,y:a,width:16,height:De,fill:"transparent",style:{cursor:qt},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:_=>{_.stopPropagation(),kt(_,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye+et-7,y:a+8,width:3,height:De-16,rx:1.5,fill:Ve==="resize-end"||M==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&!$e&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+De/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:_=>{_.stopPropagation(),kt(_,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+De/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ve==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&we&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+De/2,x2:we.x,y2:we.y,stroke:xe?n.statusCompleted:n.accent,strokeWidth:xe?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:xe?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:we.x,cy:we.y,r:xe?8:6,fill:xe?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),xe&&jsxRuntime.jsx(framerMotion.motion.text,{x:we.x+15,y:we.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:we.x+10},animate:{opacity:1,x:we.x+15},transition:{duration:.2},children:"Connect"})]}),(ze||$e)&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye-1,y:a-1,width:et+2,height:De+2,rx:_e+1,fill:"none",stroke:$e?n.accent:ft?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ft?1:2,opacity:$e||ft?.6:.4,initial:{opacity:0},animate:{opacity:$e||ft?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),St&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:J,y1:0,x2:J,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:J+Ae,y1:0,x2:J+Ae,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&!$e&&!e.segments&&!v&&(()=>{let se=a<100,B=se?a+De+13:a-82-13,te=se?`M ${Ye+et/2-6} ${a+De+3} L ${Ye+et/2} ${a+De+13} L ${Ye+et/2+6} ${a+De+3}`:`M ${Ye+et/2-6} ${a-13} L ${Ye+et/2} ${a-3} L ${Ye+et/2+6} ${a-13}`,Te=B+22,D=B+40,W=B+55,de=B+70,ke=se?B+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:te,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ye+et/2-120,y:B,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:Ye+et/2,y:Te,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:Ye+et/2-110,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ye+et/2-70,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ee(e.startDate)}),jsxRuntime.jsx("text",{x:Ye+et/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ye+et/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ee(e.endDate)}),jsxRuntime.jsx("text",{x:Ye+et/2+10,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ye+et/2+65,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qe()}),jsxRuntime.jsx("text",{x:Ye+et/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ye+et/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:Ye+et/2-110,y:de,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ye+et/2-50,y:de,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(st=>st.name).join(", ").substring(0,30),e.assignees.map(st=>st.name).join(", ").length>30?"...":""]})]}),!se&&jsxRuntime.jsx("text",{x:Ye+et/2,y:ke,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:be?"Left: move \u2022 Right: resize":_t?"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 Ld=260,ks=8,mg=16,Sw=-12;function gg({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:C}=e,P=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,O=x.lastActivity!=null,N=(P?155:105)+(O?28:0),S=w+mg,M=C+Sw-N;S+Ld>window.innerWidth-ks&&(S=w-Ld-mg),S<ks&&(S=ks);let T=M<ks;T&&(M=C+20),M+N>window.innerHeight-ks&&(M=window.innerHeight-ks-N),s({left:S,top:M,showBelow:T});},[e]),!e||!n)return null;let{task:o}=e,i=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},l=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),p=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let M=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${M} d\xEDa${M!==1?"s":""}`:`${M} day${M!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),C=M=>`${M.getFullYear()}-${String(M.getMonth()+1).padStart(2,"0")}-${String(M.getDate()).padStart(2,"0")}`,P=0,O=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),N=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;O.getTime()<=N.getTime();){let M=O.getDay();x[M]&&!w.has(C(O))&&P++,O.setDate(O.getDate()+1);}let S=Math.max(0,P);return a==="es"?`${S} d\xEDa${S!==1?"s":""}`:`${S} day${S!==1?"s":""}`},u=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),C=x%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",b=t.bgSecondary||"#1F2937",h=t.border||"#374151",y=jsxRuntime.jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Ld,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:b,border:`1px solid ${h}`,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(xl,{label:c.start,value:o.startDate?l(o.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(xl,{label:c.duration,value:p(),labelColor:d,valueColor:m}),jsxRuntime.jsx(xl,{label:c.end,value:o.endDate?l(o.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(xl,{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))})]}),i&&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:u(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:u(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:u(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:a==="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 xl({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function ui({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:u,strokeWidthOverride:p,glowFilter:d}){let[,m]=react.useState(false),[f,v]=react.useState(null),b=r-t,h=b>0,y=Math.abs(b)<5,x=20,w=!y&&a<=e,C,P,$=a-e,T=e+$/2;P=T;let S=8;if(o==="squared")if(y)C=`M ${e} ${t} L ${a} ${r}`;else if(w){let ze=e+15,Le=a-x,$e=h?t+20:t-20;P=Le;let Ve=h?1:-1;C=`M ${e} ${t} L ${ze-S} ${t} Q ${ze} ${t} ${ze} ${t+Ve*S} L ${ze} ${$e-Ve*S} Q ${ze} ${$e} ${ze-S} ${$e} L ${Le+S} ${$e} Q ${Le} ${$e} ${Le} ${$e+Ve*S} L ${Le} ${r-Ve*S} Q ${Le} ${r} ${Le+S} ${r} L ${a} ${r}`;}else {P=a-x;let Ne=h?1:-1;C=`M ${e} ${t} L ${P-S} ${t} Q ${P} ${t} ${P} ${t+Ne*S} L ${P} ${r-Ne*S} Q ${P} ${r} ${P+S} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let M=6,N=5,U=`M ${a} ${r} L ${a-M} ${r-N/2} L ${a-M} ${r+N/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)"),A=p||1,Se=n.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),G="#f87171",ve="rgba(248, 113, 113, 0.15)",R=P,ye=(t+r)/2;if(f)if(o==="squared")if(y)R=Math.max(e+10,Math.min(a-10,f.x)),ye=t;else if(w){let Ne=e+15,ze=a-x,Le=h?t+20:t-20,$e=[[e,t,Ne,t],[Ne,t,Ne,Le],[Ne,Le,ze,Le],[ze,Le,ze,r],[ze,r,a,r]],Ve=1/0,oe={x:R,y:ye};for(let je of $e){let et=V(f.x,f.y,je[0],je[1],je[2],je[3]),Re=Math.hypot(f.x-et.x,f.y-et.y);Re<Ve&&(Ve=Re,oe=et);}R=oe.x,ye=oe.y;}else {let Ne=[[e,t,P,t],[P,t,P,r],[P,r,a,r]],ze=1/0,Le={x:R,y:ye};for(let $e of Ne){let Ve=V(f.x,f.y,$e[0],$e[1],$e[2],$e[3]),oe=Math.hypot(f.x-Ve.x,f.y-Ve.y);oe<ze&&(ze=oe,Le=Ve);}R=Le.x,ye=Le.y;}else {let Ne=T,ze=t,Le=T,$e=r,Ve=1/0,oe=R,je=ye;for(let et=0;et<=1;et+=.02){let Re=1-et,ut=Re*Re*Re*e+3*Re*Re*et*Ne+3*Re*et*et*Le+et*et*et*a,Nt=Re*Re*Re*t+3*Re*Re*et*ze+3*Re*et*et*$e+et*et*et*r,lt=Math.hypot(f.x-ut,f.y-Nt);lt<Ve&&(Ve=lt,oe=ut,je=Nt);}R=oe,ye=je;}function V(Ne,ze,Le,$e,Ve,oe){let je=Ve-Le,et=oe-$e,Re=je*je+et*et;if(Re===0)return {x:Le,y:$e};let ut=((Ne-Le)*je+(ze-$e)*et)/Re;return ut=Math.max(0,Math.min(1,ut)),{x:Le+ut*je,y:$e+ut*et}}let Ue=Ne=>{let ze=Ne.currentTarget.ownerSVGElement;if(!ze)return;let Le=ze.getScreenCTM();if(!Le)return;let $e=Le.inverse();v({x:$e.a*Ne.clientX+$e.c*Ne.clientY+$e.e,y:$e.b*Ne.clientX+$e.d*Ne.clientY+$e.f});},ne=()=>{m(false),v(null),c?.(false);},Be=()=>{m(true),c?.(true);},ce=Ne=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ne,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ze=>{ze.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:R,cy:ye,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:R,cy:ye,r:9,fill:ve,stroke:G,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R-3,y1:ye-3,x2:R+3,y2:ye+3,stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R+3,y1:ye-3,x2:R-3,y2:ye+3,stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ne,onMouseMove:Ue,children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:U,fill:Se,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:Se,opacity:.9,style:{pointerEvents:"none"}}),ce({opacity:0,scale:.8})]}):l?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Be,onMouseLeave:ne,onMouseMove:Ue,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:U,fill:Se,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:Se,style:{pointerEvents:"none"}}),ce({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:Be,onMouseLeave:ne,onMouseMove:Ue,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:X,strokeWidth:A,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:U,fill:X,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:X,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Cl({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=react.useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{"data-parte":"rombo",x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Me={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=l=>{l.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,i=new Set,c=l=>{if(!o.has(l)){o.add(l),i.add(l);let u=r.get(l)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(i.has(p))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Me.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Me.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Me.flattenTasks(e),r=[["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(";")||""];r.push(s.join(","));}),r.join(`
131
- `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Me.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Me.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Me.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Me.findTaskById(e,t);return !a||!a.dependencies?[]:Me.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Me.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Me.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Me.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Me.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),n=new a,s=Me.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"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Me.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Me.formatDate(c.startDate):"N/A",c.endDate?Me.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(n,{head:o,body:i,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(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Me.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,i=b=>{if(!s||!b.assignees||b.assignees.length===0)return o;let h=b.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return h.length===0?o:h.reduce((y,x)=>y+x,0)/h.length},c=new Map,l=(b,h="")=>{[...b].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let C=h?`${h}.${w+1}`:`${w+1}`;c.set(x.id,C),x.subtasks?.length&&l(x.subtasks,C);});};l(e);let u=s&&Object.keys(s).length>0||n.some(b=>b._costRate>0),p=n.map(b=>{let h=b.startDate&&b.endDate?Me.calculateDuration(b.startDate,b.endDate):0,y=b.effortMinutes,x=b.timeLoggedMinutes,w=b.soldEffortMinutes,C=typeof y=="number"?+(y/60).toFixed(1):0,P=typeof x=="number"?+(x/60).toFixed(1):0,$=typeof w=="number"?+(w/60).toFixed(1):0,T=b._costRate>0?b._costRate:i(b),S={WBS:c.get(b.id)||"","Task Name":b.name,"Start Date":b.startDate?Me.formatDate(b.startDate):"","End Date":b.endDate?Me.formatDate(b.endDate):"","Duration (days)":h>0?h:"","Progress (%)":b.progress,Status:b.status||"",Assignees:b.assignees?.map(N=>N.name).join(", ")||"","Estimated (h)":C||"","Logged (h)":P||"","Quoted (h)":$||""};u&&(S["$ Estimated"]=C>0&&T>0?Math.round(C*T):"",S["$ Executed"]=P>0&&T>0?Math.round(P*T):"",S["$ Quoted"]=$>0&&T>0?Math.round($*T):"",S["Rate ($/h)"]=T>0?T:"");let M=b.weight;return S["Weight (%)"]=typeof M=="number"&&M>0?M:"",S["Is Milestone"]=b.isMilestone?"Yes":"No",S}),d=a?.projectName||"";if(d||p.length>0){let b=0,h=0,y=0,x=0,w=0,C=0,P=0,$=0,T=n.filter(N=>N.startDate).map(N=>N.startDate.getTime()),S=n.filter(N=>N.endDate).map(N=>N.endDate.getTime());for(let N of p)typeof N["Estimated (h)"]=="number"&&(b+=N["Estimated (h)"]),typeof N["Logged (h)"]=="number"&&(h+=N["Logged (h)"]),typeof N["Quoted (h)"]=="number"&&(y+=N["Quoted (h)"]),u&&(typeof N["$ Estimated"]=="number"&&(x+=N["$ Estimated"]),typeof N["$ Executed"]=="number"&&(w+=N["$ Executed"]),typeof N["$ Quoted"]=="number"&&(C+=N["$ Quoted"])),typeof N["Progress (%)"]=="number"&&(P+=N["Progress (%)"],$++);let M={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":T.length>0?Me.formatDate(new Date(Math.min(...T))):"","End Date":S.length>0?Me.formatDate(new Date(Math.max(...S))):"","Duration (days)":T.length>0&&S.length>0?Me.calculateDuration(new Date(Math.min(...T)),new Date(Math.max(...S))):"","Progress (%)":$>0?Math.round(P/$):0,Status:"",Assignees:"","Estimated (h)":+b.toFixed(1)||"","Logged (h)":+h.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};u&&(M["$ Estimated"]=x||"",M["$ Executed"]=w||"",M["$ Quoted"]=C||"",M["Rate ($/h)"]=""),M["Is Milestone"]="No",p.unshift(M);}let m=r.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=r.utils.book_new();if(r.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let b=new Date,h=x=>String(x).padStart(2,"0");t=`Project_${`${b.getFullYear()}-${h(b.getMonth()+1)}-${h(b.getDate())}_${h(b.getHours())}${h(b.getMinutes())}`}.xlsx`;}r.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Me.flattenTasks(e),n=new Map;r.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=Me.getEarliestStartDate(e)||new Date,i=Me.getLatestEndDate(e)||new Date,c=r.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?Me.calculateDuration(d.startDate,d.endDate):0,b=(d.dependencies||[]).filter(h=>n.has(h)).map(h=>`
130
+ `})]});return reactDom.createPortal(y,document.body)}function xl({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function ui({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:p,strokeWidthOverride:u,glowFilter:d}){let[,m]=react.useState(false),[f,v]=react.useState(null),b=r-t,h=b>0,y=Math.abs(b)<5,x=20,w=!y&&a<=e,C,P,O=a-e,N=e+O/2;P=N;let S=8;if(o==="squared")if(y)C=`M ${e} ${t} L ${a} ${r}`;else if(w){let Le=e+15,Pe=a-x,Oe=h?t+20:t-20;P=Pe;let dt=h?1:-1;C=`M ${e} ${t} L ${Le-S} ${t} Q ${Le} ${t} ${Le} ${t+dt*S} L ${Le} ${Oe-dt*S} Q ${Le} ${Oe} ${Le-S} ${Oe} L ${Pe+S} ${Oe} Q ${Pe} ${Oe} ${Pe} ${Oe+dt*S} L ${Pe} ${r-dt*S} Q ${Pe} ${r} ${Pe+S} ${r} L ${a} ${r}`;}else {P=a-x;let Be=h?1:-1;C=`M ${e} ${t} L ${P-S} ${t} Q ${P} ${t} ${P} ${t+Be*S} L ${P} ${r-Be*S} Q ${P} ${r} ${P+S} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${N} ${t}, ${N} ${r}, ${a} ${r}`;let M=6,T=5,z=`M ${a} ${r} L ${a-M} ${r-T/2} L ${a-M} ${r+T/2} Z`,$=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),J=p||($?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=u||1,Ae=n.dependencyHover||($?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),U="#f87171",we="rgba(248, 113, 113, 0.15)",R=P,xe=(t+r)/2;if(f)if(o==="squared")if(y)R=Math.max(e+10,Math.min(a-10,f.x)),xe=t;else if(w){let Be=e+15,Le=a-x,Pe=h?t+20:t-20,Oe=[[e,t,Be,t],[Be,t,Be,Pe],[Be,Pe,Le,Pe],[Le,Pe,Le,r],[Le,r,a,r]],dt=1/0,Z={x:R,y:xe};for(let ze of Oe){let Xe=G(f.x,f.y,ze[0],ze[1],ze[2],ze[3]),$e=Math.hypot(f.x-Xe.x,f.y-Xe.y);$e<dt&&(dt=$e,Z=Xe);}R=Z.x,xe=Z.y;}else {let Be=[[e,t,P,t],[P,t,P,r],[P,r,a,r]],Le=1/0,Pe={x:R,y:xe};for(let Oe of Be){let dt=G(f.x,f.y,Oe[0],Oe[1],Oe[2],Oe[3]),Z=Math.hypot(f.x-dt.x,f.y-dt.y);Z<Le&&(Le=Z,Pe=dt);}R=Pe.x,xe=Pe.y;}else {let Be=N,Le=t,Pe=N,Oe=r,dt=1/0,Z=R,ze=xe;for(let Xe=0;Xe<=1;Xe+=.02){let $e=1-Xe,St=$e*$e*$e*e+3*$e*$e*Xe*Be+3*$e*Xe*Xe*Pe+Xe*Xe*Xe*a,mt=$e*$e*$e*t+3*$e*$e*Xe*Le+3*$e*Xe*Xe*Oe+Xe*Xe*Xe*r,gt=Math.hypot(f.x-St,f.y-mt);gt<dt&&(dt=gt,Z=St,ze=mt);}R=Z,xe=ze;}function G(Be,Le,Pe,Oe,dt,Z){let ze=dt-Pe,Xe=Z-Oe,$e=ze*ze+Xe*Xe;if($e===0)return {x:Pe,y:Oe};let St=((Be-Pe)*ze+(Le-Oe)*Xe)/$e;return St=Math.max(0,Math.min(1,St)),{x:Pe+St*ze,y:Oe+St*Xe}}let Ve=Be=>{let Le=Be.currentTarget.ownerSVGElement;if(!Le)return;let Pe=Le.getScreenCTM();if(!Pe)return;let Oe=Pe.inverse();v({x:Oe.a*Be.clientX+Oe.c*Be.clientY+Oe.e,y:Oe.b*Be.clientX+Oe.d*Be.clientY+Oe.f});},ne=()=>{m(false),v(null),c?.(false);},Re=()=>{m(true),c?.(true);},ce=Be=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Be,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Le=>{Le.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:R,cy:xe,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:R,cy:xe,r:9,fill:we,stroke:U,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R-3,y1:xe-3,x2:R+3,y2:xe+3,stroke:U,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R+3,y1:xe-3,x2:R-3,y2:xe+3,stroke:U,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ne,onMouseMove:Ve,children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:z,fill:Ae,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:Ae,opacity:.9,style:{pointerEvents:"none"}}),ce({opacity:0,scale:.8})]}):l?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Re,onMouseLeave:ne,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:z,fill:Ae,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:Ae,style:{pointerEvents:"none"}}),ce({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:Re,onMouseLeave:ne,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:J,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:z,fill:J,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:J,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Cl({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=react.useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{"data-parte":"rombo",x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=l=>{l.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&n(p.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,i=new Set,c=l=>{if(!o.has(l)){o.add(l),i.add(l);let p=r.get(l)||[];for(let u of p){if(!o.has(u)&&c(u))return true;if(i.has(u))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Se.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Se.flattenTasks(e),r=[["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(";")||""];r.push(s.join(","));}),r.join(`
131
+ `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Se.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Se.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Se.findTaskById(e,t);return !a||!a.dependencies?[]:Se.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Se.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Se.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Se.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),n=new a,s=Se.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"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Se.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Se.formatDate(c.startDate):"N/A",c.endDate?Se.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(n,{head:o,body:i,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(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Se.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,i=b=>{if(!s||!b.assignees||b.assignees.length===0)return o;let h=b.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return h.length===0?o:h.reduce((y,x)=>y+x,0)/h.length},c=new Map,l=(b,h="")=>{[...b].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let C=h?`${h}.${w+1}`:`${w+1}`;c.set(x.id,C),x.subtasks?.length&&l(x.subtasks,C);});};l(e);let p=s&&Object.keys(s).length>0||n.some(b=>b._costRate>0),u=n.map(b=>{let h=b.startDate&&b.endDate?Se.calculateDuration(b.startDate,b.endDate):0,y=b.effortMinutes,x=b.timeLoggedMinutes,w=b.soldEffortMinutes,C=typeof y=="number"?+(y/60).toFixed(1):0,P=typeof x=="number"?+(x/60).toFixed(1):0,O=typeof w=="number"?+(w/60).toFixed(1):0,N=b._costRate>0?b._costRate:i(b),S={WBS:c.get(b.id)||"","Task Name":b.name,"Start Date":b.startDate?Se.formatDate(b.startDate):"","End Date":b.endDate?Se.formatDate(b.endDate):"","Duration (days)":h>0?h:"","Progress (%)":b.progress,Status:b.status||"",Assignees:b.assignees?.map(T=>T.name).join(", ")||"","Estimated (h)":C||"","Logged (h)":P||"","Quoted (h)":O||""};p&&(S["$ Estimated"]=C>0&&N>0?Math.round(C*N):"",S["$ Executed"]=P>0&&N>0?Math.round(P*N):"",S["$ Quoted"]=O>0&&N>0?Math.round(O*N):"",S["Rate ($/h)"]=N>0?N:"");let M=b.weight;return S["Weight (%)"]=typeof M=="number"&&M>0?M:"",S["Is Milestone"]=b.isMilestone?"Yes":"No",S}),d=a?.projectName||"";if(d||u.length>0){let b=0,h=0,y=0,x=0,w=0,C=0,P=0,O=0,N=n.filter(T=>T.startDate).map(T=>T.startDate.getTime()),S=n.filter(T=>T.endDate).map(T=>T.endDate.getTime());for(let T of u)typeof T["Estimated (h)"]=="number"&&(b+=T["Estimated (h)"]),typeof T["Logged (h)"]=="number"&&(h+=T["Logged (h)"]),typeof T["Quoted (h)"]=="number"&&(y+=T["Quoted (h)"]),p&&(typeof T["$ Estimated"]=="number"&&(x+=T["$ Estimated"]),typeof T["$ Executed"]=="number"&&(w+=T["$ Executed"]),typeof T["$ Quoted"]=="number"&&(C+=T["$ Quoted"])),typeof T["Progress (%)"]=="number"&&(P+=T["Progress (%)"],O++);let M={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":N.length>0?Se.formatDate(new Date(Math.min(...N))):"","End Date":S.length>0?Se.formatDate(new Date(Math.max(...S))):"","Duration (days)":N.length>0&&S.length>0?Se.calculateDuration(new Date(Math.min(...N)),new Date(Math.max(...S))):"","Progress (%)":O>0?Math.round(P/O):0,Status:"",Assignees:"","Estimated (h)":+b.toFixed(1)||"","Logged (h)":+h.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};p&&(M["$ Estimated"]=x||"",M["$ Executed"]=w||"",M["$ Quoted"]=C||"",M["Rate ($/h)"]=""),M["Is Milestone"]="No",u.unshift(M);}let m=r.utils.json_to_sheet(u),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...p?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let v=r.utils.book_new();if(r.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let b=new Date,h=x=>String(x).padStart(2,"0");t=`Project_${`${b.getFullYear()}-${h(b.getMonth()+1)}-${h(b.getDate())}_${h(b.getHours())}${h(b.getMinutes())}`}.xlsx`;}r.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Se.flattenTasks(e),n=new Map;r.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=Se.getEarliestStartDate(e)||new Date,i=Se.getLatestEndDate(e)||new Date,c=r.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?Se.calculateDuration(d.startDate,d.endDate):0,b=(d.dependencies||[]).filter(h=>n.has(h)).map(h=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${n.get(h)}</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([l],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Me.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,n=l=>{if(r.has(l.id))return;let u=l.startDate&&l.endDate?Me.calculateDuration(l.startDate,l.endDate):0,p=0;if(l.dependencies&&l.dependencies.length>0)for(let m of l.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;r.set(l.id,{es:p,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),o=new Map,i=l=>{if(o.has(l.id))return;let u=l.startDate&&l.endDate?Me.calculateDuration(l.startDate,l.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(l.id)),d=s;if(p.length>0)for(let f of p){i(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(l.id,{ls:m,lf:d});};a.forEach(i);let c=[];for(let l of a){let u=r.get(l.id),p=o.get(l.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Me.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)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 r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let i=new Map,c=[],l=[];for(let d of r)(o.get(d.id)||0)===0&&l.push(d.id);for(;l.length>0;){let d=l.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Me.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let h of m.dependencies){let y=i.get(h);y&&(v=Math.max(v,y.ef));}i.set(d,{es:v,ef:v+f});let b=s.get(d)||[];for(let h of b){let y=(o.get(h)||1)-1;o.set(h,y),y===0&&l.push(h);}}if(c.length<r.length)return t;let u=Math.max(...Array.from(i.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=Me.calculateDuration(f.startDate,f.endDate),b=s.get(m)||[],h=u;if(b.length>0)for(let y of b){let x=p.get(y);x&&(h=Math.min(h,x.ls));}p.set(m,{ls:h-v,lf:h});}for(let d of c){let m=i.get(d),f=p.get(d),v=f.ls-m.es,b=s.get(d)||[],h;b.length>0?h=Math.min(...b.map(y=>i.get(y).es))-m.ef:h=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(h*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Me.calculateCriticalPath(e).includes(t))return 0;let n=Me.getDependentTasks(e,t);if(n.length===0){let i=Me.getLatestEndDate(e);if(!i)return null;let c=Me.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=n.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let o=Me.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Me.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Me.getDependentTasks(e,t);if(o.length===0)return e;let i=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let l=Me.calculateDuration(c.startDate,c.endDate),u;if(a!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Me.calculateEndDate(u,l),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);i=d(i),i=Me.autoScheduleDependents(i,c.id,a,n);}return i},calculateCascadePreview:(e,t,a,r,n,s,o,i)=>{if(a===0)return [];let c=[],l=n.getTime(),u=1e3*60*60*24,p=Me.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let b=Me.getDependentTasks(e,m);for(let h of b){if(!h.startDate||!h.endDate)continue;let y=r.findIndex(N=>N.id===h.id);if(y===-1)continue;let x=h.startDate.getTime(),C=(h.endDate.getTime()-x)/u,$=(x-l)/u*s,T=$+f*s,S=Math.max(C*s,s),M=i+y*o+(o-18)/2;c.push({taskId:h.id,taskName:h.name,originalX:$,previewX:T,width:S,y:M,rowIndex:y,daysDelta:f,color:h.color}),d(h.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=Me.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let i=new Date(n.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:i}],l=u=>u.map(p=>p.id===n.id?{...p,endDate:i,segments:c}:p.subtasks?{...p,subtasks:l(p.subtasks)}:p);return l(e)}};function Tl({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:b,showBaseline:h,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:C="number",canEditTask:P,onTaskProgressDrag:$,workingDaysConfig:T}){let M=Xr(),N=react.useRef(null),[U,O]=react.useState([]),[X,A]=react.useState(null),[Se,G]=react.useState(null),[ve,R]=react.useState(null),ye=react.useRef(false),[V,Ue]=react.useState(new Set),[ne,Be]=react.useState(null),ce=react.useCallback(I=>{if(ve&&!ye.current){let K=I.target,we=false;for(;K&&K!==I.currentTarget;){if(K.getAttribute?.("data-dependency-line")==="true"||K.getAttribute?.("data-dependency-hover-overlay")==="true"){we=true;break}K=K.parentElement;}we||R(null);}},[ve]),Ne=react.useCallback(I=>{G(I);},[]),ze=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Le=r==="day"?60:r==="week"?20:8,$e=ze*Le*o,Ve=I=>{let K=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),we=K.getUTCDay()||7;K.setUTCDate(K.getUTCDate()+4-we);let Ge=new Date(Date.UTC(K.getUTCFullYear(),0,1));return Math.ceil(((K.getTime()-Ge.getTime())/864e5+1)/7)},oe=I=>{let K=I.getDay();return K===0||K===6},je=react.useMemo(()=>{let I=T?.holidayDates;return I?I instanceof Set?I:new Set(I):null},[T?.holidayDates]),et=I=>{if(!je)return false;let K=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-${String(I.getDate()).padStart(2,"0")}`;return je.has(K)},Re=react.useCallback(I=>{let K=Math.round(I/(Le*o)),we=new Date(n);return we.setDate(we.getDate()+K),we},[n,Le,o]),ut=react.useCallback((I,K)=>{if(K.startDate&&K.endDate)return;let we=I.currentTarget.ownerSVGElement;if(!we)return;let Ge=we.createSVGPoint();Ge.x=I.clientX,Ge.y=I.clientY;let pe=Ge.matrixTransform(we.getScreenCTM()?.inverse()),rt=Re(pe.x),bt=new Date(rt);bt.setDate(bt.getDate()+1),Be(null),f?.(K,rt,bt);},[Re,f]),Nt=react.useCallback((I,K,we)=>{let Ge=I.currentTarget.ownerSVGElement;if(!Ge)return;let pe=Ge.createSVGPoint();pe.x=I.clientX,pe.y=I.clientY;let rt=pe.matrixTransform(Ge.getScreenCTM()?.inverse()),bt=Re(rt.x),ht=Math.round(rt.x/(Le*o))*Le*o;Be({taskId:K.id,x:ht,y:we*a+a/2,date:bt});},[Re,Le,o,a]),lt=react.useCallback(()=>{Be(null);},[]),Ee=react.useMemo(()=>{let I=pe=>pe.map(rt=>{if(rt.subtasks&&rt.subtasks.length>0){let bt=I(rt.subtasks),qe=bt.filter(ht=>ht.startDate&&ht.endDate);if(qe.length>0){let ht=qe.map(De=>De.startDate.getTime()),Yt=qe.map(De=>De.endDate.getTime()),kt=new Date(Math.min(...ht)),de=new Date(Math.max(...Yt));return {...rt,subtasks:bt,startDate:kt,endDate:de}}return {...rt,subtasks:bt}}return rt}),K=(pe,rt=[])=>{let bt=[...pe].sort((qe,ht)=>(qe.position??0)-(ht.position??0));for(let qe of bt)rt.push(qe),qe.subtasks&&qe.subtasks.length>0&&(qe.isExpanded===void 0||qe.isExpanded)&&K(qe.subtasks,rt);return rt},we=I(e);return K(we)},[e]),ct=react.useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let K=I.startDate.getTime(),we=I.endDate.getTime(),Ge=n.getTime(),pe=(K-Ge)/(1e3*60*60*24),rt=(we-K)/(1e3*60*60*24)+1,bt=pe*Le*o,qe=Math.max(Le*o,40),ht=Math.max(rt*Le*o,qe);return {x:bt,width:ht}},[n,Le,o]),xt=react.useMemo(()=>Ee.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:K,width:we}=ct(I),pe=Ee.findIndex(rt=>rt.id===I.id)*a+(a-18)/2;return {id:I.id,x:K,y:pe,width:we,height:18}}),[Ee,ct]),Ke=react.useCallback((I,K,we)=>{if(!we){O([]),A(null);return}if(A({taskId:I,daysDelta:K}),K===0){O([]);return}let Ge=Me.calculateCascadePreview(e,I,K,Ee,n,Le*o,a,48);O(Ge);},[e,Ee,n,Le,o,a,48]),st=react.useCallback((I,K)=>{if(!X)return K;let we=Le*o,Ge=X.daysDelta*we;if(I===X.taskId)return {x:K.x+Ge,width:K.width};let pe=U.find(rt=>rt.taskId===I);return pe?{x:pe.previewX,width:pe.width}:K},[X,U,Le,o]),L=react.useMemo(()=>{let I=[],K=new Date(n);for(;K<=s;){let pe=(K.getTime()-n.getTime())/864e5*Le*o;if(r==="day")I.push({date:new Date(K),label:K.toLocaleDateString(i,{day:"numeric",month:"short"}),x:pe}),K.setDate(K.getDate()+1);else if(r==="week"){let rt=Ve(K);I.push({date:new Date(K),label:C==="range"?(()=>{let bt=new Date(K);bt.setDate(bt.getDate()+6);let qe=ht=>ht.toLocaleDateString(i,{month:"short"});return qe(K)===qe(bt)?`${qe(K)} ${K.getDate()}\u2013${bt.getDate()}`:`${qe(K)} ${K.getDate()}\u2013${qe(bt)} ${bt.getDate()}`})():`${M.labels.week} ${rt}`,x:pe}),K.setDate(K.getDate()+7);}else I.push({date:new Date(K),label:K.toLocaleDateString(i,{month:"short",year:"numeric"}),x:pe}),K.setMonth(K.getMonth()+1);}return I},[n,s,r,Le,o,i,M.labels.week,C]),J=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Le*o,[n,Le,o]),Ce=Math.max(Ee.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,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}),L.map((I,K)=>jsxRuntime.jsxs("g",{children:[K>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:r==="day"&&!oe(I.date)&&et(I.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${K}`)),J>=0&&J<=$e&&jsxRuntime.jsxs("g",{"data-hoy":"cabecera",children:[jsxRuntime.jsx("circle",{cx:J,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:J,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${J-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:M.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:N,width:Math.max($e,1e3),height:Ce,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:ce,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:Ce,fill:t.bgPrimary}),Ee.map((I,K)=>jsxRuntime.jsx("rect",{x:0,y:K*a,width:Math.max($e,1e3),height:a,fill:K%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${I.id}`)),L.map((I,K)=>K>0?jsxRuntime.jsx("line",{x1:I.x,y1:0,x2:I.x,y2:Ee.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${K}`):null),L.map((I,K)=>{let we=L[K+1]?.x||$e,Ge=w&&oe(I.date),pe=r==="day"&&!oe(I.date)&&et(I.date);return Ge||pe?jsxRuntime.jsxs("g",{"data-finde":"true",children:[jsxRuntime.jsx("rect",{x:I.x,y:0,width:we-I.x,height:Ee.length*a,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:we-I.x,height:Ee.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${K}`):null}),Ee.map((I,K)=>{let we=I.startDate&&I.endDate;return jsxRuntime.jsx("g",{children:!we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:K*a,width:$e,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ge=>ut(Ge,I),onMouseMove:Ge=>Nt(Ge,I,K),onMouseLeave:()=>{lt();}},`clickable-${I.id}`),ne&&ne.taskId===I.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:ne.x,y1:K*a+4,x2:ne.x,y2:K*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:ne.x,cy:ne.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:ne.x,cy:ne.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${ne.x}, ${K*a-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:ne.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!ne||ne.taskId!==I.id)&&jsxRuntime.jsx("text",{x:J>0?J:100,y:K*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:M.labels.clickToSetDates},`placeholder-${I.id}`)]})},`row-group-${I.id}`)}),Ee.map((I,K)=>{if(!I.startDate||!I.endDate)return null;let{x:we,width:Ge}=ct(I),pe=K*a+(a-18)/2,rt=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;if(I.isMilestone)return jsxRuntime.jsx(Cl,{task:I,x:we+Ge/2,y:pe+12,theme:t,onClick:p},I.id);if(rt){let bt=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),qe=8,ht=pe+(a-18)/2+(18-qe)/2,Yt=4,kt=I.progress||0,de=new Date;de.setHours(0,0,0,0);let De=I.startDate&&de>=I.startDate,tt=I.endDate&&(()=>{let fa=new Date(I.endDate);return fa.setHours(0,0,0,0),de>fa})(),Bt=I.startDate&&de<I.startDate,Wt=1;if(De&&I.startDate&&I.endDate&&!Bt){let fa=new Date(I.startDate);fa.setHours(0,0,0,0);let hr=new Date(I.endDate);hr.setHours(0,0,0,0);let Ye=Math.max(1,(hr.getTime()-fa.getTime())/(1e3*60*60*24)),Aa=Math.min((de.getTime()-fa.getTime())/(1e3*60*60*24),Ye)/Ye*100;Wt=Aa>0?kt/Aa:1;}let Qe;kt>=100?Qe="#00E5CC":Bt?Qe="#4B5563":tt&&kt<100?Qe="#EF4444":Wt>=.95?Qe="#22C55E":Wt>=.8?Qe="#F59E0B":Qe="#EF4444";let vt=Math.max(kt/100*Ge,kt>0?Yt*2:0),xa=Ge>100&&kt>0,At=I.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>p?.(I),onContextMenu:fa=>{fa.preventDefault(),fa.stopPropagation(),m?.(I,fa);},onMouseMove:fa=>{Ne({task:I,x:we,y:ht,width:Ge,height:qe,showBelow:ht<100,mouseX:fa.clientX,mouseY:fa.clientY});},onMouseLeave:()=>Ne(null),style:{cursor:"default",opacity:y?At?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":kt>=100?"completed":tt?"overdue":"planned",children:[jsxRuntime.jsx("rect",{x:we,y:pe,width:Ge,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:we,y:ht,width:Ge,height:qe,rx:Yt,fill:bt?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),kt>0&&jsxRuntime.jsx("rect",{x:we,y:ht,width:vt,height:qe,rx:Yt,fill:Qe,"data-parte":"avance"}),y&&At&&jsxRuntime.jsx("rect",{x:we,y:ht,width:Ge,height:qe,rx:Yt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),xa&&jsxRuntime.jsxs("text",{x:we+vt+6,y:ht+qe/2,dominantBaseline:"central",fill:bt?"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(kt),"%"]})]},I.id)}return jsxRuntime.jsx(yl,{task:I,x:we,y:pe,width:Ge,theme:t,dayWidth:Le*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:xt,onDragMove:Ke,onHoverChange:Ne,showBaseline:h,showTaskBarLabels:u,showCriticalPath:y,readOnly:P?!P(I):false,onProgressChange:$},I.id)}),x&&Ee.map((I,K)=>!I.dependencies||I.dependencies.length===0||!I.startDate||!I.endDate?null:I.dependencies.map(we=>{let Ge=Ee.find(Qe=>Qe.id===we);if(!Ge||!Ge.startDate||!Ge.endDate)return null;let pe=Ee.findIndex(Qe=>Qe.id===we),rt=st(Ge.id,ct(Ge)),bt=st(I.id,ct(I)),qe=rt.x+rt.width,ht=pe*a+26,Yt=bt.x,kt=K*a+26,de=`dep-${we}-${I.id}`;if(V.has(de))return null;let De=y&&I.isCriticalPath&&Ge.isCriticalPath;return jsxRuntime.jsx(ui,{x1:qe,y1:ht,x2:Yt,y2:kt,theme:t,lineStyle:l,colorOverride:y?De?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?De?2:1:void 0,glowFilter:De?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>b?.(I.id,we),onHoverChange:Qe=>{ye.current=Qe,Qe&&R({key:de,fromId:we,toId:I.id,exitX:qe,exitY:ht,enterX:Yt,enterY:kt});}},de)})),U.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&&ve&&jsxRuntime.jsx(ui,{x1:ve.exitX,y1:ve.exitY,x2:ve.enterX,y2:ve.enterY,theme:t,lineStyle:l,onDelete:()=>{let I=ve.key;R(null),ye.current=false,Ue(K=>new Set(K).add(I)),b?.(ve.toId,ve.fromId);},hoverOverlayOnly:true,onHoverChange:I=>{ye.current=I,I||R(null);}},`${ve.key}-hover-overlay`),J>=0&&J<=$e&&jsxRuntime.jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:J,y1:0,x2:J,y2:Ce,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:J,y1:0,x2:J,y2:Ce,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Se&&jsxRuntime.jsx(gg,{tooltipData:Se,theme:t,locale:i==="es"?"es":"en",workingDaysConfig:T})]})}var Fw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],hg=({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"})}),Lw=()=>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"})}),Aw=()=>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"})}),Iw=()=>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"})}),Rw=()=>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 Sl({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:i,onDependencyDelete:c}){let[l,u]=react.useState(false),[p,d]=react.useState(false),[m,f]=react.useState([]),[v,b]=react.useState(""),[h,y]=react.useState(false),[x,w]=react.useState(true),[C,P]=react.useState(""),[$,T]=react.useState(-1),[S,M]=react.useState(false),[N,U]=react.useState(0),O=react.useRef(null),X=react.useRef(null),A=react.useRef(null),Se=react.useRef(null),{enabled:G=true,placeholder:ve='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:ye,suggestions:V=Fw,maxHistory:Ue=50,persistHistory:ne,mentionableUsers:Be=[]}=a,ce=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ne=ce?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ze=ce?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Le=ce?"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)",$e=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ve=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",oe=ce?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",je=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",et=ce?"rgba(0, 229, 204, 0.9)":"#00E5CC",Re=ce?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ut=ce?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Nt=ce?"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)",lt=ce?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ee=ce?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",ct=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",xt=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ke=ce?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",st=ce?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=ce?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",J=ce?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",Ce=ce?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",I="rgba(0, 229, 204, 0.04)",K=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",we=ce?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ge=ce?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",pe=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",rt=ce?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",bt=ce?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",qe=ce?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ht=ce?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Yt="rgba(0, 229, 204, 0.06)",kt=ce?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",de=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",De=ce?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",tt=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Bt=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Wt=ce?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Qe=ce?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",vt=ce?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",xa=ce?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",At=ce?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",er=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",fa=ce?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",hr=ce?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ye=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ze=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Aa=ne?.storageKey||"gantt-ai-history",Ia=ne?.maxMessages??5,sr=Be.filter(B=>{if(!C)return true;let Z=C.toLowerCase();return B.name.toLowerCase().includes(Z)||B.email&&B.email.toLowerCase().includes(Z)}).slice(0,5),Ta=react.useCallback(B=>{if(b(B),Be.length===0)return;let Z=O.current;if(!Z)return;let Te=Z.selectionStart||B.length,D=B.slice(0,Te),W=D.lastIndexOf("@");if(W>=0&&((W>0?D[W-1]:" ")===" "||W===0)){let ke=D.slice(W+1);if(ke.length<=40){P(ke),T(W),M(true),U(0);return}}M(false),P(""),T(-1);},[Be.length]),Rr=react.useCallback(B=>{let Z=v.slice(0,$),Te=v.slice($+1+C.length),D=`${Z}@${B.name} ${Te}`;b(D),M(false),P(""),T(-1),setTimeout(()=>O.current?.focus(),0);},[v,$,C]),ie=react.useCallback(B=>{if(!S||sr.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),U(Z=>Z<sr.length-1?Z+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),U(Z=>Z>0?Z-1:sr.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let Z=sr[N];return Z&&Rr(Z),true}return B.key==="Escape"?(M(false),true):false},[S,sr,N,Rr]);react.useEffect(()=>{if(ne?.enabled)try{let B=localStorage.getItem(Aa);if(B){let Te=JSON.parse(B).map(D=>({...D,timestamp:new Date(D.timestamp)}));f(Te.slice(-Ia));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[ne?.enabled,Aa,Ia]),react.useEffect(()=>{if(ne?.enabled&&m.length>0)try{let B=m.filter(Z=>!Z.isLoading).slice(-Ia);localStorage.setItem(Aa,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[m,ne?.enabled,Aa,Ia]),react.useEffect(()=>{X.current&&X.current.scrollIntoView({behavior:"smooth"});},[m]),react.useEffect(()=>{l&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,p]);let fe=react.useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&n?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&o?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[n,s,o,i,c]),pt=react.useCallback(async B=>{if(!B.trim()||h)return;let Z={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};f(D=>[...D.slice(-(Ue-1)),Z]),b(""),w(false),y(true);let Te={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(D=>[...D,Te]);try{if(ye){let D=m.filter(ue=>!ue.isLoading&&ue.content).slice(-6).map(ue=>({role:ue.role,content:ue.content})),W=await ye(B,e,D);f(ue=>{let ke=ue.filter(be=>!be.isLoading),ot={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...ke,ot]}),fe(W);}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(W=>[...W.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);}},[h,Ue,ye,e,fe]),j=B=>{B.preventDefault(),pt(v);},he=B=>{b(B),O.current?.focus();};if(react.useEffect(()=>{let B=Z=>{(Z.metaKey||Z.ctrlKey)&&Z.key==="k"&&(Z.preventDefault(),u(Te=>!Te),l||d(false)),Z.key==="Escape"&&l&&u(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),react.useEffect(()=>{if(!l)return;let B=Te=>{let D=Te.target;A.current&&!A.current.contains(D)&&u(false);},Z=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(Z),document.removeEventListener("mousedown",B);}},[l]),!G)return null;let re={"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(ma,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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 ${re[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ne,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ze}`,color:"#00E5CC",cursor:"pointer",boxShadow:Le,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${$e}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Ve}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(hg,{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:et,background:oe,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${je}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
361
+ </Project>`,p=new Blob([l],{type:"application/xml;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(p),u.download=a,u.click(),URL.revokeObjectURL(u.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,n=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Se.calculateDuration(l.startDate,l.endDate):0,u=0;if(l.dependencies&&l.dependencies.length>0)for(let m of l.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;u=Math.max(u,v);}}let d=u+p;r.set(l.id,{es:u,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),o=new Map,i=l=>{if(o.has(l.id))return;let p=l.startDate&&l.endDate?Se.calculateDuration(l.startDate,l.endDate):0,u=t.filter(f=>f.dependencies&&f.dependencies.includes(l.id)),d=s;if(u.length>0)for(let f of u){i(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-p;o.set(l.id,{ls:m,lf:d});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),u=o.get(l.id);if(p&&u){let d=u.ls-p.es;Math.abs(d)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)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 r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let i=new Map,c=[],l=[];for(let d of r)(o.get(d.id)||0)===0&&l.push(d.id);for(;l.length>0;){let d=l.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Se.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let h of m.dependencies){let y=i.get(h);y&&(v=Math.max(v,y.ef));}i.set(d,{es:v,ef:v+f});let b=s.get(d)||[];for(let h of b){let y=(o.get(h)||1)-1;o.set(h,y),y===0&&l.push(h);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(d=>d.ef)),u=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=Se.calculateDuration(f.startDate,f.endDate),b=s.get(m)||[],h=p;if(b.length>0)for(let y of b){let x=u.get(y);x&&(h=Math.min(h,x.ls));}u.set(m,{ls:h-v,lf:h});}for(let d of c){let m=i.get(d),f=u.get(d),v=f.ls-m.es,b=s.get(d)||[],h;b.length>0?h=Math.min(...b.map(y=>i.get(y).es))-m.ef:h=p-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(h*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let n=Se.getDependentTasks(e,t);if(n.length===0){let i=Se.getLatestEndDate(e);if(!i)return null;let c=Se.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=n.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let o=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Se.getDependentTasks(e,t);if(o.length===0)return e;let i=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let l=Se.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),p<f&&(p=f);}let u=Se.calculateEndDate(p,l),d=m=>m.map(f=>f.id===c.id?{...f,startDate:p,endDate:u}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);i=d(i),i=Se.autoScheduleDependents(i,c.id,a,n);}return i},calculateCascadePreview:(e,t,a,r,n,s,o,i)=>{if(a===0)return [];let c=[],l=n.getTime(),p=1e3*60*60*24,u=Se.findTaskById(e,t);if(!u||!u.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let b=Se.getDependentTasks(e,m);for(let h of b){if(!h.startDate||!h.endDate)continue;let y=r.findIndex(T=>T.id===h.id);if(y===-1)continue;let x=h.startDate.getTime(),C=(h.endDate.getTime()-x)/p,O=(x-l)/p*s,N=O+f*s,S=Math.max(C*s,s),M=i+y*o+(o-18)/2;c.push({taskId:h.id,taskName:h.name,originalX:O,previewX:N,width:S,y:M,rowIndex:y,daysDelta:f,color:h.color}),d(h.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=Se.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let i=new Date(n.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:i}],l=p=>p.map(u=>u.id===n.id?{...u,endDate:i,segments:c}:u.subtasks?{...u,subtasks:l(u.subtasks)}:u);return l(e)}};function Tl({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:u,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:b,showBaseline:h,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:C="number",canEditTask:P,onTaskProgressDrag:O,workingDaysConfig:N}){let M=Hr(),T=react.useRef(null),[z,$]=react.useState([]),[J,L]=react.useState(null),[Ae,U]=react.useState(null),[we,R]=react.useState(null),xe=react.useRef(false),[G,Ve]=react.useState(new Set),[ne,Re]=react.useState(null),ce=react.useCallback(I=>{if(we&&!xe.current){let K=I.target,ve=false;for(;K&&K!==I.currentTarget;){if(K.getAttribute?.("data-dependency-line")==="true"||K.getAttribute?.("data-dependency-hover-overlay")==="true"){ve=true;break}K=K.parentElement;}ve||R(null);}},[we]),Be=react.useCallback(I=>{U(I);},[]),Le=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Pe=r==="day"?60:r==="week"?20:8,Oe=Le*Pe*o,dt=I=>{let K=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),ve=K.getUTCDay()||7;K.setUTCDate(K.getUTCDate()+4-ve);let Ue=new Date(Date.UTC(K.getUTCFullYear(),0,1));return Math.ceil(((K.getTime()-Ue.getTime())/864e5+1)/7)},Z=I=>{let K=I.getDay();return K===0||K===6},ze=react.useMemo(()=>{let I=N?.holidayDates;return I?I instanceof Set?I:new Set(I):null},[N?.holidayDates]),Xe=I=>{if(!ze)return false;let K=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-${String(I.getDate()).padStart(2,"0")}`;return ze.has(K)},$e=react.useCallback(I=>{let K=Math.round(I/(Pe*o)),ve=new Date(n);return ve.setDate(ve.getDate()+K),ve},[n,Pe,o]),St=react.useCallback((I,K)=>{if(K.startDate&&K.endDate)return;let ve=I.currentTarget.ownerSVGElement;if(!ve)return;let Ue=ve.createSVGPoint();Ue.x=I.clientX,Ue.y=I.clientY;let pe=Ue.matrixTransform(ve.getScreenCTM()?.inverse()),tt=$e(pe.x),ht=new Date(tt);ht.setDate(ht.getDate()+1),Re(null),f?.(K,tt,ht);},[$e,f]),mt=react.useCallback((I,K,ve)=>{let Ue=I.currentTarget.ownerSVGElement;if(!Ue)return;let pe=Ue.createSVGPoint();pe.x=I.clientX,pe.y=I.clientY;let tt=pe.matrixTransform(Ue.getScreenCTM()?.inverse()),ht=$e(tt.x),wt=Math.round(tt.x/(Pe*o))*Pe*o;Re({taskId:K.id,x:wt,y:ve*a+a/2,date:ht});},[$e,Pe,o,a]),gt=react.useCallback(()=>{Re(null);},[]),De=react.useMemo(()=>{let I=pe=>pe.map(tt=>{if(tt.subtasks&&tt.subtasks.length>0){let ht=I(tt.subtasks),qe=ht.filter(wt=>wt.startDate&&wt.endDate);if(qe.length>0){let wt=qe.map(_t=>_t.startDate.getTime()),qt=qe.map(_t=>_t.endDate.getTime()),Tt=new Date(Math.min(...wt)),Pt=new Date(Math.max(...qt));return {...tt,subtasks:ht,startDate:Tt,endDate:Pt}}return {...tt,subtasks:ht}}return tt}),K=(pe,tt=[])=>{let ht=[...pe].sort((qe,wt)=>(qe.position??0)-(wt.position??0));for(let qe of ht)tt.push(qe),qe.subtasks&&qe.subtasks.length>0&&(qe.isExpanded===void 0||qe.isExpanded)&&K(qe.subtasks,tt);return tt},ve=I(e);return K(ve)},[e]),ft=react.useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let K=I.startDate.getTime(),ve=I.endDate.getTime(),Ue=n.getTime(),pe=(K-Ue)/(1e3*60*60*24),tt=(ve-K)/(1e3*60*60*24)+1,ht=pe*Pe*o,qe=Math.max(Pe*o,40),wt=Math.max(tt*Pe*o,qe);return {x:ht,width:wt}},[n,Pe,o]),Ct=react.useMemo(()=>De.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:K,width:ve}=ft(I),pe=De.findIndex(tt=>tt.id===I.id)*a+(a-18)/2;return {id:I.id,x:K,y:pe,width:ve,height:18}}),[De,ft]),_e=react.useCallback((I,K,ve)=>{if(!ve){$([]),L(null);return}if(L({taskId:I,daysDelta:K}),K===0){$([]);return}let Ue=Se.calculateCascadePreview(e,I,K,De,n,Pe*o,a,48);$(Ue);},[e,De,n,Pe,o,a,48]),ut=react.useCallback((I,K)=>{if(!J)return K;let ve=Pe*o,Ue=J.daysDelta*ve;if(I===J.taskId)return {x:K.x+Ue,width:K.width};let pe=z.find(tt=>tt.taskId===I);return pe?{x:pe.previewX,width:pe.width}:K},[J,z,Pe,o]),A=react.useMemo(()=>{let I=[],K=new Date(n);for(;K<=s;){let pe=(K.getTime()-n.getTime())/864e5*Pe*o;if(r==="day")I.push({date:new Date(K),label:K.toLocaleDateString(i,{day:"numeric",month:"short"}),x:pe}),K.setDate(K.getDate()+1);else if(r==="week"){let tt=dt(K);I.push({date:new Date(K),label:C==="range"?(()=>{let ht=new Date(K);ht.setDate(ht.getDate()+6);let qe=wt=>wt.toLocaleDateString(i,{month:"short"});return qe(K)===qe(ht)?`${qe(K)} ${K.getDate()}\u2013${ht.getDate()}`:`${qe(K)} ${K.getDate()}\u2013${qe(ht)} ${ht.getDate()}`})():`${M.labels.week} ${tt}`,x:pe}),K.setDate(K.getDate()+7);}else I.push({date:new Date(K),label:K.toLocaleDateString(i,{month:"short",year:"numeric"}),x:pe}),K.setMonth(K.getMonth()+1);}return I},[n,s,r,Pe,o,i,M.labels.week,C]),q=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Pe*o,[n,Pe,o]),Ce=Math.max(De.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,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}),A.map((I,K)=>jsxRuntime.jsxs("g",{children:[K>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:r==="day"&&!Z(I.date)&&Xe(I.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${K}`)),q>=0&&q<=Oe&&jsxRuntime.jsxs("g",{"data-hoy":"cabecera",children:[jsxRuntime.jsx("circle",{cx:q,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:q,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${q-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:M.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:T,width:Math.max(Oe,1e3),height:Ce,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:ce,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:Ce,fill:t.bgPrimary}),De.map((I,K)=>jsxRuntime.jsx("rect",{x:0,y:K*a,width:Math.max(Oe,1e3),height:a,fill:K%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${I.id}`)),A.map((I,K)=>K>0?jsxRuntime.jsx("line",{x1:I.x,y1:0,x2:I.x,y2:De.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${K}`):null),A.map((I,K)=>{let ve=A[K+1]?.x||Oe,Ue=w&&Z(I.date),pe=r==="day"&&!Z(I.date)&&Xe(I.date);return Ue||pe?jsxRuntime.jsxs("g",{"data-finde":"true",children:[jsxRuntime.jsx("rect",{x:I.x,y:0,width:ve-I.x,height:De.length*a,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:ve-I.x,height:De.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${K}`):null}),De.map((I,K)=>{let ve=I.startDate&&I.endDate;return jsxRuntime.jsx("g",{children:!ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:K*a,width:Oe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ue=>St(Ue,I),onMouseMove:Ue=>mt(Ue,I,K),onMouseLeave:()=>{gt();}},`clickable-${I.id}`),ne&&ne.taskId===I.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:ne.x,y1:K*a+4,x2:ne.x,y2:K*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:ne.x,cy:ne.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:ne.x,cy:ne.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${ne.x}, ${K*a-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:ne.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!ne||ne.taskId!==I.id)&&jsxRuntime.jsx("text",{x:q>0?q:100,y:K*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:M.labels.clickToSetDates},`placeholder-${I.id}`)]})},`row-group-${I.id}`)}),De.map((I,K)=>{if(!I.startDate||!I.endDate)return null;let{x:ve,width:Ue}=ft(I),pe=K*a+(a-18)/2,tt=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;if(I.isMilestone)return jsxRuntime.jsx(Cl,{task:I,x:ve+Ue/2,y:pe+12,theme:t,onClick:u},I.id);if(tt){let ht=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),qe=8,wt=pe+(a-18)/2+(18-qe)/2,qt=4,Tt=I.progress||0,Pt=new Date;Pt.setHours(0,0,0,0);let _t=I.startDate&&Pt>=I.startDate,be=I.endDate&&(()=>{let ra=new Date(I.endDate);return ra.setHours(0,0,0,0),Pt>ra})(),Ee=I.startDate&&Pt<I.startDate,Qe=1;if(_t&&I.startDate&&I.endDate&&!Ee){let ra=new Date(I.startDate);ra.setHours(0,0,0,0);let ir=new Date(I.endDate);ir.setHours(0,0,0,0);let Ye=Math.max(1,(ir.getTime()-ra.getTime())/(1e3*60*60*24)),Ra=Math.min((Pt.getTime()-ra.getTime())/(1e3*60*60*24),Ye)/Ye*100;Qe=Ra>0?Tt/Ra:1;}let at;Tt>=100?at="#00E5CC":Ee?at="#4B5563":be&&Tt<100?at="#EF4444":Qe>=.95?at="#22C55E":Qe>=.8?at="#F59E0B":at="#EF4444";let Nt=Math.max(Tt/100*Ue,Tt>0?qt*2:0),Ft=Ue>100&&Tt>0,kt=I.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>u?.(I),onContextMenu:ra=>{ra.preventDefault(),ra.stopPropagation(),m?.(I,ra);},onMouseMove:ra=>{Be({task:I,x:ve,y:wt,width:Ue,height:qe,showBelow:wt<100,mouseX:ra.clientX,mouseY:ra.clientY});},onMouseLeave:()=>Be(null),style:{cursor:"default",opacity:y?kt?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":Tt>=100?"completed":be?"overdue":"planned",children:[jsxRuntime.jsx("rect",{x:ve,y:pe,width:Ue,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ve,y:wt,width:Ue,height:qe,rx:qt,fill:ht?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),Tt>0&&jsxRuntime.jsx("rect",{x:ve,y:wt,width:Nt,height:qe,rx:qt,fill:at,"data-parte":"avance"}),y&&kt&&jsxRuntime.jsx("rect",{x:ve,y:wt,width:Ue,height:qe,rx:qt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ft&&jsxRuntime.jsxs("text",{x:ve+Nt+6,y:wt+qe/2,dominantBaseline:"central",fill:ht?"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(Tt),"%"]})]},I.id)}return jsxRuntime.jsx(yl,{task:I,x:ve,y:pe,width:Ue,theme:t,dayWidth:Pe*o,startDate:n,templates:c,onClick:u,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:Ct,onDragMove:_e,onHoverChange:Be,showBaseline:h,showTaskBarLabels:p,showCriticalPath:y,readOnly:P?!P(I):false,onProgressChange:O},I.id)}),x&&De.map((I,K)=>!I.dependencies||I.dependencies.length===0||!I.startDate||!I.endDate?null:I.dependencies.map(ve=>{let Ue=De.find(at=>at.id===ve);if(!Ue||!Ue.startDate||!Ue.endDate)return null;let pe=De.findIndex(at=>at.id===ve),tt=ut(Ue.id,ft(Ue)),ht=ut(I.id,ft(I)),qe=tt.x+tt.width,wt=pe*a+26,qt=ht.x,Tt=K*a+26,Pt=`dep-${ve}-${I.id}`;if(G.has(Pt))return null;let _t=y&&I.isCriticalPath&&Ue.isCriticalPath;return jsxRuntime.jsx(ui,{x1:qe,y1:wt,x2:qt,y2:Tt,theme:t,lineStyle:l,colorOverride:y?_t?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?_t?2:1:void 0,glowFilter:_t?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>b?.(I.id,ve),onHoverChange:at=>{xe.current=at,at&&R({key:Pt,fromId:ve,toId:I.id,exitX:qe,exitY:wt,enterX:qt,enterY:Tt});}},Pt)})),z.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&&we&&jsxRuntime.jsx(ui,{x1:we.exitX,y1:we.exitY,x2:we.enterX,y2:we.enterY,theme:t,lineStyle:l,onDelete:()=>{let I=we.key;R(null),xe.current=false,Ve(K=>new Set(K).add(I)),b?.(we.toId,we.fromId);},hoverOverlayOnly:true,onHoverChange:I=>{xe.current=I,I||R(null);}},`${we.key}-hover-overlay`),q>=0&&q<=Oe&&jsxRuntime.jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:q,y1:0,x2:q,y2:Ce,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:q,y1:0,x2:q,y2:Ce,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Ae&&jsxRuntime.jsx(gg,{tooltipData:Ae,theme:t,locale:i==="es"?"es":"en",workingDaysConfig:N})]})}var Fw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],hg=({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"})}),Lw=()=>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"})}),Aw=()=>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"})}),Iw=()=>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"})}),Rw=()=>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 Sl({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=react.useState(false),[u,d]=react.useState(false),[m,f]=react.useState([]),[v,b]=react.useState(""),[h,y]=react.useState(false),[x,w]=react.useState(true),[C,P]=react.useState(""),[O,N]=react.useState(-1),[S,M]=react.useState(false),[T,z]=react.useState(0),$=react.useRef(null),J=react.useRef(null),L=react.useRef(null),Ae=react.useRef(null),{enabled:U=true,placeholder:we='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:xe,suggestions:G=Fw,maxHistory:Ve=50,persistHistory:ne,mentionableUsers:Re=[]}=a,ce=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Be=ce?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Le=ce?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Pe=ce?"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)",Oe=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",dt=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Z=ce?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",ze=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Xe=ce?"rgba(0, 229, 204, 0.9)":"#00E5CC",$e=ce?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",St=ce?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",mt=ce?"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)",gt=ce?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",De=ce?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",ft=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Ct=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",_e=ce?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ut=ce?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=ce?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",q=ce?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",Ce=ce?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",I="rgba(0, 229, 204, 0.04)",K=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ve=ce?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=ce?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",pe=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",tt=ce?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ht=ce?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",qe=ce?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",wt=ce?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",qt="rgba(0, 229, 204, 0.06)",Tt=ce?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Pt=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",_t=ce?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",be=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ee=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Qe=ce?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",at=ce?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Nt=ce?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ft=ce?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",kt=ce?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Ia=ce?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ra=ce?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ir=ce?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ye=ce?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",et=ce?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ra=ne?.storageKey||"gantt-ai-history",Ba=ne?.maxMessages??5,lr=Re.filter(B=>{if(!C)return true;let te=C.toLowerCase();return B.name.toLowerCase().includes(te)||B.email&&B.email.toLowerCase().includes(te)}).slice(0,5),Na=react.useCallback(B=>{if(b(B),Re.length===0)return;let te=$.current;if(!te)return;let Te=te.selectionStart||B.length,D=B.slice(0,Te),W=D.lastIndexOf("@");if(W>=0&&((W>0?D[W-1]:" ")===" "||W===0)){let ke=D.slice(W+1);if(ke.length<=40){P(ke),N(W),M(true),z(0);return}}M(false),P(""),N(-1);},[Re.length]),Rr=react.useCallback(B=>{let te=v.slice(0,O),Te=v.slice(O+1+C.length),D=`${te}@${B.name} ${Te}`;b(D),M(false),P(""),N(-1),setTimeout(()=>$.current?.focus(),0);},[v,O,C]),ie=react.useCallback(B=>{if(!S||lr.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),z(te=>te<lr.length-1?te+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),z(te=>te>0?te-1:lr.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let te=lr[T];return te&&Rr(te),true}return B.key==="Escape"?(M(false),true):false},[S,lr,T,Rr]);react.useEffect(()=>{if(ne?.enabled)try{let B=localStorage.getItem(Ra);if(B){let Te=JSON.parse(B).map(D=>({...D,timestamp:new Date(D.timestamp)}));f(Te.slice(-Ba));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[ne?.enabled,Ra,Ba]),react.useEffect(()=>{if(ne?.enabled&&m.length>0)try{let B=m.filter(te=>!te.isLoading).slice(-Ba);localStorage.setItem(Ra,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[m,ne?.enabled,Ra,Ba]),react.useEffect(()=>{J.current&&J.current.scrollIntoView({behavior:"smooth"});},[m]),react.useEffect(()=>{l&&!u&&$.current&&setTimeout(()=>$.current?.focus(),100);},[l,u]);let ge=react.useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&n?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&o?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[n,s,o,i,c]),bt=react.useCallback(async B=>{if(!B.trim()||h)return;let te={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};f(D=>[...D.slice(-(Ve-1)),te]),b(""),w(false),y(true);let Te={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(D=>[...D,Te]);try{if(xe){let D=m.filter(de=>!de.isLoading&&de.content).slice(-6).map(de=>({role:de.role,content:de.content})),W=await xe(B,e,D);f(de=>{let ke=de.filter(fe=>!fe.isLoading),st={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...ke,st]}),ge(W);}else f(D=>[...D.filter(de=>!de.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(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);}},[h,Ve,xe,e,ge]),_=B=>{B.preventDefault(),bt(v);},he=B=>{b(B),$.current?.focus();};if(react.useEffect(()=>{let B=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),p(Te=>!Te),l||d(false)),te.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),react.useEffect(()=>{if(!l)return;let B=Te=>{let D=Te.target;L.current&&!L.current.contains(D)&&p(false);},te=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(te),document.removeEventListener("mousedown",B);}},[l]),!U)return null;let se={"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(ba,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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 ${se[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Be,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Le}`,color:"#00E5CC",cursor:"pointer",boxShadow:Pe,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Oe}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${dt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(hg,{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:Xe,background:Z,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ze}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,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 ${re[R]} 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:Nt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:lt,borderBottom:`1px solid ${Ee}`},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:ct,border:`1px solid ${xt}`,color:"#00E5CC"},children:jsxRuntime.jsx(hg,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ke},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>d(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:st},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=L;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=st;},children:jsxRuntime.jsx(Iw,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:st},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=L;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=st;},children:jsxRuntime.jsx(Aw,{})})]})]}),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:Ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:V.slice(0,4).map((B,Z)=>jsxRuntime.jsx("button",{onClick:()=>he(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:I,color:we,border:`1px solid ${K}`},onMouseEnter:Te=>{Te.currentTarget.style.borderColor=Ge,Te.currentTarget.style.color="#00E5CC";},onMouseLeave:Te=>{Te.currentTarget.style.borderColor=K,Te.currentTarget.style.color=we;},children:B.length>30?B.slice(0,30)+"...":B},Z))})]}),m.map(B=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?pe:bt,color:B.role==="user"?"#00E5CC":ht,border:B.role==="user"?`1px solid ${rt}`:`1px solid ${qe}`},children:[B.isLoading?jsxRuntime.jsx(Rw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsxRuntime.jsx("div",{ref:X})]}),jsxRuntime.jsxs("form",{onSubmit:B=>{if(S&&sr.length>0){B.preventDefault();return}j(B);},className:"p-3 relative",style:{borderTop:`1px solid ${Yt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&sr.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Se,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:vt,border:`1px solid ${xa}`,boxShadow:At,backdropFilter:"blur(12px)"},children:sr.map((B,Z)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Rr(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Z===N?er:"transparent",color:fa},onMouseEnter:()=>U(Z),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:Ye,border:`1px solid ${Ze}`,color:"#00E5CC"},children:B.name.split(" ").map(Te=>Te[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:B.name}),B.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:hr},children:B.email})]})]},B.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:kt,border:`1px solid ${de}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:v,onChange:B=>Ta(B.target.value),onKeyDown:B=>{ie(B);},placeholder:ve,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:De,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?tt:"transparent",color:v.trim()?"#00E5CC":Wt,border:v.trim()?`1px solid ${Bt}`:"1px solid transparent"},children:jsxRuntime.jsx(Lw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Qe,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function yg(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((l,u=true)=>{r(p=>{let d=typeof l=="function"?l(p.present):l;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(()=>{r(l=>{if(l.past.length===0)return l;let u=l.past[l.past.length-1],p=l.past.slice(0,l.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let u=l.future[0],p=l.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...l.past,l.present],present:u,future:p}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function xg({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){react.useEffect(()=>{if(!n)return;let s=o=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!i&&c&&o.key==="y"){o.preventDefault(),t();return}if(i&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Hw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Me.formatDate(e.startDate)} - ${Me.formatDate(e.endDate)}`);let a=Me.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vg(e){return {...Hw,...e}}var Kw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Ng=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:b,persistColumns:h,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:C,showCreateTaskButton:P=false,createTaskLabel:$,onCreateTask:T,taskFilter:S,onTaskFilterChange:M,toolbarRightContent:N,toolbarContainer:U,hideWbsLevel:O,showBaseline:X,viewMode:A,onViewModeChange:Se,projectForecast:G,hideForecastHud:ve,onThemeChange:R,onTaskClick:ye,onTaskSelectionChange:V,selectedTaskId:Ue,onTaskDblClick:ne,onTaskContextMenu:Be,onTaskUpdate:ce,onDependentTasksScheduled:Ne,onProgressChange:ze,onTaskEdit:Le,onTaskAddSubtask:$e,onTaskMarkIncomplete:Ve,onTaskSetInProgress:oe,onDependencyCreate:je,onDependencyDelete:et,onBeforeTaskAdd:Re,onAfterTaskAdd:ut,onBeforeTaskUpdate:Nt,onAfterTaskUpdate:lt,onBeforeTaskDelete:Ee,onAfterTaskDelete:ct,permissions:xt,onCopySnapshotLink:Ke}=a,L=react.useContext(pl)?.theme,[J,Ce]=react.useState(L||s||"dark"),[I,K]=react.useState(o),[we,Ge]=react.useState(i),[pe,rt]=react.useState(1),[bt,qe]=react.useState("all"),[ht,Yt]=react.useState(A||"execution"),kt=A??ht,de=react.useCallback(E=>{Yt(E),Se?.(E);},[Se]),De=X??kt==="oracle",[tt,Bt]=react.useState(a.showCriticalPath!==false),[Wt,Qe]=react.useState(a.showDependencies!==false),[vt,xa]=react.useState(a.highlightWeekends!==false),At=react.useCallback(E=>{Bt(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),er=react.useCallback(E=>{Qe(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),fa=react.useCallback(E=>{xa(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(I);},[I]),react.useEffect(()=>{a.onZoomChange?.(pe);},[pe]);let hr=react.useRef(a.onDateRangeChange);hr.current=a.onDateRangeChange;let Ye=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Ze,Aa]=react.useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Ia=S??Ze,sr=M??Aa,[Ta,Rr]=react.useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);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=Ye();if(E)try{let F={taskFilter:Ia,hideCompleted:Ta};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[Ia,Ta,Ye]);let ie=react.useRef(y);react.useEffect(()=>{if(ie.current!==y&&y!==void 0){Aa("all"),Rr(false);let E=Ye();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}ie.current=y;},[y,Ye]);let[fe,pt]=react.useState(0),[j,he]=react.useState(false),[re,B]=react.useState(null),[Z,Te]=react.useState({isOpen:false,x:0,y:0,task:null}),[D,W]=react.useState(null),[ue,ke]=react.useState(null);react.useEffect(()=>{L&&L!==J&&Ce(L);},[L]),react.useEffect(()=>{s&&s!==J&&Ce(s);},[s]);let ot=react.useCallback(E=>{Ce(E),R?.(E);},[R]),{state:be,setState:_,undo:gt,redo:yt,canUndo:_t,canRedo:Xt,clearHistory:ir}=yg(t,50),yr=react.useMemo(()=>{let E=(F,H=0)=>{let Y=H;for(let le of F)le.subtasks?.length&&(Y=Math.max(Y,E(le.subtasks,H+1)));return Y};return E(be)+1},[be]),Sr=react.useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ia=react.useRef(new Map),Qo=react.useRef(false);if(!Qo.current&&v){Qo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let H=JSON.parse(F);Array.isArray(H)&&(ia.current=new Map(H));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Bn=react.useCallback(()=>{let E=Sr();if(E)try{let F=Array.from(ia.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[Sr]),_r=react.useRef(0),Qn=react.useRef(be);react.useEffect(()=>{Qn.current=be;},[be]);let Zn=react.useRef(false),Pi=react.useCallback(E=>{qe(E),_r.current+=1,_(F=>{let H=(le,ge=0)=>le.map(We=>{let He=E==="all"||ge<E-1;return We.subtasks?.length&&ia.current.set(We.id,He),{...We,isExpanded:He,subtasks:We.subtasks?H(We.subtasks,ge+1):void 0}}),Y=H(F);return Bn(),Y});},[_,Bn]);react.useEffect(()=>{if(_r.current>0){_r.current-=1;return}let E=H=>{let Y=new Map;for(let le of H){let ge=le.id;Y.get(ge)||Y.set(ge,le);}return Array.from(Y.values())},F=H=>H.map(Y=>{let le=ia.current.get(Y.id),ge=le!==void 0?{...Y,isExpanded:le}:Y;if(ge.subtasks?.length){let We=E(ge.subtasks);return {...ge,subtasks:F(We)}}return ge});if(ia.current.size>0)_(Jr(F(t)));else {let H=Y=>Y.map(le=>le.subtasks?.length?{...le,subtasks:E(H(le.subtasks))}:le);_(Jr(H(t)));}},[t,_]);let Zo=react.useRef(t),Fi=react.useRef(true);react.useEffect(()=>{if(Fi.current){Fi.current=false,Zo.current=be;return}if(Zn.current){Zn.current=false,Zo.current=be;return}if(!r)return;let E=JSON.stringify(Zo.current),F=JSON.stringify(be);E!==F&&(Zo.current=be,r(be));},[be,r]);let qa=react.useMemo(()=>bd(w,C),[w,C]),Bs=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}],[]),eo=a.defaultVisibleColumns,$s=react.useCallback(E=>eo?E.map(F=>F.id==="name"?F:{...F,visible:eo.includes(F.id)}):E,[eo]),xr=react.useMemo(()=>h?typeof h=="string"?h:"gantt-columns-state":null,[h]),[on,$n]=react.useState(()=>{let E=$s(Bs(qa));if(!h)return E;try{let F=typeof h=="string"?h:"gantt-columns-state",H=localStorage.getItem(F);if(!H)return E;let Y=JSON.parse(H),le=new Map(Y.map(ge=>[ge.id,ge]));return E.map(ge=>{let We=le.get(ge.id);return We?{...ge,visible:We.visible??ge.visible,width:We.width??ge.width}:ge})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Os=react.useRef(xr);react.useEffect(()=>{if(Os.current===xr)return;Os.current=xr;let E=$s(Bs(qa));if(!xr){$n(E);return}try{let F=localStorage.getItem(xr);if(!F){$n(E);return}let H=JSON.parse(F),Y=new Map(H.map(le=>[le.id,le]));$n(E.map(le=>{let ge=Y.get(le.id);return ge?{...le,visible:ge.visible??le.visible,width:ge.width??le.width}:le}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),$n(E);}},[xr,Bs,qa]),react.useEffect(()=>{if(xr&&Os.current===xr)try{let E=on.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(xr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[on,xr]),react.useEffect(()=>{$n(E=>E.map(F=>({...F,label:qa.columns[F.id==="name"?"taskName":F.id]||F.label})));},[qa]);let sn=react.useMemo(()=>on.filter(F=>F.visible).reduce((F,H)=>F+H.width,0),[on]),Hs=react.useRef(on.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=on.filter(Y=>Y.visible),F=E.map(Y=>Y.id).join(","),H=Hs.current;if(F!==H){let Y=E.some(ge=>ge.id!=="name"),le=H.includes(",");Y?!le&&Y&&B(null):B(null),Hs.current=F;}},[on]);let Li=60,On=.6,Ai=react.useMemo(()=>{let F=sn+Li,H=typeof window<"u"?window.innerWidth*On:800,Y=Math.max(F,H);return re!==null?Math.max(200,Math.min(re,Y)):Math.max(200,F)},[re,sn]),Br=react.useRef(null),es=react.useRef(null),vr=react.useRef(null),No=react.useRef(null),Do=react.useRef(null),ta=react.useMemo(()=>Om(J),[J]),dc=react.useMemo(()=>({theme:ta,themeName:J}),[ta,J]),Us=react.useMemo(()=>vg(m),[m]),ts=react.useMemo(()=>{if(!f||!tt)return be;let E=Me.calculateCriticalPathFull(be),F=H=>H.map(Y=>{let le=E.get(Y.id),ge=Y.subtasks?F(Y.subtasks):void 0,We=ge?.some(Mt=>Mt.isCriticalPath||Mt.subtasks&&Mt.subtasks.some($t=>$t.isCriticalPath))||false,He=le?le.isCritical:We;return {...Y,isCriticalPath:He,cpmData:le||void 0,subtasks:ge}});return F(be)},[be,f,tt]),Ws=react.useMemo(()=>Me.flattenTasks(be).some(F=>F.dependencies&&F.dependencies.length>0),[be]),Hn=react.useMemo(()=>{let E=(F,H="")=>[...F].sort((le,ge)=>(le.position??0)-(ge.position??0)).map((le,ge)=>{let We=ge+1,He=H?`${H}.${We}`:`${We}.0`,Mt=H?`${H}.${We}`:`${We}`;return {...le,wbsCode:He,subtasks:le.subtasks?.length?E(le.subtasks,Mt):le.subtasks}});return E(ts)},[ts]),k=(a.searchQuery??"").trim(),q=react.useMemo(()=>{let E=le();if(!k)return E;let F=ge=>ge.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),H=F(k),Y=ge=>{let We=[];for(let He of ge){if(F(He.name||"").includes(H)){We.push(He);continue}let Mt=He.subtasks?.length?Y(He.subtasks):[];Mt.length&&We.push({...He,subtasks:Mt});}return We};return Y(E);function le(){if(Ia==="all"&&!Ta)return Hn;let ge=We=>{let He=[];for(let Mt of We){let $t=Mt.subtasks?.length?ge(Mt.subtasks):void 0,jt=false;if(Ta)jt=Mt.progress<100&&Mt.status!=="completed";else switch(Ia){case "all":jt=true;break;case "incomplete":jt=Mt.progress<100;break;case "in_progress":jt=Mt.progress>0&&Mt.progress<100;break;case "completed":jt=Mt.progress===100;break}(jt||$t&&$t.length>0)&&He.push({...Mt,subtasks:$t});}return He};return ge(Hn)}},[Hn,Ia,Ta,k]),Q=Kw(we);xg({undo:gt,redo:yt,canUndo:_t,canRedo:Xt,enabled:true});let se=react.useRef(null),me=(E,F="start")=>{let H=vr.current,Y=Do.current;if(!H||!Y)return;let le=(E.getTime()-Y.startDate.getTime())/(1e3*60*60*24),ge=Y.timeScale==="day"?60:Y.timeScale==="week"?20:8,We=le*ge*Y.zoom,He=F==="center"?We-H.clientWidth/2:We-ge*Y.zoom*2;H.scrollTo({left:Math.max(0,He),behavior:"auto"});};react.useImperativeHandle(n,()=>({getTask:E=>Me.findTaskById(be,E),addTask:(E,F)=>{_(H=>{if(!F)return [...H,{...E,level:0}];let Y=le=>le.map(ge=>ge.id===F?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:F,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:Y(ge.subtasks)}:ge);return Y(H)});},updateTask:(E,F)=>{_(H=>{let Y=le=>le.map(ge=>ge.id===E?{...ge,...F}:ge.subtasks?{...ge,subtasks:Y(ge.subtasks)}:ge);return Y(H)});},deleteTask:E=>{_(F=>{let H=Y=>Y.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=H(le.subtasks)),true));return H(F)});},deleteTasks:E=>{_(F=>Ed(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=Me.findTaskById(be,E);F&&a.onTaskDuplicate(F);}else _(F=>ci(F,[E]).tasks);},splitTask:(E,F,H=3)=>{_(Y=>Me.splitTask(Y,E,F,H));},calculateEndDate:Me.calculateEndDate,calculateDuration:Me.calculateDuration,validateDependency:(E,F)=>!Me.validateDependencies(be,E,F),getAllTasks:()=>Me.flattenTasks(be),getTasksByStatus:E=>Me.flattenTasks(be).filter(F=>F.status===E),getTasksByParent:E=>E?Me.findTaskById(be,E)?.subtasks||[]:be.filter(H=>!H.parentId),getCriticalPath:()=>Me.flattenTasks(be).filter(E=>E.isCriticalPath),indentTask:E=>{_(F=>Jr(Nd(F,[E])));},outdentTask:E=>{_(F=>Jr(Dd(F,[E])));},moveTask:(E,F)=>{_(H=>Sd(H,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:H}=Fd(be,E);if(Re){let Y=Re({...H,parentId:E});if((Y instanceof Promise?await Y:Y)===false)return}_(Jr(F)),ut&&ut({...H,parentId:E});},scrollToTask:E=>{let H=Me.flattenTasks(be).findIndex(Y=>Y.id===E);if(H!==-1&&Br.current){let Y=H*Q;Br.current.scrollTo({top:Y,behavior:"smooth"}),vr.current&&vr.current.scrollTo({top:Y,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{_(F=>{let H=Y=>Y.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:H(le.subtasks)}:le);return H(F)});},collapseTask:E=>{_(F=>{let H=Y=>Y.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:H(le.subtasks)}:le);return H(F)});},expandAll:()=>{_(E=>{let F=H=>H.map(Y=>({...Y,isExpanded:true,subtasks:Y.subtasks?F(Y.subtasks):void 0}));return F(E)});},collapseAll:()=>{_(E=>{let F=H=>H.map(Y=>({...Y,isExpanded:false,subtasks:Y.subtasks?F(Y.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{Pi(E);},undo:gt,redo:yt,canUndo:()=>_t,canRedo:()=>Xt,clearHistory:ir,exportToPNG:async()=>{if(!No.current||!Br.current||!vr.current)throw new Error("Gantt container not found");let E=No.current,F=Br.current,H=es.current||F.querySelector(".gantt-grid-scroll"),Y=vr.current,le=H?.scrollTop||0,ge=Y.scrollTop,We=E.style.overflow,He=E.style.height,Mt=F.style.overflow;try{let $t=H?.querySelector(".gantt-taskgrid-content"),jt=Y.querySelector("svg"),gr=$t?.scrollHeight||H?.scrollHeight||600,zr=jt?.getBoundingClientRect().height||Y.scrollHeight,So=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(gr,zr)+20;H&&(H.scrollTop=0),Y.scrollTop=0,E.style.overflow="visible",E.style.height=`${So}px`,F.style.overflow="visible",await new Promise(os=>setTimeout(os,100));let Dn=await htmlToImage.toPng(E,{backgroundColor:ta.bgPrimary,pixelRatio:2,filter:os=>{if(!(os instanceof Element))return !0;let Ii=window.getComputedStyle(os),Gs=parseInt(Ii.zIndex,10);return (isNaN(Gs)||Gs<50)&&Ii.position!=="fixed"}});return await(await fetch(Dn)).blob()}finally{E.style.overflow=We,E.style.height=He,F.style.overflow=Mt,H&&(H.scrollTop=le),Y.scrollTop=ge;}},exportToPDF:async E=>{await Me.exportToPDF(be,E);},exportToExcel:async E=>{await Me.exportToExcel(be,E,pc.current);},exportToJSON:()=>Me.exportToJSON(be),exportToCSV:()=>Me.exportToCSV(be),importFromJSON:E=>{let F=Me.importFromJSON(E);_(F);},getTasks:()=>be,refresh:()=>{_(E=>[...E]);},clearAll:()=>{_([]);},scrollToDate:(E,F="start")=>me(E,F),fitToDates:(E,F)=>{let H=Math.max(1,(F.getTime()-E.getTime())/864e5),Y=H<=21?"day":H<=122?"week":"month";se.current=E,K(Y),Y===Do.current?.timeScale&&requestAnimationFrame(()=>{let le=se.current;se.current=null,le&&me(le);});},scrollToToday:()=>{let E=vr.current,F=Do.current;if(!E||!F)return;let Y=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),le=F.timeScale==="day"?60:F.timeScale==="week"?20:8,ge=Y*le*F.zoom,We=E.clientWidth,He=Math.max(0,ge-We/2);E.scrollTo({left:He,behavior:"smooth"});}}),[be,gt,yt,_t,Xt,ir,ta,Q]);let Oe=react.useCallback(E=>{$n(F=>F.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),ae=react.useCallback((E,F)=>{$n(H=>H.map(Y=>{if(Y.id!==E)return Y;let le=Y.minWidth??100,ge=Y.maxWidth??800,We=Math.max(le,Math.min(ge,F));return {...Y,width:We}}));},[]),Pe=react.useCallback(E=>{_(F=>{let H=Pd(F,E),Y=le=>{for(let ge of le){if(ge.id===E){ia.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&Y(ge.subtasks);}};return Y(H),Bn(),H}),a.onTaskToggleExpand?.(E);},[a,Bn]),Ie=react.useCallback((E,F)=>{if(Nt&&Nt(E,F)===false)return;let Y=Me.findTaskById(be,E)?.progress,le=We=>We.map(He=>He.id===E?{...He,...F}:He.subtasks?{...He,subtasks:le(He.subtasks)}:He);_(We=>le(We));let ge=Me.findTaskById(le(be),E);ge&&(ce?.(ge),lt?.(ge),F.progress!==void 0&&Y!==void 0&&F.progress!==Y&&ze?.(E,Y,F.progress));},[be,ce,Nt,lt,ze]),Xe=react.useCallback((E,F,H)=>{if(E.length===0)return;let Y=new Set(E),le=ge=>ge.map(We=>{let He=Y.has(We.id)?{...We,[F]:H}:We;return He.subtasks?{...He,subtasks:le(He.subtasks)}:He});_(ge=>{let We=le(ge);return a.onBulkFill?.(E,F,H,We),We});},[a]),It=react.useCallback(E=>{E.length!==0&&(_r.current+=1,Zn.current=true,_(F=>Jr(Nd(F,E))),a.onTaskIndent?.(E[0]));},[a]),mt=react.useCallback(E=>{E.length!==0&&(_r.current+=1,Zn.current=true,_(F=>Jr(Dd(F,E))),a.onTaskOutdent?.(E[0]));},[a]),ft=react.useCallback((E,F,H)=>{_r.current+=1,Zn.current=true,_(Y=>Jr(og(Y,E,F,H))),a.onTaskReparent?.(E,F,H);},[a]),pa=react.useCallback((E,F)=>{E.length!==0&&(_r.current+=1,Zn.current=true,_(H=>Sd(H,E,F)),a.onTaskMove?.(E[0],F));},[a]),Vt=react.useCallback(async E=>{let F=[];for(let H of E)Ee&&await Promise.resolve(Ee(H))===false||F.push(H);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(_(H=>Jr(Ed(H,F))),F.forEach(H=>a.onTaskDelete?.(H))),ct&&F.forEach(H=>ct(H)));},[a,Ee,ct]),Ya=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let H=Me.findTaskById(be,F);H&&a.onTaskDuplicate(H);}):_(F=>ci(F,E).tasks);},[a,be]),Kt=react.useCallback((E,F)=>{_(H=>{let{tasks:Y,newTask:le}=ng(H,E,F);return Re&&Re(le)===false?H:(a.onTaskCreate?.(le.parentId,le.position||0),ut?.(le),Y)});},[a,Re,ut]),aa=react.useCallback((E,F)=>{_(H=>Md(H,E,F)),a.onTaskRename?.(E,F);},[a]),Dt=react.useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let H=vs(be,E);if(H){F(H);return}}_(H=>{let{tasks:Y}=Fd(H,E);return a.onTaskCreate?.(E,0),Y});},[a,be]),Ot=react.useCallback((E,F)=>{let H=Math.max(0,Math.min(100,Math.round(F))),Y={progress:H};H===100?Y.status="completed":H>0?Y.status="in-progress":Y.status="todo",Ie(E.id,Y);},[Ie]),Ra=react.useCallback((E,F,H)=>{let Y=!E.startDate&&!E.endDate,le=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=$t=>$t.map(jt=>jt.id===E.id?{...jt,startDate:F,endDate:H,...E.segments&&{segments:E.segments}}:jt.subtasks?{...jt,subtasks:ge(jt.subtasks)}:jt),We=ge(be),He=We;We=Me.autoScheduleDependents(We,E.id,le),We=Jr(We),_(We);let Mt={...E,startDate:F,endDate:H};if(Y&&a?.onTaskDateChange?a.onTaskDateChange(E,F,H):ce?.(Mt),Ne&&le!==0){let $t=Me.flattenTasks(He),jt=Me.flattenTasks(We),gr=[];for(let zr of jt){if(zr.id===E.id)continue;let ao=$t.find(Dn=>Dn.id===zr.id);if(!ao)continue;let ns=zr.startDate?.getTime()!==ao.startDate?.getTime(),So=zr.endDate?.getTime()!==ao.endDate?.getTime();(ns||So)&&gr.push(zr);}gr.length>0&&Ne(gr);}},[be,ce,Ne,a]),wr=react.useCallback((E,F)=>{Be?.(E,F),Te({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Be]),Er=react.useCallback((E,F)=>{let H=Me.splitTask(be,E.id,F);_(H),Te({isOpen:false,x:0,y:0,task:null});},[be]),lr=react.useCallback(E=>{let F=Me.findTaskById(be,E.id)||E;ne?.(F),Le||W(F);},[be,ne,Le]),Va=react.useCallback((E,F,H)=>{let Y=new Map,le=$t=>{$t.forEach(jt=>{jt.dependencies&&Y.set(jt.id,jt.dependencies),jt.subtasks&&le(jt.subtasks);});};le(H);let ge=Y.get(F)||[];Y.set(F,[...ge,E]);let We=new Set,He=new Set,Mt=$t=>{if(!We.has($t)){We.add($t),He.add($t);let jt=Y.get($t)||[];for(let gr of jt){if(!We.has(gr)&&Mt(gr))return true;if(He.has(gr))return true}}return He.delete($t),false};return Mt(F)},[]),to=react.useCallback((E,F)=>{if(Va(E.id,F,Qn.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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:u?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${se[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:$e,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${St}`,boxShadow:mt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:gt,borderBottom:`1px solid ${De}`},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:ft,border:`1px solid ${Ct}`,color:"#00E5CC"},children:jsxRuntime.jsx(hg,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:_e},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>d(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:ut},onMouseEnter:B=>{B.currentTarget.style.background=q,B.currentTarget.style.color=A;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=ut;},children:jsxRuntime.jsx(Iw,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ut},onMouseEnter:B=>{B.currentTarget.style.background=q,B.currentTarget.style.color=A;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=ut;},children:jsxRuntime.jsx(Aw,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!u&&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:Ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:G.slice(0,4).map((B,te)=>jsxRuntime.jsx("button",{onClick:()=>he(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:I,color:ve,border:`1px solid ${K}`},onMouseEnter:Te=>{Te.currentTarget.style.borderColor=Ue,Te.currentTarget.style.color="#00E5CC";},onMouseLeave:Te=>{Te.currentTarget.style.borderColor=K,Te.currentTarget.style.color=ve;},children:B.length>30?B.slice(0,30)+"...":B},te))})]}),m.map(B=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?pe:ht,color:B.role==="user"?"#00E5CC":wt,border:B.role==="user"?`1px solid ${tt}`:`1px solid ${qe}`},children:[B.isLoading?jsxRuntime.jsx(Rw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsxRuntime.jsx("div",{ref:J})]}),jsxRuntime.jsxs("form",{onSubmit:B=>{if(S&&lr.length>0){B.preventDefault();return}_(B);},className:"p-3 relative",style:{borderTop:`1px solid ${qt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&lr.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Ae,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Nt,border:`1px solid ${Ft}`,boxShadow:kt,backdropFilter:"blur(12px)"},children:lr.map((B,te)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Rr(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:te===T?Ia:"transparent",color:ra},onMouseEnter:()=>z(te),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Ye,border:`1px solid ${et}`,color:"#00E5CC"},children:B.name.split(" ").map(Te=>Te[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:B.name}),B.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:ir},children:B.email})]})]},B.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Tt,border:`1px solid ${Pt}`},children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:v,onChange:B=>Na(B.target.value),onKeyDown:B=>{ie(B);},placeholder:we,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:_t,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?be:"transparent",color:v.trim()?"#00E5CC":Qe,border:v.trim()?`1px solid ${Ee}`:"1px solid transparent"},children:jsxRuntime.jsx(Lw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:at,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function yg(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((l,p=true)=>{r(u=>{let d=typeof l=="function"?l(u.present):l;if(n.current)return {...u,present:d};if(!p)return {...u,present:d};let m=[...u.past,u.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],u=l.past.slice(0,l.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:u,present:p,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],u=l.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...l.past,l.present],present:p,future:u}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function xg({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){react.useEffect(()=>{if(!n)return;let s=o=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!i&&c&&o.key==="y"){o.preventDefault(),t();return}if(i&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Hw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vg(e){return {...Hw,...e}}var Kw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Ng=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,onExportSuccess:p,projectName:u,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:b,persistColumns:h,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:C,showCreateTaskButton:P=false,createTaskLabel:O,onCreateTask:N,taskFilter:S,onTaskFilterChange:M,toolbarRightContent:T,toolbarContainer:z,hideWbsLevel:$,showBaseline:J,viewMode:L,onViewModeChange:Ae,projectForecast:U,hideForecastHud:we,onThemeChange:R,onTaskClick:xe,onTaskSelectionChange:G,selectedTaskId:Ve,onTaskDblClick:ne,onTaskContextMenu:Re,onTaskUpdate:ce,onDependentTasksScheduled:Be,onProgressChange:Le,onTaskEdit:Pe,onTaskAddSubtask:Oe,onTaskMarkIncomplete:dt,onTaskSetInProgress:Z,onDependencyCreate:ze,onDependencyDelete:Xe,onBeforeTaskAdd:$e,onAfterTaskAdd:St,onBeforeTaskUpdate:mt,onAfterTaskUpdate:gt,onBeforeTaskDelete:De,onAfterTaskDelete:ft,permissions:Ct,onCopySnapshotLink:_e}=a,A=react.useContext(pl)?.theme,[q,Ce]=react.useState(A||s||"dark"),[I,K]=react.useState(o),[ve,Ue]=react.useState(i),[pe,tt]=react.useState(1),[ht,qe]=react.useState("all"),[wt,qt]=react.useState(L||"execution"),Tt=L??wt,Pt=react.useCallback(E=>{qt(E),Ae?.(E);},[Ae]),_t=J??Tt==="oracle",[be,Ee]=react.useState(a.showCriticalPath!==false),[Qe,at]=react.useState(a.showDependencies!==false),[Nt,Ft]=react.useState(a.highlightWeekends!==false),kt=react.useCallback(E=>{Ee(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),Ia=react.useCallback(E=>{at(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),ra=react.useCallback(E=>{Ft(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(I);},[I]),react.useEffect(()=>{a.onZoomChange?.(pe);},[pe]);let ir=react.useRef(a.onDateRangeChange);ir.current=a.onDateRangeChange;let Ye=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[et,Ra]=react.useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Ba=S??et,lr=M??Ra,[Na,Rr]=react.useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);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=Ye();if(E)try{let F={taskFilter:Ba,hideCompleted:Na};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[Ba,Na,Ye]);let ie=react.useRef(y);react.useEffect(()=>{if(ie.current!==y&&y!==void 0){Ra("all"),Rr(false);let E=Ye();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}ie.current=y;},[y,Ye]);let[ge,bt]=react.useState(0),[_,he]=react.useState(false),[se,B]=react.useState(null),[te,Te]=react.useState({isOpen:false,x:0,y:0,task:null}),[D,W]=react.useState(null),[de,ke]=react.useState(null);react.useEffect(()=>{A&&A!==q&&Ce(A);},[A]),react.useEffect(()=>{s&&s!==q&&Ce(s);},[s]);let st=react.useCallback(E=>{Ce(E),R?.(E);},[R]),{state:fe,setState:j,undo:yt,redo:xt,canUndo:Xt,canRedo:Qt,clearHistory:cr}=yg(t,50),yr=react.useMemo(()=>{let E=(F,H=0)=>{let X=H;for(let le of F)le.subtasks?.length&&(X=Math.max(X,E(le.subtasks,H+1)));return X};return E(fe)+1},[fe]),Sr=react.useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ua=react.useRef(new Map),Qo=react.useRef(false);if(!Qo.current&&v){Qo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let H=JSON.parse(F);Array.isArray(H)&&(ua.current=new Map(H));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Bn=react.useCallback(()=>{let E=Sr();if(E)try{let F=Array.from(ua.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[Sr]),qr=react.useRef(0),Qn=react.useRef(fe);react.useEffect(()=>{Qn.current=fe;},[fe]);let Zn=react.useRef(false),Pi=react.useCallback(E=>{qe(E),qr.current+=1,j(F=>{let H=(le,me=0)=>le.map(Ge=>{let We=E==="all"||me<E-1;return Ge.subtasks?.length&&ua.current.set(Ge.id,We),{...Ge,isExpanded:We,subtasks:Ge.subtasks?H(Ge.subtasks,me+1):void 0}}),X=H(F);return Bn(),X});},[j,Bn]);react.useEffect(()=>{if(qr.current>0){qr.current-=1;return}let E=H=>{let X=new Map;for(let le of H){let me=le.id;X.get(me)||X.set(me,le);}return Array.from(X.values())},F=H=>H.map(X=>{let le=ua.current.get(X.id),me=le!==void 0?{...X,isExpanded:le}:X;if(me.subtasks?.length){let Ge=E(me.subtasks);return {...me,subtasks:F(Ge)}}return me});if(ua.current.size>0)j(Zr(F(t)));else {let H=X=>X.map(le=>le.subtasks?.length?{...le,subtasks:E(H(le.subtasks))}:le);j(Zr(H(t)));}},[t,j]);let Zo=react.useRef(t),Fi=react.useRef(true);react.useEffect(()=>{if(Fi.current){Fi.current=false,Zo.current=fe;return}if(Zn.current){Zn.current=false,Zo.current=fe;return}if(!r)return;let E=JSON.stringify(Zo.current),F=JSON.stringify(fe);E!==F&&(Zo.current=fe,r(fe));},[fe,r]);let Xa=react.useMemo(()=>bd(w,C),[w,C]),Bs=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}],[]),eo=a.defaultVisibleColumns,$s=react.useCallback(E=>eo?E.map(F=>F.id==="name"?F:{...F,visible:eo.includes(F.id)}):E,[eo]),xr=react.useMemo(()=>h?typeof h=="string"?h:"gantt-columns-state":null,[h]),[Yr,$n]=react.useState(()=>{let E=$s(Bs(Xa));if(!h)return E;try{let F=typeof h=="string"?h:"gantt-columns-state",H=localStorage.getItem(F);if(!H)return E;let X=JSON.parse(H),le=new Map(X.map(me=>[me.id,me]));return E.map(me=>{let Ge=le.get(me.id);return Ge?{...me,visible:Ge.visible??me.visible,width:Ge.width??me.width}:me})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Os=react.useRef(xr);react.useEffect(()=>{if(Os.current===xr)return;Os.current=xr;let E=$s(Bs(Xa));if(!xr){$n(E);return}try{let F=localStorage.getItem(xr);if(!F){$n(E);return}let H=JSON.parse(F),X=new Map(H.map(le=>[le.id,le]));$n(E.map(le=>{let me=X.get(le.id);return me?{...le,visible:me.visible??le.visible,width:me.width??le.width}:le}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),$n(E);}},[xr,Bs,Xa]),react.useEffect(()=>{if(xr&&Os.current===xr)try{let E=Yr.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(xr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Yr,xr]),react.useEffect(()=>{$n(E=>E.map(F=>({...F,label:Xa.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Xa]);let sn=react.useMemo(()=>Yr.filter(F=>F.visible).reduce((F,H)=>F+H.width,0),[Yr]),Hs=react.useRef(Yr.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=Yr.filter(X=>X.visible),F=E.map(X=>X.id).join(","),H=Hs.current;if(F!==H){let X=E.some(me=>me.id!=="name"),le=H.includes(",");X?!le&&X&&B(null):B(null),Hs.current=F;}},[Yr]);let Li=60,On=.6,Ai=react.useMemo(()=>{let F=sn+Li,H=typeof window<"u"?window.innerWidth*On:800,X=Math.max(F,H);return se!==null?Math.max(200,Math.min(se,X)):Math.max(200,F)},[se,sn]),Br=react.useRef(null),es=react.useRef(null),vr=react.useRef(null),No=react.useRef(null),Do=react.useRef(null),sa=react.useMemo(()=>Om(q),[q]),dc=react.useMemo(()=>({theme:sa,themeName:q}),[sa,q]),Us=react.useMemo(()=>vg(m),[m]),ts=react.useMemo(()=>{if(!f||!be)return fe;let E=Se.calculateCriticalPathFull(fe),F=H=>H.map(X=>{let le=E.get(X.id),me=X.subtasks?F(X.subtasks):void 0,Ge=me?.some(Bt=>Bt.isCriticalPath||Bt.subtasks&&Bt.subtasks.some(zt=>zt.isCriticalPath))||false,We=le?le.isCritical:Ge;return {...X,isCriticalPath:We,cpmData:le||void 0,subtasks:me}});return F(fe)},[fe,f,be]),Ws=react.useMemo(()=>Se.flattenTasks(fe).some(F=>F.dependencies&&F.dependencies.length>0),[fe]),Hn=react.useMemo(()=>{let E=(F,H="")=>[...F].sort((le,me)=>(le.position??0)-(me.position??0)).map((le,me)=>{let Ge=me+1,We=H?`${H}.${Ge}`:`${Ge}.0`,Bt=H?`${H}.${Ge}`:`${Ge}`;return {...le,wbsCode:We,subtasks:le.subtasks?.length?E(le.subtasks,Bt):le.subtasks}});return E(ts)},[ts]),k=(a.searchQuery??"").trim(),Y=react.useMemo(()=>{let E=le();if(!k)return E;let F=me=>me.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),H=F(k),X=me=>{let Ge=[];for(let We of me){if(F(We.name||"").includes(H)){Ge.push(We);continue}let Bt=We.subtasks?.length?X(We.subtasks):[];Bt.length&&Ge.push({...We,subtasks:Bt});}return Ge};return X(E);function le(){if(Ba==="all"&&!Na)return Hn;let me=Ge=>{let We=[];for(let Bt of Ge){let zt=Bt.subtasks?.length?me(Bt.subtasks):void 0,Yt=false;if(Na)Yt=Bt.progress<100&&Bt.status!=="completed";else switch(Ba){case "all":Yt=true;break;case "incomplete":Yt=Bt.progress<100;break;case "in_progress":Yt=Bt.progress>0&&Bt.progress<100;break;case "completed":Yt=Bt.progress===100;break}(Yt||zt&&zt.length>0)&&We.push({...Bt,subtasks:zt});}return We};return me(Hn)}},[Hn,Ba,Na,k]),Q=Kw(ve);xg({undo:yt,redo:xt,canUndo:Xt,canRedo:Qt,enabled:true});let oe=react.useRef(null),ue=(E,F="start")=>{let H=vr.current,X=Do.current;if(!H||!X)return;let le=(E.getTime()-X.startDate.getTime())/(1e3*60*60*24),me=X.timeScale==="day"?60:X.timeScale==="week"?20:8,Ge=le*me*X.zoom,We=F==="center"?Ge-H.clientWidth/2:Ge-me*X.zoom*2;H.scrollTo({left:Math.max(0,We),behavior:"auto"});};react.useImperativeHandle(n,()=>({getTask:E=>Se.findTaskById(fe,E),addTask:(E,F)=>{j(H=>{if(!F)return [...H,{...E,level:0}];let X=le=>le.map(me=>me.id===F?{...me,subtasks:[...me.subtasks||[],{...E,parentId:F,level:(me.level||0)+1}],isExpanded:true}:me.subtasks?{...me,subtasks:X(me.subtasks)}:me);return X(H)});},updateTask:(E,F)=>{j(H=>{let X=le=>le.map(me=>me.id===E?{...me,...F}:me.subtasks?{...me,subtasks:X(me.subtasks)}:me);return X(H)});},deleteTask:E=>{j(F=>{let H=X=>X.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=H(le.subtasks)),true));return H(F)});},deleteTasks:E=>{j(F=>Ed(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=Se.findTaskById(fe,E);F&&a.onTaskDuplicate(F);}else j(F=>ci(F,[E]).tasks);},splitTask:(E,F,H=3)=>{j(X=>Se.splitTask(X,E,F,H));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(E,F)=>!Se.validateDependencies(fe,E,F),getAllTasks:()=>Se.flattenTasks(fe),getTasksByStatus:E=>Se.flattenTasks(fe).filter(F=>F.status===E),getTasksByParent:E=>E?Se.findTaskById(fe,E)?.subtasks||[]:fe.filter(H=>!H.parentId),getCriticalPath:()=>Se.flattenTasks(fe).filter(E=>E.isCriticalPath),indentTask:E=>{j(F=>Zr(Nd(F,[E])));},outdentTask:E=>{j(F=>Zr(Dd(F,[E])));},moveTask:(E,F)=>{j(H=>Sd(H,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:H}=Fd(fe,E);if($e){let X=$e({...H,parentId:E});if((X instanceof Promise?await X:X)===false)return}j(Zr(F)),St&&St({...H,parentId:E});},scrollToTask:E=>{let H=Se.flattenTasks(fe).findIndex(X=>X.id===E);if(H!==-1&&Br.current){let X=H*Q;Br.current.scrollTo({top:X,behavior:"smooth"}),vr.current&&vr.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{j(F=>{let H=X=>X.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:H(le.subtasks)}:le);return H(F)});},collapseTask:E=>{j(F=>{let H=X=>X.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:H(le.subtasks)}:le);return H(F)});},expandAll:()=>{j(E=>{let F=H=>H.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?F(X.subtasks):void 0}));return F(E)});},collapseAll:()=>{j(E=>{let F=H=>H.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?F(X.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{Pi(E);},undo:yt,redo:xt,canUndo:()=>Xt,canRedo:()=>Qt,clearHistory:cr,exportToPNG:async()=>{if(!No.current||!Br.current||!vr.current)throw new Error("Gantt container not found");let E=No.current,F=Br.current,H=es.current||F.querySelector(".gantt-grid-scroll"),X=vr.current,le=H?.scrollTop||0,me=X.scrollTop,Ge=E.style.overflow,We=E.style.height,Bt=F.style.overflow;try{let zt=H?.querySelector(".gantt-taskgrid-content"),Yt=X.querySelector("svg"),fr=zt?.scrollHeight||H?.scrollHeight||600,Gr=Yt?.getBoundingClientRect().height||X.scrollHeight,So=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(fr,Gr)+20;H&&(H.scrollTop=0),X.scrollTop=0,E.style.overflow="visible",E.style.height=`${So}px`,F.style.overflow="visible",await new Promise(os=>setTimeout(os,100));let Dn=await htmlToImage.toPng(E,{backgroundColor:sa.bgPrimary,pixelRatio:2,filter:os=>{if(!(os instanceof Element))return !0;let Ii=window.getComputedStyle(os),Gs=parseInt(Ii.zIndex,10);return (isNaN(Gs)||Gs<50)&&Ii.position!=="fixed"}});return await(await fetch(Dn)).blob()}finally{E.style.overflow=Ge,E.style.height=We,F.style.overflow=Bt,H&&(H.scrollTop=le),X.scrollTop=me;}},exportToPDF:async E=>{await Se.exportToPDF(fe,E);},exportToExcel:async E=>{await Se.exportToExcel(fe,E,pc.current);},exportToJSON:()=>Se.exportToJSON(fe),exportToCSV:()=>Se.exportToCSV(fe),importFromJSON:E=>{let F=Se.importFromJSON(E);j(F);},getTasks:()=>fe,refresh:()=>{j(E=>[...E]);},clearAll:()=>{j([]);},scrollToDate:(E,F="start")=>ue(E,F),fitToDates:(E,F)=>{let H=Math.max(1,(F.getTime()-E.getTime())/864e5),X=H<=21?"day":H<=122?"week":"month";oe.current=E,K(X),X===Do.current?.timeScale&&requestAnimationFrame(()=>{let le=oe.current;oe.current=null,le&&ue(le);});},scrollToToday:()=>{let E=vr.current,F=Do.current;if(!E||!F)return;let X=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),le=F.timeScale==="day"?60:F.timeScale==="week"?20:8,me=X*le*F.zoom,Ge=E.clientWidth,We=Math.max(0,me-Ge/2);E.scrollTo({left:We,behavior:"smooth"});}}),[fe,yt,xt,Xt,Qt,cr,sa,Q]);let He=react.useCallback(E=>{$n(F=>F.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),ee=react.useCallback((E,F)=>{$n(H=>H.map(X=>{if(X.id!==E)return X;let le=X.minWidth??100,me=X.maxWidth??800,Ge=Math.max(le,Math.min(me,F));return {...X,width:Ge}}));},[]),Ne=react.useCallback(E=>{j(F=>{let H=Pd(F,E),X=le=>{for(let me of le){if(me.id===E){ua.current.set(E,me.isExpanded??true);return}me.subtasks?.length&&X(me.subtasks);}};return X(H),Bn(),H}),a.onTaskToggleExpand?.(E);},[a,Bn]),Fe=react.useCallback((E,F)=>{if(mt&&mt(E,F)===false)return;let X=Se.findTaskById(fe,E)?.progress,le=Ge=>Ge.map(We=>We.id===E?{...We,...F}:We.subtasks?{...We,subtasks:le(We.subtasks)}:We);j(Ge=>le(Ge));let me=Se.findTaskById(le(fe),E);me&&(ce?.(me),gt?.(me),F.progress!==void 0&&X!==void 0&&F.progress!==X&&Le?.(E,X,F.progress));},[fe,ce,mt,gt,Le]),je=react.useCallback((E,F,H)=>{if(E.length===0)return;let X=new Set(E),le=me=>me.map(Ge=>{let We=X.has(Ge.id)?{...Ge,[F]:H}:Ge;return We.subtasks?{...We,subtasks:le(We.subtasks)}:We});j(me=>{let Ge=le(me);return a.onBulkFill?.(E,F,H,Ge),Ge});},[a]),Ht=react.useCallback(E=>{E.length!==0&&(qr.current+=1,Zn.current=true,j(F=>Zr(Nd(F,E))),a.onTaskIndent?.(E[0]));},[a]),it=react.useCallback(E=>{E.length!==0&&(qr.current+=1,Zn.current=true,j(F=>Zr(Dd(F,E))),a.onTaskOutdent?.(E[0]));},[a]),ot=react.useCallback((E,F,H)=>{qr.current+=1,Zn.current=true,j(X=>Zr(og(X,E,F,H))),a.onTaskReparent?.(E,F,H);},[a]),ea=react.useCallback((E,F)=>{E.length!==0&&(qr.current+=1,Zn.current=true,j(H=>Sd(H,E,F)),a.onTaskMove?.(E[0],F));},[a]),nt=react.useCallback(async E=>{let F=[];for(let H of E)De&&await Promise.resolve(De(H))===false||F.push(H);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(j(H=>Zr(Ed(H,F))),F.forEach(H=>a.onTaskDelete?.(H))),ft&&F.forEach(H=>ft(H)));},[a,De,ft]),ta=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let H=Se.findTaskById(fe,F);H&&a.onTaskDuplicate(H);}):j(F=>ci(F,E).tasks);},[a,fe]),vt=react.useCallback((E,F)=>{j(H=>{let{tasks:X,newTask:le}=ng(H,E,F);return $e&&$e(le)===false?H:(a.onTaskCreate?.(le.parentId,le.position||0),St?.(le),X)});},[a,$e,St]),It=react.useCallback((E,F)=>{j(H=>Md(H,E,F)),a.onTaskRename?.(E,F);},[a]),lt=react.useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let H=vs(fe,E);if(H){F(H);return}}j(H=>{let{tasks:X}=Fd(H,E);return a.onTaskCreate?.(E,0),X});},[a,fe]),Rt=react.useCallback((E,F)=>{let H=Math.max(0,Math.min(100,Math.round(F))),X={progress:H};H===100?X.status="completed":H>0?X.status="in-progress":X.status="todo",Fe(E.id,X);},[Fe]),$a=react.useCallback((E,F,H)=>{let X=!E.startDate&&!E.endDate,le=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,me=zt=>zt.map(Yt=>Yt.id===E.id?{...Yt,startDate:F,endDate:H,...E.segments&&{segments:E.segments}}:Yt.subtasks?{...Yt,subtasks:me(Yt.subtasks)}:Yt),Ge=me(fe),We=Ge;Ge=Se.autoScheduleDependents(Ge,E.id,le),Ge=Zr(Ge),j(Ge);let Bt={...E,startDate:F,endDate:H};if(X&&a?.onTaskDateChange?a.onTaskDateChange(E,F,H):ce?.(Bt),Be&&le!==0){let zt=Se.flattenTasks(We),Yt=Se.flattenTasks(Ge),fr=[];for(let Gr of Yt){if(Gr.id===E.id)continue;let ao=zt.find(Dn=>Dn.id===Gr.id);if(!ao)continue;let ns=Gr.startDate?.getTime()!==ao.startDate?.getTime(),So=Gr.endDate?.getTime()!==ao.endDate?.getTime();(ns||So)&&fr.push(Gr);}fr.length>0&&Be(fr);}},[fe,ce,Be,a]),wr=react.useCallback((E,F)=>{Re?.(E,F),Te({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Re]),Er=react.useCallback((E,F)=>{let H=Se.splitTask(fe,E.id,F);j(H),Te({isOpen:false,x:0,y:0,task:null});},[fe]),dr=react.useCallback(E=>{let F=Se.findTaskById(fe,E.id)||E;ne?.(F),Pe||W(F);},[fe,ne,Pe]),ja=react.useCallback((E,F,H)=>{let X=new Map,le=zt=>{zt.forEach(Yt=>{Yt.dependencies&&X.set(Yt.id,Yt.dependencies),Yt.subtasks&&le(Yt.subtasks);});};le(H);let me=X.get(F)||[];X.set(F,[...me,E]);let Ge=new Set,We=new Set,Bt=zt=>{if(!Ge.has(zt)){Ge.add(zt),We.add(zt);let Yt=X.get(zt)||[];for(let fr of Yt){if(!Ge.has(fr)&&Bt(fr))return true;if(We.has(fr))return true}}return We.delete(zt),false};return Bt(F)},[]),to=react.useCallback((E,F)=>{if(ja(E.id,F,Qn.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 H=Y=>Y.map(le=>{if(le.id===F){let ge=le.dependencies||[];if(!ge.includes(E.id))return {...le,dependencies:[...ge,E.id]}}return le.subtasks?{...le,subtasks:H(le.subtasks)}:le});_r.current+=1,_(Y=>H(Y)),je?.(E.id,F);},[je,Va]),as=react.useCallback((E,F)=>{let H=Y=>Y.map(le=>{if(le.id===E&&le.dependencies){let ge=le.dependencies.filter(We=>We!==F);return {...le,dependencies:ge}}return le.subtasks?{...le,subtasks:H(le.subtasks)}:le});_r.current+=1,_(Y=>H(Y)),et?.(E,F);},[et]),{startDate:kr,endDate:uc}=react.useMemo(()=>{let E=be.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,We=new Date(ge);We.setDate(We.getDate()-30);let He=new Date(ge);return He.setDate(He.getDate()+60),{startDate:We,endDate:He}}let F=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),H=new Date(Math.min(...F.map(ge=>ge.getTime()))),Y=new Date(Math.max(...F.map(ge=>ge.getTime()))),le=I==="day"?7:I==="week"?14:30;return H.setDate(H.getDate()-le),Y.setDate(Y.getDate()+le),{startDate:H,endDate:Y}},[be,I]);react.useEffect(()=>{hr.current?.(kr,uc);},[kr,uc]);let Fb=react.useCallback(async()=>{if(!No.current||!Br.current||!vr.current)return;await new Promise(So=>setTimeout(So,200));let E=No.current,F=Br.current,H=es.current||F.querySelector(".gantt-grid-scroll"),Y=vr.current,le=H?.scrollTop||0,ge=H?.scrollLeft||0,We=Y.scrollTop,He=Y.scrollLeft,Mt=E.style.overflow,$t=E.style.height,jt=H?.style.overflow||"",gr=Y.style.overflow,zr=F.style.overflow,ao=E.style.width,ns=Y.style.width;try{let So=H?.querySelector(".gantt-taskgrid-content"),Dn=Y.querySelector("svg"),fc=Dn?.getAttribute("height")?parseInt(Dn.getAttribute("height"),10):Dn?.getBoundingClientRect().height||0,os=So?.scrollHeight||H?.scrollHeight||600,Ii=Math.max(fc,Y.scrollHeight),Gs=Dn?.getAttribute("width")?parseInt(Dn.getAttribute("width"),10):Dn?.getBoundingClientRect().width||Y.scrollWidth,Hb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,bc=Math.max(os,Ii,fc),Qu=Hb+bc+50,Zu=(H?.offsetWidth||F.offsetWidth||300)+Gs+10;H&&(H.scrollTop=0,H.scrollLeft=0),Y.scrollTop=0,Y.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Qu}px`,E.style.width=`${Zu}px`,F.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${bc+50}px`),Y.style.overflow="visible",Y.style.height=`${bc+50}px`,Y.style.width=`${Gs+10}px`,await new Promise(Ri=>setTimeout(Ri,150));let Ub=await htmlToImage.toPng(E,{backgroundColor:ta.bgPrimary,pixelRatio:2,width:Zu,height:Qu,skipFonts:!1,filter:Ri=>{if(!(Ri instanceof Element))return !0;let ep=window.getComputedStyle(Ri),tp=parseInt(ep.zIndex,10);return !(!isNaN(tp)&&tp>=50||ep.position==="fixed")}}),hc=document.createElement("a");hc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,hc.href=Ub,hc.click();}finally{E.style.overflow=Mt,E.style.height=$t,E.style.width=ao,F.style.overflow=zr,H&&(H.style.overflow=jt,H.style.height="",H.scrollTop=le,H.scrollLeft=ge),Y.style.overflow=gr,Y.style.height="",Y.style.width=ns,Y.scrollTop=We,Y.scrollLeft=He;}u?.("png");},[ta,u]),Lb=react.useCallback(async()=>{await Me.exportToPDF(be),u?.("pdf");},[be,u]),pc=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});pc.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let Ab=react.useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let E=new Date,F=le=>String(le).padStart(2,"0"),H=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,Y=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Me.exportToExcel(be,`${Y}_${H}.xlsx`,pc.current),u?.("excel");},[be,p,u,a.onExportExcel]),Ib=react.useCallback(()=>{let E=Me.exportToCSV(be),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),u?.("csv");},[be,u]),Rb=react.useCallback(()=>{let E=Me.exportToJSON(be),F=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),u?.("json");},[be,u]),Bb=react.useCallback(()=>{Me.exportToMSProject(be,"Gantt Project","project.xml"),u?.("msproject");},[be,u]),$b=E=>{E.preventDefault(),he(true);},rs=react.useRef(false),[mc,Yu]=react.useState(false),zs=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=vr.current,F=Br.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let H=()=>{if(rs.current)return;rs.current=true;let He=E.scrollTop;pt(He),F.scrollTop=He,requestAnimationFrame(()=>{rs.current=false;});},Y=()=>{if(rs.current)return;rs.current=true;let He=F.scrollTop;pt(He),E.scrollTop=He,requestAnimationFrame(()=>{rs.current=false;});},le=He=>{if(j&&F){let $t=F.parentElement?.getBoundingClientRect()?.left||0,jt=He.clientX-$t,gr=200,zr=sn+Li,ao=window.innerWidth*On,ns=Math.max(zr,ao);jt>=gr&&jt<=ns&&B(jt);}if(mc&&E){let Mt=He.clientX-zs.current.x,$t=He.clientY-zs.current.y;E.scrollLeft=zs.current.scrollLeft-Mt,E.scrollTop=zs.current.scrollTop-$t;}},ge=()=>{he(false),Yu(false);},We=He=>{if(He.button!==0)return;let Mt=He.target;Mt.closest("[data-task-bar]")||Mt.closest("[data-dependency-line]")||Mt.closest("button")||Mt.closest('[role="button"]')||Mt.tagName==="rect"&&Mt.getAttribute("data-clickable")==="true"||(Yu(true),zs.current={x:He.clientX,y:He.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},He.preventDefault());};return E.addEventListener("scroll",H),F.addEventListener("scroll",Y),E.addEventListener("mousedown",We),document.addEventListener("mousemove",le),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",H),F.removeEventListener("scroll",Y),E.removeEventListener("mousedown",We),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ge);}},[j,mc,sn]),Do.current={startDate:kr,timeScale:I,zoom:pe};let gc=a.onTodayVisibilityChange,Xu=react.useRef(null);react.useEffect(()=>{if(!gc)return;let E=vr.current;if(!E)return;let F=I==="day"?60:I==="week"?20:8,H=()=>{let ge=(new Date().getTime()-kr.getTime())/(1e3*60*60*24)*F*pe,We=E.scrollLeft,He=We+E.clientWidth,Mt=ge>=We&&ge<=He;Xu.current!==Mt&&(Xu.current=Mt,gc(Mt));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[gc,kr,I,pe]);let Ju=react.useRef(false),Ob=react.useRef(null);return react.useLayoutEffect(()=>{if(Ju.current||be.length===0||!vr.current)return;Ju.current=true,Ob.current=kr;let E=vr.current,F=new Date,H=I==="day"?60:I==="week"?20:8,Y=(F.getTime()-kr.getTime())/(1e3*60*60*24),le=E.clientWidth,We=Y*H*pe-le/2;Y>=0&&le>0&&(E.scrollLeft=Math.max(0,We));},[be.length,kr,I,pe]),react.useLayoutEffect(()=>{let E=se.current;!E||Do.current?.timeScale!==I||(se.current=null,me(E));},[I,kr,pe]),jsxRuntime.jsx(ys.Provider,{value:qa,children:jsxRuntime.jsx(kc.Provider,{value:dc,children:jsxRuntime.jsxs("div",{ref:No,className:"flex flex-col h-full w-full",style:{backgroundColor:ta.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ta.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ta.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsxRuntime.jsx(gl,{enCabecera:!!U,theme:ta,timeScale:I,onTimeScaleChange:K,zoom:pe,onZoomChange:rt,currentTheme:J,onThemeChange:ot,rowDensity:we,onRowDensityChange:Ge,showThemeSelector:c,showCreateTaskButton:P&&xt?.canCreateTask!==false&&!xt?.canCreateSubtaskOnly,createTaskLabel:$,onCreateTask:T,taskFilter:Ia,onTaskFilterChange:sr,hideCompleted:Ta,onHideCompletedChange:Rr,toolbarRightContent:N,wbsLevel:bt,onWbsLevelChange:O?void 0:Pi,maxWbsDepth:yr,viewMode:kt,onViewModeChange:Se?de:void 0,projectForecast:G,hideForecastHud:ve,onExportPNG:l?Fb:void 0,onExportPDF:l?Lb:void 0,onExportExcel:l?Ab:void 0,onExportCSV:l?Ib:void 0,onExportJSON:l?Rb:void 0,onExportMSProject:l?Bb:void 0,showCriticalPath:tt,onShowCriticalPathChange:At,showDependencies:Wt,onShowDependenciesChange:er,highlightWeekends:vt,onHighlightWeekendsChange:fa,showBaseline:De,onShowBaselineChange:F=>{F&&kt!=="oracle"&&de("oracle"),!F&&kt==="oracle"&&de("execution");},onCopySnapshotLink:Ke,hasDependencies:Ws});return U?reactDom.createPortal(E,U):jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxRuntime.jsxs("div",{ref:Br,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:es,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ai,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(hl,{tasks:q,allTasks:Hn,theme:ta,rowHeight:Q,availableUsers:d,templates:Us,showCriticalPath:tt,onTaskClick:ye,onTaskSelectionChange:V,selectedTaskId:Ue,onTaskDblClick:lr,onTaskContextMenu:Be,onTaskToggle:Pe,scrollTop:fe,columns:on,onToggleColumn:Oe,onColumnResize:ae,onTaskUpdate:Ie,onBulkFill:Xe,onTaskIndent:It,onTaskOutdent:mt,onTaskMove:pa,onMultiTaskDelete:Vt,onTaskDuplicate:Ya,onTaskCreate:Kt,onTaskRename:aa,onCreateSubtask:Dt,onOpenTaskModal:ye?E=>ye(E):void 0,onDeleteRequest:(E,F)=>ke({taskIds:E,taskName:F}),onTaskReparent:ft,scrollContainerRef:es})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:ta.border,zIndex:15},onMouseDown:$b}),jsxRuntime.jsx("div",{ref:vr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:mc?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Tl,{tasks:q,theme:ta,rowHeight:Q,timeScale:I,startDate:kr,endDate:uc,zoom:pe,locale:w,templates:Us,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:ye,onTaskDblClick:lr,onTaskContextMenu:wr,onTaskDateChange:Ra,onTaskProgressDrag:Ot,onDependencyCreate:to,onDependencyDelete:as,showBaseline:De,showCriticalPath:tt,showDependencies:Wt,highlightWeekends:vt,weekHeaderFormat:a.weekHeaderFormat,canEditTask:xt?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),Z.task&&jsxRuntime.jsx(xs,{isOpen:Z.isOpen,x:Z.x,y:Z.y,theme:ta,onClose:()=>Te({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Z.task;if(!E)return [];let F=Me.findTaskById(be,E.id)||E,H=F.subtasks&&F.subtasks.length>0,Y=xt?.canCreateTask!==false,le=xt?.canDeleteTask!==false;if(H){let $t=[],jt=xt?.canDuplicateTask!==false;return Y&&$t.push({id:"addSubtask",label:qa.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{$e?$e(F):Dt(F.id);}}),jt&&$t.push({id:"duplicate",label:qa.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):_(gr=>ci(gr,[F.id]).tasks),Te({isOpen:false,x:0,y:0,task:null});}}),le&&($t.length>0&&$t.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),$t.push({id:"delete",label:qa.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ke({taskIds:[F.id],taskName:F.name});}})),$t}let ge=xt?.canUpdateTask!==false,We=xt?.canDuplicateTask!==false,He=[];return ge&&He.push({id:"edit",label:qa.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{Le?Le(F):W(F);}}),Y&&He.push({id:"addSubtask",label:qa.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{$e?$e(F):Dt(F.id);}}),He.length>0&&ge&&He.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(He.push({id:"markIncomplete",label:qa.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{Ve?Ve(F):Ie(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),He.push({id:"setInProgress",label:qa.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{oe?oe(F):Ie(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),He.push({id:"markComplete",label:qa.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{Ie(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(We||ge&&F.startDate&&F.endDate)&&He.length>0&&He.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),We&&He.push({id:"duplicate",label:qa.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):_($t=>ci($t,[F.id]).tasks),Te({isOpen:false,x:0,y:0,task:null});}}),ge&&F.startDate&&F.endDate&&He.push({id:"split",label:qa.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let $t=F.startDate.getTime(),jt=F.endDate.getTime(),gr=$t+(jt-$t)/2,zr=new Date(gr);Er(F,zr);}}),le&&(He.length>0&&He.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),He.push({id:"delete",label:qa.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ke({taskIds:[F.id],taskName:F.name});}})),He})()}),jsxRuntime.jsx(Io,{task:D,isOpen:!!D,onClose:()=>W(null),onTaskUpdate:E=>{D&&(Ie(D.id,E),W(null));},theme:J==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ue&&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:()=>ke(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:ta.bgSecondary,border:`1px solid ${ta.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ta.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:ta.textPrimary,fontFamily:"Inter, sans-serif"},children:[qa.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ta.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:ta.textSecondary,fontFamily:"Inter, sans-serif"},children:ue.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:ta.textPrimary},children:[ue.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:ta.textPrimary},children:['"',ue.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ta.bgPrimary,borderTop:`1px solid ${ta.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ke(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ta.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=ta.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(ue.taskIds),ke(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(Sl,{tasks:be,theme:ta,config:x,onTasksUpdate:_,onTaskUpdate:Ie,onTaskCreate:E=>{_(F=>[...F,E]);},onTaskDelete:E=>{Vt([E]);},onDependencyCreate:(E,F)=>{let H=Me.findTaskById(be,E);H&&to(H,F);},onDependencyDelete:as})]})})})});function nk(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ok(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[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 Id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Rd=[{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 Eg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let b=[...Id,...l.filter(L=>!Id.some(J=>J.id===L.id))],h=dt[c]||dt.dark,[y,x]=react.useState(false),[w,C]=react.useState(false),[P,$]=react.useState(false),[T,S]=react.useState(false),[M,N]=react.useState({top:0,left:0}),[U,O]=react.useState(null),[X,A]=react.useState(new Date),[Se,G]=react.useState({top:0,left:0}),[ve,R]=react.useState(false),[ye,V]=react.useState([]),[Ue,ne]=react.useState(false),[Be,ce]=react.useState(""),Ne=react.useRef(null),ze=react.useRef(null),Le=react.useRef(null),$e=react.useRef(null),Ve=react.useRef(null),[oe,je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[et,Re]=react.useState({});react.useEffect(()=>{a?(je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(je({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),V([]));},[a,e,v]),react.useEffect(()=>{let L=J=>{Ne.current&&!Ne.current.contains(J.target)&&x(false),ze.current&&!ze.current.contains(J.target)&&C(false),Le.current&&!Le.current.contains(J.target)&&$(false),$e.current&&!$e.current.contains(J.target)&&S(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let ut=()=>{let L={};return oe.name.trim()||(L.name="El nombre es requerido"),oe.startDate&&oe.endDate&&oe.startDate>oe.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Re(L),Object.keys(L).length===0},Nt=async L=>{if(L.preventDefault(),!!ut())try{let J=i==="create"&&ye.length>0?{...oe,pendingFiles:ye}:oe;await s(J),V([]),t();}catch(J){console.error("Error submitting task:",J);}},lt=(L,J)=>{je(Ce=>{let I={...Ce,[L]:J};if(L==="status"){let K=J;K==="todo"?I.progress=0:K==="in-progress"?(Ce.progress===0||Ce.progress===100)&&(I.progress=50):K==="completed"||K==="closed"?I.progress=100:(K==="in-review"||K==="review")&&(I.progress=75);}if(L==="progress"){let K=typeof J=="number"?J:parseInt(J,10);K===100&&Ce.status!=="completed"?I.status="completed":K>0&&K<100&&Ce.status==="todo"?I.status="in-progress":K===0&&Ce.status!=="todo"&&(I.status="todo");}return I}),et[L]&&Re(Ce=>{let I={...Ce};return delete I[L],I});},Ee=b.find(L=>L.id===oe.status)??Id[0],ct=Rd.find(L=>L.id===oe.priority)??Rd[1],xt=Ao.find(L=>L.value===oe.color)??Ao[0],Ke=c==="dark",st={backgroundColor:Ke?"#1d1f27":h.bgSecondary,border:`1px solid ${Ke?"rgba(65,71,84,0.1)":h.borderLight}`,color:h.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:Ke?"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:Ke?"#0a0a0a":h.bgPrimary,border:`1px solid ${Ke?"rgba(65,71,84,0.1)":h.border}`,boxShadow:Ke?"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:Nt,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:oe.name,onChange:L=>lt("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:h.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),et.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"}),et.name]}),jsxRuntime.jsx("textarea",{value:oe.description||"",onChange:L=>lt("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:h.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":h.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:Ne,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:{...st,borderColor:Ee.color,backgroundColor:`${Ee.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Ee.color}}),jsxRuntime.jsx("span",{style:{color:Ee.color},children:Ee.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Ee.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:Ke?"#0a0a0a":h.bgPrimary,backdropFilter:Ke?"blur(16px)":void 0,border:`1px solid ${Ke?"#262626":h.border}`,boxShadow:Ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:b.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:h.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{lt("status",L.id),x(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,oe.status===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},L.id))})})]}),jsxRuntime.jsxs("div",{ref:ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&C(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsxRuntime.jsx("span",{children:ct.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.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:Ke?"#0a0a0a":h.bgPrimary,backdropFilter:Ke?"blur(16px)":void 0,border:`1px solid ${Ke?"#262626":h.border}`,boxShadow:Ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Rd.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:h.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{lt("priority",L.id),C(false);},children:[jsxRuntime.jsx("span",{children:L.icon}),L.label,oe.priority===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},L.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:Le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&$(!P),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[oe.assignees&&oe.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:oe.assignees.slice(0,3).map((L,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:L.color||h.accent,borderColor:h.bgSecondary},children:L.initials},J))}),oe.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",oe.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&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:Ke?"#0a0a0a":h.bgPrimary,backdropFilter:Ke?"blur(16px)":void 0,border:`1px solid ${Ke?"#262626":h.border}`,boxShadow:Ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let J=oe.assignees?.some(Ce=>Ce.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:h.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Ce=J?(oe.assignees||[]).filter(I=>I.name!==L.name):[...oe.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),color:h.accent}];lt("assignees",Ce);},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:h.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:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},L.id)})})})]}),jsxRuntime.jsxs("div",{ref:$e,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)S(false);else {if($e.current){let L=$e.current.getBoundingClientRect(),J=window.innerHeight,Ce=120,K=J-L.bottom<Ce?L.top-Ce-8:L.bottom+8;N({top:K,left:L.left});}S(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:oe.color}}),jsxRuntime.jsx("span",{children:xt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(ma,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(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:`${M.top}px`,left:`${M.left}px`,zIndex:99999,backgroundColor:Ke?"#0a0a0a":h.bgPrimary,backdropFilter:Ke?"blur(16px)":void 0,border:`1px solid ${Ke?"#262626":h.border}`,boxShadow:Ke?"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:Ao.slice(0,18).map(L=>{let J=oe.color===L.value;return jsxRuntime.jsx("button",{type:"button",onClick:Ce=>{Ce.preventDefault(),Ce.stopPropagation(),lt("color",L.value),S(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:J?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),u.length>0||p?jsxRuntime.jsx(cs,{selectedTags:oe.tags||[],availableTags:u,onChange:L=>lt("tags",L),onCreateTag:p,theme:h,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:h.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ke?"#191b22":h.bgSecondary,borderRadius:8,border:`1px solid ${Ke?"rgba(65,71,84,0.05)":h.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:Ve,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!oe.isMilestone)if(U==="start")O(null);else {if(Ve.current){let L=Ve.current.getBoundingClientRect();G({top:L.bottom+8,left:Math.max(16,L.left-40)});}O("start"),A(oe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...st,opacity:oe.isMilestone?.5:1,cursor:oe.isMilestone?"not-allowed":"pointer"},disabled:o||oe.isMilestone,children:oe.startDate?oe.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!oe.isMilestone)if(U==="end")O(null);else {if(Ve.current){let L=Ve.current.getBoundingClientRect();G({top:L.bottom+8,left:Math.max(16,L.left-40)});}O("end"),A(oe.endDate||oe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...st,opacity:oe.isMilestone?.5:1,cursor:oe.isMilestone?"not-allowed":"pointer"},disabled:o||oe.isMilestone,children:oe.endDate?oe.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(ma,{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:`${Se.top}px`,left:`${Se.left}px`,zIndex:99999,backgroundColor:Ke?"#0a0a0a":h.bgPrimary,border:`1px solid ${Ke?"#262626":h.border}`,boxShadow:Ke?"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 ${Ke?"#262626":h.border}`},children:[(()=>{let L=new Date,J=new Date(L);J.setDate(L.getDate()+1);let Ce=new Date(L);Ce.setDate(L.getDate()+7);let I=new Date(L);return I.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:Ce},{label:"2 semanas",date:I}].map((we,Ge)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:pe=>pe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:pe=>pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{U==="start"?(lt("startDate",we.date),(!oe.endDate||we.date>oe.endDate)&&lt("endDate",we.date),O("end")):(lt("endDate",we.date),(!oe.startDate||we.date<oe.startDate)&&lt("startDate",we.date),O(null));},children:we.label},Ge))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.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=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{lt("startDate",void 0),lt("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:()=>A(new Date(X.getFullYear(),X.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:X.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(X.getFullYear(),X.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,J)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:L},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=X.getFullYear(),J=X.getMonth(),Ce=new Date(L,J,1).getDay(),I=new Date(L,J+1,0).getDate(),K=new Date,we=[];for(let pe=Ce-1;pe>=0;pe--)we.push({day:new Date(L,J,-pe).getDate(),date:new Date(L,J-1,new Date(L,J,-pe).getDate()),isCurrentMonth:false});for(let pe=1;pe<=I;pe++)we.push({day:pe,date:new Date(L,J,pe),isCurrentMonth:true});let Ge=42-we.length;for(let pe=1;pe<=Ge;pe++)we.push({day:pe,date:new Date(L,J+1,pe),isCurrentMonth:false});return we.map((pe,rt)=>{let bt=pe.date.toDateString()===K.toDateString(),qe=oe.startDate?.toDateString()===pe.date.toDateString(),ht=oe.endDate?.toDateString()===pe.date.toDateString(),Yt=oe.startDate&&oe.endDate&&pe.date>=oe.startDate&&pe.date<=oe.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:pe.isCurrentMonth?qe||ht?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:qe?h.accent:ht?"#7C3AED":Yt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:bt&&!qe&&!ht?`inset 0 0 0 1px ${h.accent}`:"none"},onClick:()=>{U==="start"?(lt("startDate",pe.date),oe.endDate&&pe.date>oe.endDate&&lt("endDate",pe.date),O("end")):(lt("endDate",pe.date),oe.startDate&&pe.date<oe.startDate&&lt("startDate",pe.date),O(null));},children:pe.day},rt)})})()})]})]})]})})]}),et.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:et.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:h.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[oe.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ke?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let J=L.currentTarget.getBoundingClientRect(),Ce=Math.round((L.clientX-J.left)/J.width*100/5)*5;lt("progress",Math.max(0,Math.min(100,Ce)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${oe.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Ke?"rgba(65,71,84,0.05)":h.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(!ve),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:h.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${ve?"":"-rotate-90"}`,style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ve&&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:h.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:h.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:oe.effortMinutes?nk(oe.effortMinutes):"",onChange:L=>{let J=ok(L.target.value);lt("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`}})]}),r.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:h.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:h.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:oe.parentId||"",onChange:L=>lt("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(L=>L.id!==a?.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:h.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:oe.location||"",onChange:L=>lt("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.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:h.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:oe.equipment||"",onChange:L=>lt("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o})]})]}),(m||d.length>0||i==="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:h.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:h.textTertiary},children:["Adjuntos ",i==="create"?ye.length>0&&`(${ye.length})`:d.length>0&&`(${d.length})`]})]}),i==="create"?jsxRuntime.jsx(ms,{cardId:"pending",attachments:ye.map((L,J)=>({id:`pending-${J}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>V(J=>[...J,...L]),onDelete:L=>{let J=parseInt(L.replace("pending-",""),10);V(Ce=>Ce.filter((I,K)=>K!==J));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(ms,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?L=>m(a.id,L):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),i==="create"&&ye.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[ye.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=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:oe.isMilestone,onChange:L=>lt("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:o}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:h.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:h.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),oe.dependencies&&oe.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:oe.dependencies.map(L=>{let J=r.find(Ce=>Ce.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:`${h.accent}20`,color:h.accent},children:[J?.name||L.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Ce=(oe.dependencies||[]).filter(I=>I!==L);lt("dependencies",Ce);},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:()=>{ne(!Ue),ce("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:h.bgSecondary,color:h.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:()=>{ne(false),ce("");}}),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:Ke?"#0a0a0a":h.bgPrimary,backdropFilter:Ke?"blur(16px)":void 0,border:`1px solid ${Ke?"#262626":h.border}`,boxShadow:Ke?"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 ${h.border}`},children:jsxRuntime.jsx("input",{type:"text",value:Be,onChange:L=>ce(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:h.bgSecondary,color:h.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(L=>L.id!==a?.id).filter(L=>Be===""||L.name.toLowerCase().includes(Be.toLowerCase())).map(L=>{let J=oe.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let Ce=oe.dependencies||[],I;J?I=Ce.filter(K=>K!==L.id):I=[...Ce,L.id],lt("dependencies",I);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${h.accent}10`:"transparent"},onMouseEnter:Ce=>{J||(Ce.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:Ce=>{Ce.currentTarget.style.backgroundColor=J?`${h.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?h.accent:"transparent",borderColor:J?h.accent:h.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:h.textPrimary},children:L.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:h.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),r.filter(L=>L.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:h.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 ${Ke?"rgba(65,71,84,0.1)":h.border}`,backgroundColor:Ke?"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:h.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=h.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=h.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:i==="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=X=>X.map(le=>{if(le.id===F){let me=le.dependencies||[];if(!me.includes(E.id))return {...le,dependencies:[...me,E.id]}}return le.subtasks?{...le,subtasks:H(le.subtasks)}:le});qr.current+=1,j(X=>H(X)),ze?.(E.id,F);},[ze,ja]),as=react.useCallback((E,F)=>{let H=X=>X.map(le=>{if(le.id===E&&le.dependencies){let me=le.dependencies.filter(Ge=>Ge!==F);return {...le,dependencies:me}}return le.subtasks?{...le,subtasks:H(le.subtasks)}:le});qr.current+=1,j(X=>H(X)),Xe?.(E,F);},[Xe]),{startDate:kr,endDate:uc}=react.useMemo(()=>{let E=fe.filter(me=>me.startDate&&me.endDate);if(E.length===0){let me=new Date,Ge=new Date(me);Ge.setDate(Ge.getDate()-30);let We=new Date(me);return We.setDate(We.getDate()+60),{startDate:Ge,endDate:We}}let F=E.flatMap(me=>[me.startDate,me.endDate]).filter(me=>me!==void 0),H=new Date(Math.min(...F.map(me=>me.getTime()))),X=new Date(Math.max(...F.map(me=>me.getTime()))),le=I==="day"?7:I==="week"?14:30;return H.setDate(H.getDate()-le),X.setDate(X.getDate()+le),{startDate:H,endDate:X}},[fe,I]);react.useEffect(()=>{ir.current?.(kr,uc);},[kr,uc]);let Fb=react.useCallback(async()=>{if(!No.current||!Br.current||!vr.current)return;await new Promise(So=>setTimeout(So,200));let E=No.current,F=Br.current,H=es.current||F.querySelector(".gantt-grid-scroll"),X=vr.current,le=H?.scrollTop||0,me=H?.scrollLeft||0,Ge=X.scrollTop,We=X.scrollLeft,Bt=E.style.overflow,zt=E.style.height,Yt=H?.style.overflow||"",fr=X.style.overflow,Gr=F.style.overflow,ao=E.style.width,ns=X.style.width;try{let So=H?.querySelector(".gantt-taskgrid-content"),Dn=X.querySelector("svg"),fc=Dn?.getAttribute("height")?parseInt(Dn.getAttribute("height"),10):Dn?.getBoundingClientRect().height||0,os=So?.scrollHeight||H?.scrollHeight||600,Ii=Math.max(fc,X.scrollHeight),Gs=Dn?.getAttribute("width")?parseInt(Dn.getAttribute("width"),10):Dn?.getBoundingClientRect().width||X.scrollWidth,Hb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,bc=Math.max(os,Ii,fc),Qu=Hb+bc+50,Zu=(H?.offsetWidth||F.offsetWidth||300)+Gs+10;H&&(H.scrollTop=0,H.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Qu}px`,E.style.width=`${Zu}px`,F.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${bc+50}px`),X.style.overflow="visible",X.style.height=`${bc+50}px`,X.style.width=`${Gs+10}px`,await new Promise(Ri=>setTimeout(Ri,150));let Ub=await htmlToImage.toPng(E,{backgroundColor:sa.bgPrimary,pixelRatio:2,width:Zu,height:Qu,skipFonts:!1,filter:Ri=>{if(!(Ri instanceof Element))return !0;let ep=window.getComputedStyle(Ri),tp=parseInt(ep.zIndex,10);return !(!isNaN(tp)&&tp>=50||ep.position==="fixed")}}),hc=document.createElement("a");hc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,hc.href=Ub,hc.click();}finally{E.style.overflow=Bt,E.style.height=zt,E.style.width=ao,F.style.overflow=Gr,H&&(H.style.overflow=Yt,H.style.height="",H.scrollTop=le,H.scrollLeft=me),X.style.overflow=fr,X.style.height="",X.style.width=ns,X.scrollTop=Ge,X.scrollLeft=We;}p?.("png");},[sa,p]),Lb=react.useCallback(async()=>{await Se.exportToPDF(fe),p?.("pdf");},[fe,p]),pc=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:u});pc.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:u};let Ab=react.useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),p?.("excel");return}let E=new Date,F=le=>String(le).padStart(2,"0"),H=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,X=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(fe,`${X}_${H}.xlsx`,pc.current),p?.("excel");},[fe,u,p,a.onExportExcel]),Ib=react.useCallback(()=>{let E=Se.exportToCSV(fe),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),p?.("csv");},[fe,p]),Rb=react.useCallback(()=>{let E=Se.exportToJSON(fe),F=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),p?.("json");},[fe,p]),Bb=react.useCallback(()=>{Se.exportToMSProject(fe,"Gantt Project","project.xml"),p?.("msproject");},[fe,p]),$b=E=>{E.preventDefault(),he(true);},rs=react.useRef(false),[mc,Yu]=react.useState(false),zs=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=vr.current,F=Br.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let H=()=>{if(rs.current)return;rs.current=true;let We=E.scrollTop;bt(We),F.scrollTop=We,requestAnimationFrame(()=>{rs.current=false;});},X=()=>{if(rs.current)return;rs.current=true;let We=F.scrollTop;bt(We),E.scrollTop=We,requestAnimationFrame(()=>{rs.current=false;});},le=We=>{if(_&&F){let zt=F.parentElement?.getBoundingClientRect()?.left||0,Yt=We.clientX-zt,fr=200,Gr=sn+Li,ao=window.innerWidth*On,ns=Math.max(Gr,ao);Yt>=fr&&Yt<=ns&&B(Yt);}if(mc&&E){let Bt=We.clientX-zs.current.x,zt=We.clientY-zs.current.y;E.scrollLeft=zs.current.scrollLeft-Bt,E.scrollTop=zs.current.scrollTop-zt;}},me=()=>{he(false),Yu(false);},Ge=We=>{if(We.button!==0)return;let Bt=We.target;Bt.closest("[data-task-bar]")||Bt.closest("[data-dependency-line]")||Bt.closest("button")||Bt.closest('[role="button"]')||Bt.tagName==="rect"&&Bt.getAttribute("data-clickable")==="true"||(Yu(true),zs.current={x:We.clientX,y:We.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},We.preventDefault());};return E.addEventListener("scroll",H),F.addEventListener("scroll",X),E.addEventListener("mousedown",Ge),document.addEventListener("mousemove",le),document.addEventListener("mouseup",me),()=>{E.removeEventListener("scroll",H),F.removeEventListener("scroll",X),E.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",me);}},[_,mc,sn]),Do.current={startDate:kr,timeScale:I,zoom:pe};let gc=a.onTodayVisibilityChange,Xu=react.useRef(null);react.useEffect(()=>{if(!gc)return;let E=vr.current;if(!E)return;let F=I==="day"?60:I==="week"?20:8,H=()=>{let me=(new Date().getTime()-kr.getTime())/(1e3*60*60*24)*F*pe,Ge=E.scrollLeft,We=Ge+E.clientWidth,Bt=me>=Ge&&me<=We;Xu.current!==Bt&&(Xu.current=Bt,gc(Bt));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[gc,kr,I,pe]);let Ju=react.useRef(false),Ob=react.useRef(null);return react.useLayoutEffect(()=>{if(Ju.current||fe.length===0||!vr.current)return;Ju.current=true,Ob.current=kr;let E=vr.current,F=new Date,H=I==="day"?60:I==="week"?20:8,X=(F.getTime()-kr.getTime())/(1e3*60*60*24),le=E.clientWidth,Ge=X*H*pe-le/2;X>=0&&le>0&&(E.scrollLeft=Math.max(0,Ge));},[fe.length,kr,I,pe]),react.useLayoutEffect(()=>{let E=oe.current;!E||Do.current?.timeScale!==I||(oe.current=null,ue(E));},[I,kr,pe]),jsxRuntime.jsx(ys.Provider,{value:Xa,children:jsxRuntime.jsx(kc.Provider,{value:dc,children:jsxRuntime.jsxs("div",{ref:No,className:"flex flex-col h-full w-full",style:{backgroundColor:sa.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...sa.dotGrid&&{backgroundImage:`radial-gradient(circle, ${sa.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsxRuntime.jsx(gl,{enCabecera:!!z,theme:sa,timeScale:I,onTimeScaleChange:K,zoom:pe,onZoomChange:tt,currentTheme:q,onThemeChange:st,rowDensity:ve,onRowDensityChange:Ue,showThemeSelector:c,showCreateTaskButton:P&&Ct?.canCreateTask!==false&&!Ct?.canCreateSubtaskOnly,createTaskLabel:O,onCreateTask:N,taskFilter:Ba,onTaskFilterChange:lr,hideCompleted:Na,onHideCompletedChange:Rr,toolbarRightContent:T,wbsLevel:ht,onWbsLevelChange:$?void 0:Pi,maxWbsDepth:yr,viewMode:Tt,onViewModeChange:Ae?Pt:void 0,projectForecast:U,hideForecastHud:we,onExportPNG:l?Fb:void 0,onExportPDF:l?Lb:void 0,onExportExcel:l?Ab:void 0,onExportCSV:l?Ib:void 0,onExportJSON:l?Rb:void 0,onExportMSProject:l?Bb:void 0,showCriticalPath:be,onShowCriticalPathChange:kt,showDependencies:Qe,onShowDependenciesChange:Ia,highlightWeekends:Nt,onHighlightWeekendsChange:ra,showBaseline:_t,onShowBaselineChange:F=>{F&&Tt!=="oracle"&&Pt("oracle"),!F&&Tt==="oracle"&&Pt("execution");},onCopySnapshotLink:_e,hasDependencies:Ws});return z?reactDom.createPortal(E,z):jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxRuntime.jsxs("div",{ref:Br,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:es,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ai,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(hl,{tasks:Y,allTasks:Hn,theme:sa,rowHeight:Q,availableUsers:d,templates:Us,showCriticalPath:be,onTaskClick:xe,onTaskSelectionChange:G,selectedTaskId:Ve,onTaskDblClick:dr,onTaskContextMenu:Re,onTaskToggle:Ne,scrollTop:ge,columns:Yr,onToggleColumn:He,onColumnResize:ee,onTaskUpdate:Fe,onBulkFill:je,onTaskIndent:Ht,onTaskOutdent:it,onTaskMove:ea,onMultiTaskDelete:nt,onTaskDuplicate:ta,onTaskCreate:vt,onTaskRename:It,onCreateSubtask:lt,onOpenTaskModal:xe?E=>xe(E):void 0,onDeleteRequest:(E,F)=>ke({taskIds:E,taskName:F}),onTaskReparent:ot,scrollContainerRef:es})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:sa.border,zIndex:15},onMouseDown:$b}),jsxRuntime.jsx("div",{ref:vr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:mc?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Tl,{tasks:Y,theme:sa,rowHeight:Q,timeScale:I,startDate:kr,endDate:uc,zoom:pe,locale:w,templates:Us,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:xe,onTaskDblClick:dr,onTaskContextMenu:wr,onTaskDateChange:$a,onTaskProgressDrag:Rt,onDependencyCreate:to,onDependencyDelete:as,showBaseline:_t,showCriticalPath:be,showDependencies:Qe,highlightWeekends:Nt,weekHeaderFormat:a.weekHeaderFormat,canEditTask:Ct?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),te.task&&jsxRuntime.jsx(xs,{isOpen:te.isOpen,x:te.x,y:te.y,theme:sa,onClose:()=>Te({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=te.task;if(!E)return [];let F=Se.findTaskById(fe,E.id)||E,H=F.subtasks&&F.subtasks.length>0,X=Ct?.canCreateTask!==false,le=Ct?.canDeleteTask!==false;if(H){let zt=[],Yt=Ct?.canDuplicateTask!==false;return X&&zt.push({id:"addSubtask",label:Xa.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{Oe?Oe(F):lt(F.id);}}),Yt&&zt.push({id:"duplicate",label:Xa.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):j(fr=>ci(fr,[F.id]).tasks),Te({isOpen:false,x:0,y:0,task:null});}}),le&&(zt.length>0&&zt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),zt.push({id:"delete",label:Xa.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{ke({taskIds:[F.id],taskName:F.name});}})),zt}let me=Ct?.canUpdateTask!==false,Ge=Ct?.canDuplicateTask!==false,We=[];return me&&We.push({id:"edit",label:Xa.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{Pe?Pe(F):W(F);}}),X&&We.push({id:"addSubtask",label:Xa.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{Oe?Oe(F):lt(F.id);}}),We.length>0&&me&&We.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),me&&(We.push({id:"markIncomplete",label:Xa.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{dt?dt(F):Fe(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),We.push({id:"setInProgress",label:Xa.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{Z?Z(F):Fe(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),We.push({id:"markComplete",label:Xa.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{Fe(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(Ge||me&&F.startDate&&F.endDate)&&We.length>0&&We.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&We.push({id:"duplicate",label:Xa.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):j(zt=>ci(zt,[F.id]).tasks),Te({isOpen:false,x:0,y:0,task:null});}}),me&&F.startDate&&F.endDate&&We.push({id:"split",label:Xa.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let zt=F.startDate.getTime(),Yt=F.endDate.getTime(),fr=zt+(Yt-zt)/2,Gr=new Date(fr);Er(F,Gr);}}),le&&(We.length>0&&We.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),We.push({id:"delete",label:Xa.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{ke({taskIds:[F.id],taskName:F.name});}})),We})()}),jsxRuntime.jsx(Io,{task:D,isOpen:!!D,onClose:()=>W(null),onTaskUpdate:E=>{D&&(Fe(D.id,E),W(null));},theme:q==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&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:()=>ke(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:sa.bgSecondary,border:`1px solid ${sa.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${sa.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:sa.textPrimary,fontFamily:"Inter, sans-serif"},children:[Xa.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:sa.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:sa.textSecondary,fontFamily:"Inter, sans-serif"},children:de.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:sa.textPrimary},children:[de.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:sa.textPrimary},children:['"',de.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:sa.bgPrimary,borderTop:`1px solid ${sa.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ke(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:sa.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=sa.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{nt(de.taskIds),ke(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(Sl,{tasks:fe,theme:sa,config:x,onTasksUpdate:j,onTaskUpdate:Fe,onTaskCreate:E=>{j(F=>[...F,E]);},onTaskDelete:E=>{nt([E]);},onDependencyCreate:(E,F)=>{let H=Se.findTaskById(fe,E);H&&to(H,F);},onDependencyDelete:as})]})})})});function nk(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ok(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[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 Id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Rd=[{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 Eg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:u,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let b=[...Id,...l.filter(A=>!Id.some(q=>q.id===A.id))],h=pt[c]||pt.dark,[y,x]=react.useState(false),[w,C]=react.useState(false),[P,O]=react.useState(false),[N,S]=react.useState(false),[M,T]=react.useState({top:0,left:0}),[z,$]=react.useState(null),[J,L]=react.useState(new Date),[Ae,U]=react.useState({top:0,left:0}),[we,R]=react.useState(false),[xe,G]=react.useState([]),[Ve,ne]=react.useState(false),[Re,ce]=react.useState(""),Be=react.useRef(null),Le=react.useRef(null),Pe=react.useRef(null),Oe=react.useRef(null),dt=react.useRef(null),[Z,ze]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Xe,$e]=react.useState({});react.useEffect(()=>{a?(ze({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(ze({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),G([]));},[a,e,v]),react.useEffect(()=>{let A=q=>{Be.current&&!Be.current.contains(q.target)&&x(false),Le.current&&!Le.current.contains(q.target)&&C(false),Pe.current&&!Pe.current.contains(q.target)&&O(false),Oe.current&&!Oe.current.contains(q.target)&&S(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let St=()=>{let A={};return Z.name.trim()||(A.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(A),Object.keys(A).length===0},mt=async A=>{if(A.preventDefault(),!!St())try{let q=i==="create"&&xe.length>0?{...Z,pendingFiles:xe}:Z;await s(q),G([]),t();}catch(q){console.error("Error submitting task:",q);}},gt=(A,q)=>{ze(Ce=>{let I={...Ce,[A]:q};if(A==="status"){let K=q;K==="todo"?I.progress=0:K==="in-progress"?(Ce.progress===0||Ce.progress===100)&&(I.progress=50):K==="completed"||K==="closed"?I.progress=100:(K==="in-review"||K==="review")&&(I.progress=75);}if(A==="progress"){let K=typeof q=="number"?q:parseInt(q,10);K===100&&Ce.status!=="completed"?I.status="completed":K>0&&K<100&&Ce.status==="todo"?I.status="in-progress":K===0&&Ce.status!=="todo"&&(I.status="todo");}return I}),Xe[A]&&$e(Ce=>{let I={...Ce};return delete I[A],I});},De=b.find(A=>A.id===Z.status)??Id[0],ft=Rd.find(A=>A.id===Z.priority)??Rd[1],Ct=Ao.find(A=>A.value===Z.color)??Ao[0],_e=c==="dark",ut={backgroundColor:_e?"#1d1f27":h.bgSecondary,border:`1px solid ${_e?"rgba(65,71,84,0.1)":h.borderLight}`,color:h.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:_e?"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:_e?"#0a0a0a":h.bgPrimary,border:`1px solid ${_e?"rgba(65,71,84,0.1)":h.border}`,boxShadow:_e?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.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:Z.name,onChange:A=>gt("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:h.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Xe.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"}),Xe.name]}),jsxRuntime.jsx("textarea",{value:Z.description||"",onChange:A=>gt("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:h.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":h.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:Be,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:{...ut,borderColor:De.color,backgroundColor:`${De.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:De.color}}),jsxRuntime.jsx("span",{style:{color:De.color},children:De.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:De.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:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:b.map(A=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{gt("status",A.id),x(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,Z.status===A.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},A.id))})})]}),jsxRuntime.jsxs("div",{ref:Le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&C(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ft.color}}),jsxRuntime.jsx("span",{children:ft.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.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:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Rd.map(A=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{gt("priority",A.id),C(false);},children:[jsxRuntime.jsx("span",{children:A.icon}),A.label,Z.priority===A.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},A.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:Pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&O(!P),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[Z.assignees&&Z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((A,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:A.color||h.accent,borderColor:h.bgSecondary},children:A.initials},q))}),Z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",Z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&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:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let q=Z.assignees?.some(Ce=>Ce.name===A.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:h.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Ce=q?(Z.assignees||[]).filter(I=>I.name!==A.name):[...Z.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),color:h.accent}];gt("assignees",Ce);},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:h.accent},children:A.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:A.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:h.accent}})})]},A.id)})})})]}),jsxRuntime.jsxs("div",{ref:Oe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(N)S(false);else {if(Oe.current){let A=Oe.current.getBoundingClientRect(),q=window.innerHeight,Ce=120,K=q-A.bottom<Ce?A.top-Ce-8:A.bottom+8;T({top:K,left:A.left});}S(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsxRuntime.jsx("span",{children:Ct.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(ba,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(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:`${M.top}px`,left:`${M.left}px`,zIndex:99999,backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Ao.slice(0,18).map(A=>{let q=Z.color===A.value;return jsxRuntime.jsx("button",{type:"button",onClick:Ce=>{Ce.preventDefault(),Ce.stopPropagation(),gt("color",A.value),S(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:q?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),p.length>0||u?jsxRuntime.jsx(cs,{selectedTags:Z.tags||[],availableTags:p,onChange:A=>gt("tags",A),onCreateTag:u,theme:h,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:h.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:_e?"#191b22":h.bgSecondary,borderRadius:8,border:`1px solid ${_e?"rgba(65,71,84,0.05)":h.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:dt,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!Z.isMilestone)if(z==="start")$(null);else {if(dt.current){let A=dt.current.getBoundingClientRect();U({top:A.bottom+8,left:Math.max(16,A.left-40)});}$("start"),L(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ut,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:o||Z.isMilestone,children:Z.startDate?Z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!Z.isMilestone)if(z==="end")$(null);else {if(dt.current){let A=dt.current.getBoundingClientRect();U({top:A.bottom+8,left:Math.max(16,A.left-40)});}$("end"),L(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ut,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:o||Z.isMilestone,children:Z.endDate?Z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(ba,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Ae.top}px`,left:`${Ae.left}px`,zIndex:99999,backgroundColor:_e?"#0a0a0a":h.bgPrimary,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${_e?"#262626":h.border}`},children:[(()=>{let A=new Date,q=new Date(A);q.setDate(A.getDate()+1);let Ce=new Date(A);Ce.setDate(A.getDate()+7);let I=new Date(A);return I.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:Ce},{label:"2 semanas",date:I}].map((ve,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:pe=>pe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:pe=>pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{z==="start"?(gt("startDate",ve.date),(!Z.endDate||ve.date>Z.endDate)&&gt("endDate",ve.date),$("end")):(gt("endDate",ve.date),(!Z.startDate||ve.date<Z.startDate)&&gt("startDate",ve.date),$(null));},children:ve.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.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:A=>A.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{gt("startDate",void 0),gt("endDate",void 0),$(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(J.getFullYear(),J.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:J.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(J.getFullYear(),J.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:A},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=J.getFullYear(),q=J.getMonth(),Ce=new Date(A,q,1).getDay(),I=new Date(A,q+1,0).getDate(),K=new Date,ve=[];for(let pe=Ce-1;pe>=0;pe--)ve.push({day:new Date(A,q,-pe).getDate(),date:new Date(A,q-1,new Date(A,q,-pe).getDate()),isCurrentMonth:false});for(let pe=1;pe<=I;pe++)ve.push({day:pe,date:new Date(A,q,pe),isCurrentMonth:true});let Ue=42-ve.length;for(let pe=1;pe<=Ue;pe++)ve.push({day:pe,date:new Date(A,q+1,pe),isCurrentMonth:false});return ve.map((pe,tt)=>{let ht=pe.date.toDateString()===K.toDateString(),qe=Z.startDate?.toDateString()===pe.date.toDateString(),wt=Z.endDate?.toDateString()===pe.date.toDateString(),qt=Z.startDate&&Z.endDate&&pe.date>=Z.startDate&&pe.date<=Z.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:pe.isCurrentMonth?qe||wt?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:qe?h.accent:wt?"#7C3AED":qt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ht&&!qe&&!wt?`inset 0 0 0 1px ${h.accent}`:"none"},onClick:()=>{z==="start"?(gt("startDate",pe.date),Z.endDate&&pe.date>Z.endDate&&gt("endDate",pe.date),$("end")):(gt("endDate",pe.date),Z.startDate&&pe.date<Z.startDate&&gt("startDate",pe.date),$(null));},children:pe.day},tt)})})()})]})]})]})})]}),Xe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Xe.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:h.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[Z.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:_e?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let q=A.currentTarget.getBoundingClientRect(),Ce=Math.round((A.clientX-q.left)/q.width*100/5)*5;gt("progress",Math.max(0,Math.min(100,Ce)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Z.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${_e?"rgba(65,71,84,0.05)":h.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(!we),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:h.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${we?"":"-rotate-90"}`,style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&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:h.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:h.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:Z.effortMinutes?nk(Z.effortMinutes):"",onChange:A=>{let q=ok(A.target.value);gt("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`}})]}),r.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:h.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:h.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:Z.parentId||"",onChange:A=>gt("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(A=>A.id!==a?.id).map(A=>jsxRuntime.jsx("option",{value:A.id,children:A.name},A.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:h.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:Z.location||"",onChange:A=>gt("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.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:h.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:Z.equipment||"",onChange:A=>gt("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o})]})]}),(m||d.length>0||i==="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:h.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:h.textTertiary},children:["Adjuntos ",i==="create"?xe.length>0&&`(${xe.length})`:d.length>0&&`(${d.length})`]})]}),i==="create"?jsxRuntime.jsx(ms,{cardId:"pending",attachments:xe.map((A,q)=>({id:`pending-${q}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>G(q=>[...q,...A]),onDelete:A=>{let q=parseInt(A.replace("pending-",""),10);G(Ce=>Ce.filter((I,K)=>K!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(ms,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?A=>m(a.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),i==="create"&&xe.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[xe.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:A=>A.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Z.isMilestone,onChange:A=>gt("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:o}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:h.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:h.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Z.dependencies&&Z.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Z.dependencies.map(A=>{let q=r.find(Ce=>Ce.id===A);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${h.accent}20`,color:h.accent},children:[q?.name||A.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Ce=(Z.dependencies||[]).filter(I=>I!==A);gt("dependencies",Ce);},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"})})]},A)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{ne(!Ve),ce("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:h.bgSecondary,color:h.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:Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ne(false),ce("");}}),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:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"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 ${h.border}`},children:jsxRuntime.jsx("input",{type:"text",value:Re,onChange:A=>ce(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:h.bgSecondary,color:h.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>Re===""||A.name.toLowerCase().includes(Re.toLowerCase())).map(A=>{let q=Z.dependencies?.includes(A.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let Ce=Z.dependencies||[],I;q?I=Ce.filter(K=>K!==A.id):I=[...Ce,A.id],gt("dependencies",I);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${h.accent}10`:"transparent"},onMouseEnter:Ce=>{q||(Ce.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:Ce=>{Ce.currentTarget.style.backgroundColor=q?`${h.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?h.accent:"transparent",borderColor:q?h.accent:h.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:h.textPrimary},children:A.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:h.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:h.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 ${_e?"rgba(65,71,84,0.1)":h.border}`,backgroundColor:_e?"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:h.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=h.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=h.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:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.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:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Mg=`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
@@ -410,14 +410,14 @@ If ambiguous, ask for clarification in the message field.`;function Pg(e){return
410
410
  ${Fg(e).map(r=>{let n=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",o=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${n} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${o}`}).join(`
411
411
  `)}
412
412
 
413
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Fg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function _n(e,t){let a=Fg(e),r=t.toLowerCase().trim(),n=a.find(i=>i.name.toLowerCase()===r);if(n)return n;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return o.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.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(r),v=f.getDay(),b=m-v;return b<=0&&(b+=7),f.setDate(f.getDate()+b),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);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(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let d=parseInt(i[1],10),m=parseInt(i[2],10)-1,f=parseInt(i[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},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),m=c[l[2].toLowerCase()],f=l[3]?parseInt(l[3],10):r.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=a.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):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function $d(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Lg(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 Ag(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),u=r[2].trim(),p=_n(t,l),d=Bd(u);if(!p)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". 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=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),u=n[2].trim(),p=_n(t,l),d=$d(u);if(!p)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,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=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),u=s[2].trim(),p=_n(t,l),d=Od(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:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),u=o[2].trim(),p=_n(t,l);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:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),u=i[2].trim(),p=_n(t,l),d=_n(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:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),u=_n(t,l);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Ig(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 sk(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 ik(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Pl(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let p=a.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=>Pl(u,t,a)),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},i=o(e.startDate),c=o(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:sk(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Rg(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:ik(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Bg(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Pl(r,e,t))}var Hd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ud={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:Hd,es:Ud};function Wd(e){return Fl[e]||Fl.en}function Ll(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var zd=[{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 $g(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 Og({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=react.useState(false),i=react.useRef(null);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]);let c=$g(e),l=zd[0],u=zd.find(m=>m.value===c)??l,p=u.icon,d=m=>{switch($g(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.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",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxRuntime.jsxs("div",{ref:i,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",a?"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",a?"text-white/60":"text-gray-500"),children:d(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",a?"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]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:zd.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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function xo(e,t,a=320){let[r,n]=react.useState(false);return react.useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,i=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!i&&c);},[t,a,e]),r}var Gd=[{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 Ug({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=react.useState(false),i=react.useRef(null),c=xo(i,s,180);react.useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=Gd.find(p=>p.value===e)??Gd[4],u=r==="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",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[u]})]}):jsxRuntime.jsxs("div",{ref:i,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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[u]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",a?"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]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gd.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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"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:a?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function bi(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Vd(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]"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-[#00E5CC]"}function Rl({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,i]=react.useState(false),[c,l]=react.useState(""),u=react.useRef(null),p=react.useRef(null),d=xo(u,o);react.useEffect(()=>{let b=h=>{u.current&&!u.current.contains(h.target)&&(i(false),l(""));};return o&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),f=b=>e.some(h=>h.name===b),v=b=>{if(a){if(f(b.name))a(e.filter(h=>h.name!==b.name));else {let h={name:b.name,initials:bi(b.name),color:b.color||Vd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,h)=>jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"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:b=>{b.stopPropagation(),i(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"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",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,h)=>jsxRuntime.jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",r?"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:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"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 ${r?"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:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:p,type:"text",value:c,onChange:b=>l(b.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"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 ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)}),b.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==b.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}})})]},`${b.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let h=f(b.name);return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{h||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{h||(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:b.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):bi(b.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function _g({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:i=false,placeholder:c}){let[l,u]=react.useState(false),[p,d]=react.useState(n),[m,f]=react.useState(()=>{let N=n==="start"?e:t;if(N){let U=N instanceof Date?N:new Date(N);return new Date(U.getFullYear(),U.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=react.useRef(null),b=react.useRef(null),h=react.useRef(null),[y,x]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let N=U=>{let O=U.target;v.current&&v.current.contains(O)||h.current&&h.current.contains(O)||u(false);};return l&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),react.useLayoutEffect(()=>{if(!l){x(null);return}let N=()=>{let U=b.current?.getBoundingClientRect();if(!U)return;let O=520,X=360,A=window.innerHeight-U.bottom,Se=A<X&&U.top>A,G=Se?U.top-4:U.bottom+4,ve=Math.min(Math.max(U.left,8),window.innerWidth-O-8);x({top:G,left:ve,flipUp:Se});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[l]),react.useEffect(()=>{l&&d(r?n:"start");},[l,r,n]);let P=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",$=react.useCallback(()=>{let N=m.getFullYear(),U=m.getMonth(),O=new Date(N,U,1),A=new Date(N,U+1,0).getDate(),Se=O.getDay(),G=[],R=new Date(N,U,0).getDate();for(let V=Se-1;V>=0;V--)G.push({date:new Date(N,U-1,R-V),isCurrentMonth:false});for(let V=1;V<=A;V++)G.push({date:new Date(N,U,V),isCurrentMonth:true});let ye=42-G.length;for(let V=1;V<=ye;V++)G.push({date:new Date(N,U+1,V),isCurrentMonth:false});return G},[m]),T=N=>{if(r)n==="start"?a(N,C||void 0):a(w||void 0,N),u(false);else if(p==="start"){let U=C&&N>C?N:C;a(N,U||void 0),d("end");}else {let U=w&&N<w?N:w;a(U||void 0,N),u(false);}},S=()=>{let N=new Date,U=new Date(N);U.setDate(N.getDate()+1);let O=new Date(N);O.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let X=new Date(N);X.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let A=new Date(N);A.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let Se=new Date(N);Se.setDate(N.getDate()+14);let G=new Date(N);return G.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:U,display:U.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:A,display:A.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:G,display:G.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let N=r&&n==="start"?w:C;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:P(N)})]})}let M=r&&n==="start"?w:C;return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,onClick:N=>{N.stopPropagation(),u(!l);let U=n==="start"?w:C;U&&f(new Date(U.getFullYear(),U.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:P(M)})]}),l&&y&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:h,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:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[S().map((N,U)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(N.date),children:[jsxRuntime.jsx("span",{children:N.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},U)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,C||void 0):a(w||void 0,void 0):a(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:[!r&&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(N=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:$().map((N,U)=>{let O=N.date.toDateString()===new Date().toDateString(),X=w?.toDateString()===N.date.toDateString(),A=C?.toDateString()===N.date.toDateString(),Se=X||A,G=!r&&w&&C&&N.date>=w&&N.date<=C;return jsxRuntime.jsx("button",{onClick:()=>T(new Date(N.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",X&&"bg-[#00E5CC] text-white",A&&!X&&"bg-[#7C3AED] text-white",G&&!Se&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Se&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},U)})})]})]}),document.body)]})}function $l({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(_g,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:i||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function Ss(e=600){let[t,a]=react.useState(false),r=react.useRef(null),n=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:n}}function Ol(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===l.current||e===void 0){o(e),l.current=e;return}let p=l.current??0,d=e,m=d-p,f=r/n;c(true);for(let v=1;v<=n;v++){let b=setTimeout(()=>{let h=v/n,y=1-Math.pow(1-h,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(b);}return l.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:i}}function Kg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=react.useState(null),[o,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),u=react.useCallback(m=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(m),i(0);let f=Date.now();l.current=setInterval(()=>{let v=Date.now()-f,b=Math.min(v/a*100,100);i(b);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(m),s(null),i(0);},a);},[a,e]),p=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:p}}function Yg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,i]=react.useState(false),[c,l]=react.useState(""),u=react.useRef(null),{isFlashing:p,triggerFlash:d}=Ss(),{displayValue:m,isAnimating:f}=Ol(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),P=w.clientX-C.left,$=Math.round(P/C.width*100),T=Math.max(0,Math.min(100,$));T!==e&&(t(T),s&&d());},b=react.useCallback(w=>{r||!t||(w.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let h=react.useCallback(()=>{i(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&d());}},[c,t,e,s,d]),y=react.useCallback(w=>{w.key==="Enter"&&h(),w.key==="Escape"&&i(false);},[h]),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&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsxRuntime.jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&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=>l(w.target.value.replace(/[^0-9]/g,"")),onBlur:h,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"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",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:b,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Qg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let u=()=>{i!==e&&t?.(i),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",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,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",a?"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",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function t0({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,u]=react.useState(false),[p,d]=react.useState(e?.toString()||""),m=react.useRef(null),{isFlashing:f,triggerFlash:v}=Ss(),{displayValue:b,isAnimating:h}=Ol(e,{enabled:i&&!l});react.useEffect(()=>{l&&m.current&&(m.current.focus(),m.current.select());},[l]),react.useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);if(!isNaN(w)){let C=w;n!==void 0&&(C=Math.max(n,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),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",a?"text-white/60":"text-gray-500",h&&"font-medium"),children:b!==void 0?b:r}):l?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",a?"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",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",b===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),h&&"font-medium scale-105"),children:b!==void 0?b:r})}function a0({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,i]=react.useState(false),c=react.useRef(null),l=xo(c,o,220);return react.useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),s||!a?jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),i(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 left-0 "+(l?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(u=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(u),i(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:u}),e===u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function n0({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:i,progress:c,startChange:l,cancelChange:u}=Kg(t,{delay:s}),p=m=>{m.stopPropagation(),!r&&t&&(n?i?u():l(!e):t(!e));},d=i?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:p,disabled:r||!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]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&d&&"ring-green-500/50",i&&!d&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&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"})}),i?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]}),i&&jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),u();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"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 o0({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:i=2}){let[c,l]=react.useState(false),u=react.useRef(null),p=xo(u,c,220);react.useEffect(()=>{let h=y=>{u.current&&!u.current.contains(y.target)&&l(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let d=e.slice(0,i),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=h=>{let y=e.includes(h),x=y?e.filter(w=>w!==h):[...e,h];!y&&o!=null&&e.length>=o||a(x);},b=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),l(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"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",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let y=e.includes(h),x=!y&&b;return jsxRuntime.jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(h);},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":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:h}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Xk(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 l0({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Xk(e);if(n.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,i=o>0?`${s.name} +${o}`:s.name;return r?jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),r(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:i})]}):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"}),i]})}function u0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.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 a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function e1(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*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 Wr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0,financialOverride:u}){let[p,d]=react.useState(false),[m,f]=react.useState(""),v=react.useRef(null),{isFlashing:b,triggerFlash:h}=Ss(),y=c==="financial"&&(l>0||u!=null),x=u??(e?e/60*l:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Zk(e,r);react.useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),S=e%60;T>0&&S>0?f(`${T}h ${S}m`):T>0?f(`${T}h`):f(`${S}m`);}else f("");},[e,p]);let C=()=>{let T=e1(m);T!==e&&(t?.(T),o&&h()),d(false);},P=T=>{T.key==="Enter"?C():T.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="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",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let $=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($,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):p?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,onChange:T=>f(T.target.value),onBlur:C,onKeyDown:P,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx($,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function f0({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=n==="es";return a===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:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"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",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),i()]})}function h0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:i="hours",hourlyRate:c=0}){let l=a==="es",u=i==="financial"&&c>0,p=G=>u?`$${Math.round(G*c).toLocaleString("en-US")}`:`${G}h`,[d,m]=react.useState(false),[f,v]=react.useState(false),[b,h]=react.useState(null),y=react.useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(x/60*10)/10,$=Math.round(w/60*10)/10,T=w>0?x/w*100:0,S=T>100?Math.round((x-w)/60*10)/10:0,M=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!b)return;let G=ve=>{y.current&&!y.current.contains(ve.target)&&(v(false),h(null));};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[f,b]);let N=G=>{if(G.stopPropagation(),r&&!n&&!s){h("log");return}if(r||n||s){v(ve=>!ve),h(null);return}o&&o(e);},U=G=>{v(false),h(G);},O=async(G,ve)=>{b==="log"&&r&&G?r(e,G,ve):b==="estimate"&&n?n(e,G):b==="quoted"&&s&&s(e,G),h(null);},X=r||n||s||o,A=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(G=>G.show),Se=b==="estimate"?w:b==="quoted"?C:void 0;return w===0&&x===0&&C===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:G=>G.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:N,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:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:l?"+ 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:A.map(G=>jsxRuntime.jsxs("button",{onClick:ve=>{ve.stopPropagation(),U(G.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:ve=>{ve.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ve=>{ve.target.style.background="transparent";},children:[jsxRuntime.jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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(En,{mode:b,locale:a,isDark:t,currentValue:Se||void 0,onSave:O,onClose:()=>h(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:G=>G.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 G=x===0,R=(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:G?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(P)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p($)]}),S>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:R?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:R?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(S)," ",l?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:M,borderRadius:2,transition:"width 0.3s"}})})]}),X&&jsxRuntime.jsx("button",{onClick:N,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:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:l?"+ 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:A.map(G=>jsxRuntime.jsxs("button",{onClick:ve=>{ve.stopPropagation(),U(G.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:ve=>{ve.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ve=>{ve.target.style.background="transparent";},children:[jsxRuntime.jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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(En,{mode:b,locale:a,isDark:t,currentValue:Se||void 0,onSave:O,onClose:()=>h(null)})})})})]})}function i1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function l1(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 y0({assignee:e,size:t=28,isDark:a}){let r=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(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function x0({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=i1(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(y0,{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:r?"Sin asignar":"Unassigned"})]});let i=o?.percentage??0,c=!!o&&i>0,l=c?l1(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(y0,{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&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var c1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function w0({blockers:e,isDark:t,locale:a="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:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",c1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function T1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function N1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function E0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:b}){let h=react.useRef(null),y=r==="es"?T0.es:T0.en,[x,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let S=h.current;if(!S)return;let M=S.getBoundingClientRect(),N=8,U=e.x,O=e.y;e.y+M.height>window.innerHeight-N&&(O=Math.max(N,e.y-M.height)),e.x+M.width>window.innerWidth-N&&(U=Math.max(N,window.innerWidth-M.width-N)),(U!==e.x||O!==e.y)&&w({left:U,top:O});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let S=N=>{h.current&&!h.current.contains(N.target)&&t();},M=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",S),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",M);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let S=[];return n&&S.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),S.push({id:"sep1",label:"",icon:null,separator:true}),i&&(S.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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),S.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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,priority:"low"}),t();}}]}),u.length>0&&S.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(M=>({id:`assign-${M.id}`,label:M.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:M.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],O=N.some(X=>X.name===M.name)?N.filter(X=>X.name!==M.name):[...N,{name:M.name,initials:T1(M.name),color:M.color||N1(M.name),avatar:M.avatarUrl}];i({...e.task,assignees:O}),t();}}))})),p&&S.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&S.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&S.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),S.push({id:"sep2",label:"",icon:null,separator:true}),s&&S.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||b)&&(S.push({id:"sep3",label:"",icon:null,separator:true}),f&&(S.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),S.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&&S.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),b&&S.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{b(e.task.id),t();}})),o&&S.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),S},P=()=>{if(!e.columnId)return [];let S=[];return l&&(S.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),S.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(S.push({id:"sep-hide",label:"",icon:null,separator:true}),S.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),S},$=e.type==="task"?C():P(),T={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:h,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:$.map(S=>S.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},S.id):S.submenu?jsxRuntime.jsx(D1,{item:S,isDark:a},S.id):jsxRuntime.jsxs("button",{onClick:S.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",S.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(S.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:S.icon}),S.label]},S.id))})}function D1({item:e,isDark:t}){let[a,r]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(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")})]}),a&&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(i=>jsxRuntime.jsxs("button",{onClick:i.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:i.icon}),i.label]},i.id))})]})}var T0={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 B0={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"})},G1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function O0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:i,locale:c}){let[l,u]=react.useState(""),[p,d]=react.useState(null),[m,f]=react.useState(null),v=react.useRef(null),b=c==="es"?$0.es:$0.en;react.useLayoutEffect(()=>{if(!e||!v.current)return;let S=()=>{if(!v.current)return;let M=v.current.parentElement;if(M){let X=M.getBoundingClientRect();f({top:X.bottom+4,right:window.innerWidth-X.right});}let N=v.current.getBoundingClientRect(),O=window.innerHeight-N.top-20;d(Math.max(300,O));};return requestAnimationFrame(S),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[e]),react.useEffect(()=>{if(!e)return;let S=setTimeout(()=>{let M=U=>{v.current&&!v.current.contains(U.target)&&t();},N=U=>{U.key==="Escape"&&t();};document.addEventListener("mousedown",M),document.addEventListener("keydown",N),v._cleanup=()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(S),v._cleanup&&v._cleanup();}},[e,t]);let h=react.useMemo(()=>{let S=new Set([...G1]);return a.forEach(M=>{M.type&&M.type!=="assignees"&&S.add(M.type);}),Array.from(S)},[a]);if(!e)return null;let y=S=>{let M=b.columns[S];if(M)return M;let N=a.find(U=>U.type===S);return N?.label?N.label:S},x=S=>{if(S==="name")return;let M=a.map(N=>N.id===S?{...N,visible:!N.visible}:N);n(M);},w=(S,M)=>{let N=a.find(O=>O.type===S&&(!M||O.customFieldId===M));if(N){x(N.id);return}let U={id:M||S,type:S,label:M?r.find(O=>O.id===M)?.name||S:y(S),width:120,visible:true,sortable:true,resizable:true,customFieldId:M};n([...a,U]);},C=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],P=h.filter(S=>S!=="assignees"&&(o||!C.includes(S))&&y(S).toLowerCase().includes(l.toLowerCase())),$=r.filter(S=>S.name.toLowerCase().includes(l.toLowerCase())),T=i?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:i?"#111114":"#FFFFFF",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:i?"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 ${i?"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:i?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:b.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",S.currentTarget.style.color=i?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=i?"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:i?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:l,onChange:S=>u(S.target.value),placeholder:b.searchPlaceholder,style:{fontSize:12,background:i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:i?"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:S=>{S&&S.style.setProperty("--focus-border",T);},onFocus:S=>{S.currentTarget.style.borderColor=T,S.currentTarget.style.background=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:S=>{S.currentTarget.style.borderColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",S.currentTarget.style.background=i?"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:S=>S.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:b.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:P.map(S=>{let M=a.find(O=>O.type===S&&!O.customFieldId),N=M?.visible??false,U=S==="name";return jsxRuntime.jsxs("button",{onClick:()=>{U||(M?x(M.id):w(S));},disabled:U,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:U?.4:1,cursor:U?"not-allowed":"pointer"},onMouseEnter:O=>{U||(O.currentTarget.style.backgroundColor=i?"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:N?T:"transparent",border:N?`1.5px solid ${T}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${T}40`:"none"},children:N&&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:N?T:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:B0[S]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:N?500:400,color:N?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(S),children:y(S)})]},S)})})]}),$.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:b.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:$.map(S=>{let N=a.find(U=>U.customFieldId===S.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(S.type,S.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:U=>{U.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:U=>{U.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:N?T:"transparent",border:N?`1.5px solid ${T}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${T}40`:"none"},children:N&&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:N?T:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:B0[S.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:S.name})]},S.id)})})]})]})]})}var $0={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 Q1=[{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 W0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=react.useState(""),[i,c]=react.useState("text"),[l,u]=react.useState([""]),p=n==="es"?U0.es:U0.en;react.useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&t();};return e&&document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);let d=()=>{if(!s.trim())return;let b={name:s.trim(),type:i};i==="dropdown"&&(b.options=l.filter(h=>h.trim())),a(b),t();},m=()=>{u([...l,""]);},f=(b,h)=>{let y=[...l];y[b]=h,u(y);},v=b=>{l.length>1&&u(l.filter((h,y)=>y!==b));};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",r?"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",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:p.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",r?"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",r?"text-white":"text-gray-900"),children:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:b=>o(b.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",r?"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",r?"text-white":"text-gray-900"),children:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Q1.map(b=>jsxRuntime.jsxs("button",{onClick:()=>c(b.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===b.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:b.icon}),jsxRuntime.jsx("span",{className:g("text-xs",i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:p.types[b.type]})]},b.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((b,h)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:b,onChange:y=>f(h,y.target.value),placeholder:`${p.option} ${h+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"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")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>v(h),className:g("p-2 rounded-lg transition-colors",r?"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"})})]},h)),jsxRuntime.jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"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",r?"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",r?"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 U0={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 V0={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 j0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),u=s==="es"?V0.es:V0.en;react.useEffect(()=>{if(!o)return;let m=v=>{Date.now()-l.current<100||c.current&&!c.current.contains(v.target)&&i(false);},f=v=>{v.key==="Escape"&&i(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||(l.current=Date.now()),i(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:()=>{a(m.value),r(false),i(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;r(m),m&&a("all"),i(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 _0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Co(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function K0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",i=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:i?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,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"})})})]}),i&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,l=e.totalEstimated??0,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-l,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,b=u>c&&c>0,h=b?"#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:Co(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=x>0||w>0,P=($,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:$}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Co(l)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=x>0||w>0,P=($,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:$}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",b?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Co(u)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(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:h}})}),l>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?"+":"",Co(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?`+${Co(p)} ${o?"disponible (caja)":"available (cash)"}`:`${Co(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,l=e.totalHoursAllocatedMinutes??0,u=l>0?Math.min(Math.round(c/l*100),100):0,m=(l>0?c/l: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:_0(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:_0(l)})]}),l>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,l=c>0,u=c<0,p=e.scheduleVarianceLabel||(l?`+${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",l&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!l&&!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,l)=>{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}-${l}`)})})]})]})}var gC=[{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 Z0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...Z0(n.subtasks,t+1,s));}return r}function fC(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=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(a.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;r+=p,n++;}return n>0?r/n:null}function Ls(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Ls(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Fs(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function bC({value:e,onChange:t,isDark:a}){let[r,n]=react.useState(false),[s,o]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>o(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),n(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.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",a?"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:i=>{i.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Q0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let i of e){let c=i.weight||0;c>0&&(t+=(i.progress||0)*c,a+=c,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((i,c)=>i+(c.effort_minutes||0),0)>0){let i=0,c=0;for(let l of e){let u=l.effort_minutes||60;i+=(l.progress||0)*u,c+=u;}return Math.round(i/c*10)/10}let o=e.reduce((i,c)=>i+(c.progress||0),0);return Math.round(o/e.length*10)/10}function uu(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uu(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function ef({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:i=[],customFields:c=[],toolbarRightContent:l,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:b=true,showHierarchy:h=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:C=true,allowColumnResize:P=true,enableContextMenu:$=true,showCreateTaskButton:T=false,onCreateTask:S,persistFilter:M=false,financialBlur:N,healthSidebar:U,lens:O="hours",hourlyRate:X=0,rateMap:A,aggregateParentHours:Se=false,showProjectTotals:G=false,totalsDollarOverride:ve}=t,R=t.rowDensity==="compact",ye=Ll(f,v),V=m==="dark",Ue=k=>{if(!A||!k.assignees||k.assignees.length===0)return X;let q=0,Q=0;for(let me of k.assignees){let Oe=me.id?A[me.id]:void 0;if(Oe==null||Oe<=0)continue;let ae=typeof me.estimatedMinutes=="number"?me.estimatedMinutes:0;ae>0&&(q+=Oe*ae,Q+=ae);}if(Q>0)return q/Q;let se=k.assignees.map(me=>me.id?A[me.id]:void 0).filter(me=>me!=null&&me>0);return se.length===0?X:se.reduce((me,Oe)=>me+Oe,0)/se.length},ne=k=>{let q=0,Q=0,se=0,me=Oe=>{for(let ae of Oe)if(ae.subtasks&&ae.subtasks.length>0){let Pe={s:q,a:Q,q:se};if(me(ae.subtasks),q-Pe.s+(Q-Pe.a)+(se-Pe.q)===0){let Xe=Ue(ae);q+=(ae.timeLoggedMinutes??0)/60*Xe,Q+=(ae.effortMinutes??0)/60*Xe,se+=(ae.soldEffortMinutes??0)/60*Xe;}}else {let Pe=Ue(ae);q+=(ae.timeLoggedMinutes??0)/60*Pe,Q+=(ae.effortMinutes??0)/60*Pe,se+=(ae.soldEffortMinutes??0)/60*Pe;}};return k.subtasks&&me(k.subtasks),{dollarSpent:q,dollarAllocated:Q,dollarQuoted:se}},Be=react.useCallback(()=>{if(!M||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let k=localStorage.getItem(M);if(k){let q=JSON.parse(k);return {statusFilter:q.statusFilter||"all",hideCompleted:q.hideCompleted||!1}}}catch(k){console.error("Error loading persisted filter:",k);}return {statusFilter:"all",hideCompleted:false}},[M]),ce=react.useMemo(()=>{function k(q){let Q=0,se=0,me=0,Oe=0,ae=0,Pe=0;for(let Ie of q)if(Ie.subtasks&&Ie.subtasks.length>0){let Xe=k(Ie.subtasks);if(Xe.spent+Xe.allocated+Xe.quoted>0)Q+=Xe.spent,se+=Xe.allocated,me+=Xe.quoted,Oe+=Xe.dollarSpent,ae+=Xe.dollarAllocated,Pe+=Xe.dollarQuoted;else {let mt=Ie.timeLoggedMinutes??0,ft=Ie.effortMinutes??0,pa=Ie.soldEffortMinutes??0;Q+=mt,se+=ft,me+=pa;let Vt=Ue(Ie);Oe+=mt/60*Vt,ae+=ft/60*Vt,Pe+=pa/60*Vt;}}else {let Xe=Ie.timeLoggedMinutes??0,It=Ie.effortMinutes??0,mt=Ie.soldEffortMinutes??0;Q+=Xe,se+=It,me+=mt;let ft=Ue(Ie);Oe+=Xe/60*ft,ae+=It/60*ft,Pe+=mt/60*ft;}return {spent:Q,allocated:se,quoted:me,dollarSpent:Oe,dollarAllocated:ae,dollarQuoted:Pe}}return k(e)},[e]),Ne=react.useMemo(()=>{let k=new Map;function q(Q){let se=0;for(let me of Q)if(me.subtasks&&me.subtasks.length>0){let Oe=q(me.subtasks);k.set(me.id,Oe),se+=Oe;}else se+=me.weight||0;return se}return q(e),k},[e]),ze=react.useMemo(()=>!U?.enabled||!U.data?U:{...U,data:{...U.data,totalHoursSpentMinutes:ce.spent,totalHoursAllocatedMinutes:ce.allocated}},[U,ce]),[Le,$e]=react.useState(true),[Ve,oe]=react.useState(null),[je,et]=react.useState("position"),[Re,ut]=react.useState("asc"),[Nt,lt]=react.useState(""),[Ee,ct]=react.useState(()=>Be().statusFilter),[xt,Ke]=react.useState(()=>Be().hideCompleted),[st,L]=react.useState(y||gC),[J,Ce]=react.useState(false),[I,K]=react.useState(false),[we,Ge]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[pe,rt]=react.useState(null),[bt,qe]=react.useState(false),[ht,Yt]=react.useState(null),[kt,de]=react.useState(null),[De,tt]=react.useState(null),Bt=react.useRef(0),Wt=react.useRef(false),Qe=!!(a.onTaskMove||a.onTaskReparent),[vt,xa]=react.useState(null),[At,er]=react.useState(null),fa=k=>{let q=k.type;return k.customFieldId?q==="file"?null:{kind:"customField",fieldId:k.customFieldId}:q==="assignees"||q==="teamLoad"?"assignees":q==="startDate"?"startDate":q==="endDate"?"endDate":null},hr=(k,q)=>typeof k=="string"||typeof q=="string"?k===q:k.fieldId===q.fieldId,Ye=react.useRef([]),Ze=react.useCallback((k,q)=>{Qe&&(q.preventDefault(),Bt.current=q.clientY,rt(k),Wt.current=false,qe(false),tt({x:q.clientX,y:q.clientY}));},[Qe]),Aa=react.useCallback(k=>{if(!pe||(Math.abs(k.clientY-Bt.current)>5&&!Wt.current&&(Wt.current=true,qe(true)),tt({x:k.clientX,y:k.clientY}),!Wt.current))return;let Q=document.querySelectorAll("[data-listview-row]"),se=null,me=null;Q.forEach(Oe=>{let ae=Oe.getBoundingClientRect(),Pe=Oe.getAttribute("data-listview-row");if(Pe&&Pe!==pe&&k.clientY>=ae.top&&k.clientY<=ae.bottom){se=Pe;let Ie=k.clientY-ae.top,Xe=ae.height;me=Ie<Xe*.25?"above":Ie>Xe*.75?"below":"child";}}),Yt(se),de(me);},[pe]),Ia=react.useCallback(()=>{if(Wt.current&&pe&&ht&&kt){if(kt==="child"&&a.onTaskReparent)a.onTaskReparent(pe,ht);else if(kt==="above"||kt==="below"){let k=(se,me,Oe=null)=>{for(let ae of se){if(ae.id===me)return Oe;if(ae.subtasks){let Pe=k(ae.subtasks,me,ae.id);if(Pe!==void 0)return Pe}}},q=k(e,pe,null),Q=k(e,ht,null);if(a.onTaskReparent){let se=(Xe,It)=>{if(It===null)return Xe;for(let mt of Xe){if(mt.id===It)return mt.subtasks||[];if(mt.subtasks){let ft=se(mt.subtasks,It);if(ft.length>0||mt.subtasks.some(pa=>pa.id===It))return ft}}return []},me=se(e,Q??null),Oe=me.findIndex(Xe=>Xe.id===ht),ae=q===Q,Pe=ae?me.findIndex(Xe=>Xe.id===pe):-1,Ie=kt==="below"?Oe+1:Oe;ae&&Pe!==-1&&Pe<Oe&&(Ie-=1),a.onTaskReparent(pe,Q??null,Math.max(0,Ie));}}}rt(null),Yt(null),de(null),tt(null),Wt.current=false,qe(false);},[pe,ht,kt,e,a]),sr=(k,q)=>typeof q!="string"?k.customFields?.find(se=>se.fieldId===q.fieldId)?.value:q==="assignees"?k.assignees:q==="startDate"?k.startDate:k.endDate,Ta=(k,q,Q,se)=>{k.preventDefault(),k.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let me=Array.from(document.querySelectorAll("[data-listview-row]")),Oe=me.map(Dt=>Dt.getAttribute("data-listview-row")||""),ae=Math.max(0,Oe.indexOf(q)),Pe=Dt=>Oe.slice(ae,Dt+1);er({sourceTaskId:q,column:Q,sourceIndex:se,targetIndex:se,rangeIds:new Set([q])});let Xe=(Dt=>{let Ot=Dt?.parentElement??null;for(;Ot;){let Er=window.getComputedStyle(Ot).overflowY;if((Er==="auto"||Er==="scroll")&&Ot.scrollHeight>Ot.clientHeight)return Ot;Ot=Ot.parentElement;}let Ra=document.scrollingElement;return Ra&&Ra.scrollHeight>Ra.clientHeight?Ra:null})(k.currentTarget),It=Dt=>{let Ot=ae,Ra=false;me.forEach((Er,lr)=>{let Va=Er.getBoundingClientRect();Dt>=Va.top&&Dt<=Va.bottom&&(Ot=lr,Ra=true);});let wr=me[me.length-1];if(!Ra&&wr){let Er=wr.getBoundingClientRect();Dt>Er.bottom&&(Ot=me.length-1);}return Ot<ae&&(Ot=ae),Ot},mt=k.clientY,ft=null,pa=()=>{ft!==null&&(cancelAnimationFrame(ft),ft=null);},Vt=()=>{let Dt=It(mt),Ot=new Set(Pe(Dt));er(Ra=>Ra&&{...Ra,targetIndex:Dt,rangeIds:Ot});},Ya=()=>{if(pa(),!Xe)return;let Dt=Xe,Ra=Dt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Dt.getBoundingClientRect(),wr=60,Er=12,lr=mt-Ra.top,Va=Ra.bottom-mt,to=Dt.scrollHeight-Dt.clientHeight;if(Va<wr&&Dt.scrollTop<to){let as=Math.max(1,Math.round(Er*(1-Math.max(0,Va)/wr))),kr=()=>{Dt.scrollTop+=as,Vt(),Dt.scrollTop<Dt.scrollHeight-Dt.clientHeight&&(ft=requestAnimationFrame(kr));};ft=requestAnimationFrame(kr);}else if(lr<wr&&Dt.scrollTop>0){let as=Math.max(1,Math.round(Er*(1-Math.max(0,lr)/wr))),kr=()=>{Dt.scrollTop-=as,Vt(),Dt.scrollTop>0&&(ft=requestAnimationFrame(kr));};ft=requestAnimationFrame(kr);}},Kt=Dt=>{mt=Dt.clientY,Vt(),Ya();},aa=Dt=>{window.removeEventListener("mousemove",Kt),window.removeEventListener("mouseup",aa),pa(),document.body.style.cursor="",document.body.style.userSelect="",er(null);let Ot=It(Dt.clientY),Ra=new Map(Ye.current.map(Va=>[Va.id,Va])),wr=Ra.get(q);if(!wr)return;let Er=sr(wr,Q),lr=[];for(let Va of Pe(Ot)){if(Va===q)continue;let to=Ra.get(Va);to&&(to.subtasks&&to.subtasks.length>0||lr.push(Va));}lr.length>0&&a.onBulkFill?.(lr,Q,Er);};window.addEventListener("mousemove",Kt),window.addEventListener("mouseup",aa);},Rr=k=>At?At.rangeIds.has(k):false;react.useEffect(()=>{if(pe)return document.addEventListener("mousemove",Aa),document.addEventListener("mouseup",Ia),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Aa),document.removeEventListener("mouseup",Ia),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,Aa,Ia]);let[ie,fe]=react.useState("all"),[pt,j]=react.useState(false),he=react.useRef(null),re=react.useRef(null),B=react.useMemo(()=>{let k=0;function q(Q,se){for(let me of Q)se>k&&(k=se),me.subtasks?.length&&q(me.subtasks,se+1);}return q(e,1),k},[e]);react.useEffect(()=>{if(!pt)return;let k=q=>{he.current?.contains(q.target)||re.current?.contains(q.target)||j(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[pt]),react.useEffect(()=>{if(ie==="all"){let Q=function(se){for(let me of se)me.subtasks?.length&&(me.isExpanded===false&&a.onTaskToggleExpand?.(me.id),Q(me.subtasks));};Q(e);}else {let Q=function(se,me){for(let Oe of se)if(Oe.subtasks?.length){let ae=me<ie,Pe=Oe.isExpanded!==false;ae!==Pe&&a.onTaskToggleExpand?.(Oe.id),Q(Oe.subtasks,me+1);}};Q(e,1);}},[ie]);let[Z,Te]=react.useState(null),[D,W]=react.useState(0),[ue,ke]=react.useState(0),ot=react.useRef(null),[be,_]=react.useState(null),[gt,yt]=react.useState(null);react.useEffect(()=>{y&&L(k=>{if(k.length===y.length){let q=true;for(let Q=0;Q<k.length;Q++){let se=k[Q],me=y[Q];if(!se||!me||se.id!==me.id||se.visible!==me.visible||se.width!==me.width||se.label!==me.label){q=false;break}}if(q)return k}return y});},[y]),react.useEffect(()=>{if(!(!M||typeof window>"u"))try{localStorage.setItem(M,JSON.stringify({statusFilter:Ee,hideCompleted:xt}));}catch(k){console.error("Error persisting filter state:",k);}},[M,Ee,xt]);let _t=react.useMemo(()=>{let k=new Set;function q(Q){for(let se of Q)se.subtasks?.length&&(se.isExpanded!==false&&k.add(se.id),q(se.subtasks));}return q(e),k},[e]),Xt=react.useMemo(()=>st.filter(k=>k.visible),[st]),ir=react.useCallback(k=>{a.onTaskToggleExpand?.(k);},[a]),yr=react.useCallback(k=>{je===k?ut(q=>q==="asc"?"desc":"asc"):(et(k),ut("asc")),a.onSortChange?.({column:k,direction:Re==="asc"?"desc":"asc"});},[je,Re,a]),Sr=react.useCallback(k=>{L(k),a.onColumnsChange?.(k);},[a]),ia=react.useCallback(k=>{let q=st.map(Q=>Q.id===k?{...Q,visible:false}:Q);Sr(q);},[st,Sr]),Qo=react.useCallback((k,q)=>{et(k),ut(q);},[]),Bn=react.useCallback((k,q,Q)=>{$&&(k.preventDefault(),Ge({isOpen:true,x:k.clientX,y:k.clientY,type:q?"task":"header",task:q,columnId:Q}));},[$]),_r=react.useCallback(()=>{Ge(k=>({...k,isOpen:false}));},[]),Qn=react.useCallback((k,q)=>{if(!P)return;k.preventDefault(),k.stopPropagation();let Q=st.find(se=>se.id===q);Q&&(Te(q),W(k.clientX),ke(Q.width));},[st,P]);react.useEffect(()=>{if(!Z)return;let k=st,q=se=>{let me=se.clientX-D,Oe=Math.max(50,ue+me);k=k.map(ae=>ae.id===Z?{...ae,width:Oe}:ae),L(k);},Q=()=>{a.onColumnsChange?.(k),Te(null);};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Q);}},[Z,D,ue,a]);let Zn=react.useCallback((k,q)=>{if(q==="name"){k.preventDefault();return}_(q),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("text/plain",q),k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="0.5");},[]),Pi=react.useCallback(k=>{k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="1"),_(null),yt(null);},[]),Zo=react.useCallback((k,q)=>{k.preventDefault(),q!=="name"&&(k.dataTransfer.dropEffect="move",yt(q));},[]),Fi=react.useCallback(()=>{yt(null);},[]),qa=react.useCallback((k,q)=>{if(k.preventDefault(),!be||be===q||q==="name")return;let Q=[...st],se=Q.findIndex(ae=>ae.id===be),me=Q.findIndex(ae=>ae.id===q);if(se===-1||me===-1)return;let Oe=Q.splice(se,1);Oe[0]&&(Q.splice(me,0,Oe[0]),Sr(Q),_(null),yt(null));},[be,st,Sr]),Bs=react.useCallback(async k=>{if(a.onCreateCustomField){let q={...k,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(q);}K(false);},[a]),eo=react.useCallback(k=>k.progress===100||k.status==="completed"?"completed":k.progress&&k.progress>0||k.status==="in-progress"?"in-progress":"todo",[]),$s=t.groupBy==="status",xr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[on,$n]=react.useState(()=>{let k=new Set(t.defaultCollapsedGroups??["completed"]);if(!xr)return k;try{let q=localStorage.getItem(xr);return q?new Set(JSON.parse(q)):k}catch{return k}}),Os=react.useCallback(k=>{$n(q=>{let Q=new Set(q);if(Q.has(k)?Q.delete(k):Q.add(k),xr)try{localStorage.setItem(xr,JSON.stringify([...Q]));}catch{}return Q});},[xr]),sn=!!t.selectable,[Hs,Li]=react.useState(new Set),On=react.useMemo(()=>t.selectedIds?new Set(t.selectedIds):Hs,[t.selectedIds,Hs]),Ai=react.useRef(null),{lista:Br,cabeceras:es,todas:vr}=react.useMemo(()=>{let k=Z0(e);if(Nt.trim()){let Q=Nt.toLowerCase();k=k.filter(se=>se.name.toLowerCase().includes(Q));}let q=t.showStatusFilter!==false;if(q&&Ee!=="all"){let Q=new Set(k.filter(se=>eo(se)===Ee).flatMap(se=>se.parentPath));k=k.filter(se=>Q.has(se.id));}if(q&&xt){let Q=new Set(k.filter(se=>eo(se)!=="completed").flatMap(se=>se.parentPath));k=k.filter(se=>Q.has(se.id));}if($s){let Q=["todo","in-progress","completed"],se=new Map,me=[];for(let Ie of k){let Xe=Ie.parentPath[0]??Ie.id;Ie.level===0&&me.push(Ie),se.has(Xe)||se.set(Xe,[]),se.get(Xe).push(Ie);}let Oe=Ie=>Ie.endDate?new Date(Ie.endDate).getTime():1/0,ae=[],Pe=new Map;for(let Ie of Q){let Xe=me.filter(Vt=>eo(Vt)===Ie).sort((Vt,Ya)=>Oe(Vt)-Oe(Ya)),It=Xe.flatMap(Vt=>se.get(Vt.id)??[Vt]),mt=It.filter(Vt=>!Vt.hasChildren).length;if(mt===0&&Xe.length===0)continue;let ft=on.has(Ie),pa=ae.length;Pe.set(pa,[...Pe.get(pa)??[],{clave:Ie,cuenta:mt,plegado:ft}]),ft||ae.push(...It);}return {lista:ae,cabeceras:Pe,todas:k}}return k.sort((Q,se)=>{let me,Oe;switch(je){case "name":me=Q.name.toLowerCase(),Oe=se.name.toLowerCase();break;case "startDate":me=Q.startDate?.getTime()||0,Oe=se.startDate?.getTime()||0;break;case "endDate":me=Q.endDate?.getTime()||0,Oe=se.endDate?.getTime()||0;break;case "progress":me=Q.progress||0,Oe=se.progress||0;break;case "status":me=Q.status||"todo",Oe=se.status||"todo";break;case "priority":let ae={urgent:0,high:1,medium:2,low:3,none:4};me=ae[Q.priority]??4,Oe=ae[se.priority]??4;break;case "position":return 0;default:return 0}return me<Oe?Re==="asc"?-1:1:me>Oe?Re==="asc"?1:-1:0}),{lista:k,cabeceras:new Map,todas:k}},[e,Nt,Ee,xt,je,Re,eo,t.showStatusFilter,$s,on]);Ye.current=Br;let No=(k,q)=>{let Q=new Set(On),se=Ai.current,me=Ye.current.map(Oe=>Oe.id);if(q&&se&&se!==k&&me.includes(se)&&me.includes(k)){let Oe=me.indexOf(se),ae=me.indexOf(k),Pe=Math.min(Oe,ae),Ie=Math.max(Oe,ae),Xe=!On.has(k);for(let It of me.slice(Pe,Ie+1))Xe?Q.add(It):Q.delete(It);}else Q.has(k)?Q.delete(k):Q.add(k);Ai.current=k,t.selectedIds||Li(Q),a.onSelectionChange?.([...Q]);},Do=On.size>0,ta=k=>jsxRuntime.jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"checkbox","data-casilla-fila":k,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:On.has(k),onChange:()=>{},onClick:q=>{q.stopPropagation(),No(k,q.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",Do?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),dc={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En curso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Us=(k,q)=>{let Q=es.get(k);if(!Q?.length)return q;let se=Q.map(me=>jsxRuntime.jsx("div",{"data-grupo-de-estado":me.clave,"data-plegado":me.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",V?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>Os(me.clave),"aria-expanded":!me.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",V?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[me.plegado?jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3.5 h-3.5"}),dc[me.clave]?.[f==="es"?"es":"en"]??me.clave,jsxRuntime.jsx("span",{className:g("font-normal tabular-nums",V?"text-white/40":"text-gray-400"),children:me.cuenta})]})},`grupo-${me.clave}`));return q?[...se,q]:se},ts=react.useCallback((k,q)=>{let Q=Oe=>{a.onTaskUpdate?.({...k,...Oe});},se=Oe=>Oe?k.customFields?.find(Pe=>Pe.fieldId===Oe)?.value:void 0,me=(Oe,ae)=>{if(!Oe)return;let Ie=[...k.customFields||[]],Xe=Ie.findIndex(It=>It.fieldId===Oe);Xe>=0?Ie[Xe]={fieldId:Oe,value:ae}:Ie.push({fieldId:Oe,value:ae}),Q({customFields:Ie});};switch(q.type){case "name":return null;case "status":return jsxRuntime.jsx(Og,{value:k.status||(k.progress===100?"completed":k.progress&&k.progress>0?"in-progress":"todo"),onChange:ae=>{Q({status:ae,progress:ae==="completed"?100:ae==="in-progress"?50:0});},isDark:V,locale:f,translations:ye.status});case "priority":return jsxRuntime.jsx(Ug,{value:k.priority,onChange:ae=>Q({priority:ae}),isDark:V,locale:f});case "assignees":{let ae=k.hasChildren,Pe=k.assignees||[];if(ae&&k.subtasks?.length){let Ie=new Map,Xe=It=>{(It||[]).forEach(mt=>{(mt.assignees||[]).forEach(ft=>{Ie.has(ft.name)||Ie.set(ft.name,ft);}),mt.subtasks?.length&&Xe(mt.subtasks);});};Xe(k.subtasks),Pe=Array.from(Ie.values());}else ae&&(Pe=[]);return jsxRuntime.jsx(Rl,{value:Pe,availableUsers:i,onChange:Ie=>Q({assignees:Ie}),isDark:V,locale:f,disabled:ae})}case "startDate":return jsxRuntime.jsx($l,{value:k.startDate,onChange:ae=>Q({startDate:ae}),isDark:V,locale:f,dateField:"start",startDate:k.startDate,endDate:k.endDate});case "endDate":{let ae=jsxRuntime.jsx($l,{value:k.endDate,onChange:Pe=>Q({endDate:Pe}),isDark:V,locale:f,dateField:"end",startDate:k.startDate,endDate:k.endDate});return t.isTaskOverdue?.(k)?jsxRuntime.jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:V?"#FF7A7F":"#C22F35"},children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),ae]}):ae}case "progress":{let ae=!!(k.subtasks&&k.subtasks.length>0),Pe=ae?Q0(uu(k.subtasks||[])):k.progress||0;return jsxRuntime.jsx(Yg,{value:Pe,onChange:ae?void 0:Ie=>{let Xe=Ie===100?"completed":Ie>0?"in-progress":"todo";Q({progress:Ie,status:Xe});},isDark:V,disabled:ae})}case "tags":return jsxRuntime.jsx(u0,{value:k.tags||[],isDark:V});case "text":return jsxRuntime.jsx(Qg,{value:se(q.customFieldId)||"",onChange:ae=>me(q.customFieldId,ae),isDark:V});case "number":return jsxRuntime.jsx(t0,{value:se(q.customFieldId)||0,onChange:ae=>me(q.customFieldId,ae),isDark:V});case "date":let Oe=se(q.customFieldId);return jsxRuntime.jsx($l,{value:Oe?new Date(Oe):void 0,onChange:ae=>me(q.customFieldId,ae),isDark:V,locale:f});case "dropdown":return jsxRuntime.jsx(a0,{value:se(q.customFieldId)||"",options:q.options||[],onChange:ae=>me(q.customFieldId,ae),isDark:V});case "checkbox":return jsxRuntime.jsx(n0,{value:se(q.customFieldId)||false,onChange:ae=>me(q.customFieldId,ae),isDark:V});case "multiselect":return jsxRuntime.jsx(o0,{value:se(q.customFieldId)||[],options:q.options||[],onChange:ae=>me(q.customFieldId,ae),isDark:V,maxSelectable:q.maxSelectable});case "person":{let ae=se(q.customFieldId)||[];return jsxRuntime.jsx(Rl,{value:ae.map(Pe=>({name:Pe.name,avatar:Pe.avatar,initials:Pe.initials||(Pe.name||"?").slice(0,2).toUpperCase(),color:Pe.color||"#00E5CC"})),availableUsers:i,onChange:Pe=>me(q.customFieldId,Pe),isDark:V,locale:f})}case "file":return jsxRuntime.jsx(l0,{value:se(q.customFieldId),isDark:V,onOpen:ae=>{ae.url&&window.open(ae.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let ae=k.status==="completed"||k.progress===100;return jsxRuntime.jsx(Wr,{value:k.estimatedTime,onChange:Pe=>Q({estimatedTime:Pe}),isDark:V,locale:f,disabled:ae,lens:O,hourlyRate:Ue(k)})}case "quotedTime":{let ae=k.status==="completed"||k.progress===100,Pe=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsxRuntime.jsx(Wr,{value:k.quotedTime,onChange:Ie=>Q({quotedTime:Ie}),isDark:V,locale:f,disabled:ae,isBlurred:Pe,lens:O,hourlyRate:Ue(k)})}case "elapsedTime":{let ae=k.status==="completed"||k.progress===100,Pe=k.executedDollarsCanonical;return jsxRuntime.jsx(Wr,{value:k.elapsedTime,onChange:Ie=>Q({elapsedTime:Ie}),isDark:V,locale:f,disabled:ae,lens:O,hourlyRate:Ue(k),financialOverride:Pe})}case "effortMinutes":{if(Se&&k.subtasks&&k.subtasks.length>0){let{allocated:It}=Ls(k);if(O==="financial"){let mt=ne(k),ft=Math.round(mt.dollarAllocated),pa=Math.round(mt.dollarQuoted),Vt=pa-ft;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[ft>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",ft.toLocaleString("es-CO")]}):null,Vt!==0&&ft>0&&pa>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Vt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Vt>0?"+":"",Math.abs(Vt)>=1e3?`$${(Vt/1e3).toFixed(1)}K`:`$${Vt}`]})]})}return jsxRuntime.jsx(Wr,{value:It>0?It:void 0,isDark:V,locale:f,disabled:true,lens:O,hourlyRate:X})}let ae=k.status==="completed"||k.progress===100,Pe=k.effortMinutes||0,Ie=k.soldEffortMinutes||0,Xe=Ue(k);if(O==="financial"&&Xe&&Pe>0&&Ie>0){let It=Math.round(Pe/60*Xe),ft=Math.round(Ie/60*Xe)-It;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Wr,{value:Pe,onChange:pa=>Q({effortMinutes:pa}),isDark:V,locale:f,disabled:ae,lens:O,hourlyRate:Ue(k)}),ft!==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}`]})]})}return jsxRuntime.jsx(Wr,{value:Pe,onChange:It=>Q({effortMinutes:It}),isDark:V,locale:f,disabled:ae,lens:O,hourlyRate:Ue(k)})}case "timeLoggedMinutes":{let ae=k.executedDollarsCanonical;if(Se&&k.subtasks&&k.subtasks.length>0){let{spent:Ie}=Ls(k);return jsxRuntime.jsx(Wr,{value:Ie>0?Ie:void 0,isDark:V,locale:f,disabled:true,lens:O,hourlyRate:Ue(k),financialOverride:ae})}let Pe=k.status==="completed"||k.progress===100;return jsxRuntime.jsx(Wr,{value:k.timeLoggedMinutes,onChange:a.onLogTime?Ie=>{a.onLogTime?.(k,Ie);}:void 0,isDark:V,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Pe,lens:O,hourlyRate:Ue(k),financialOverride:ae})}case "soldEffortMinutes":{if(Se&&k.subtasks&&k.subtasks.length>0){let{quoted:Ie}=Ls(k),Xe=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Wr,{value:Ie>0?Ie:void 0,isDark:V,locale:f,disabled:true,isBlurred:Xe,lens:O,hourlyRate:Ue(k)})}let ae=k.status==="completed"||k.progress===100,Pe=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Wr,{value:k.soldEffortMinutes,onChange:Ie=>Q({soldEffortMinutes:Ie}),isDark:V,locale:f,disabled:ae,isBlurred:Pe,lens:O,hourlyRate:Ue(k)})}case "scheduleVariance":{let ae=k.effortMinutes||0,Pe=k.soldEffortMinutes||0,Ie=k.timeLoggedMinutes||0,Xe=ae>0||Pe>0||Ie>0;return jsxRuntime.jsx(f0,{startDate:k.startDate,endDate:k.endDate,scheduleVariance:k.scheduleVariance,isDark:V,locale:f,hasTimeAllocated:Xe})}case "hoursBar":{if(Se&&k.hasChildren){let{spent:ae,allocated:Pe,quoted:Ie}=Ls(k),Xe=ae>Pe&&Pe>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",V?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",Xe?"text-[#FF453A]":V?"text-white/80":"text-gray-800"),children:Fs(ae)}),Pe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:V?"text-white/60":"text-gray-600",children:Fs(Pe)})]}),Ie>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:V?"text-amber-400/70":"text-amber-600",children:Fs(Ie)})]})]})}return jsxRuntime.jsx(h0,{task:k,isDark:V,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:O,hourlyRate:Ue(k)})}case "teamLoad":return k.hasChildren||k.subtasks&&k.subtasks.length>0?jsxRuntime.jsx(x0,{task:k,isDark:V,locale:f}):jsxRuntime.jsx(Rl,{value:k.assignees||[],availableUsers:i,onChange:Pe=>{a.onTaskUpdate?.({...k,assignees:Pe});},isDark:V,locale:f});case "blockers":return jsxRuntime.jsx(w0,{blockers:k.blockers,isDark:V,locale:f});case "weight":{let ae=Ne.get(k.id);if(ae!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",ae>0?V?"text-white/50":"text-gray-400":V?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ae>0?`${Number(ae.toFixed(2))}%`:"\u2014"});let Pe=k.weight||0;return jsxRuntime.jsx(bC,{value:Pe,onChange:Ie=>Q({weight:Ie}),isDark:V})}default:return jsxRuntime.jsx("span",{className:g("text-sm",V?"text-white/60":"text-gray-500"),children:"-"})}},[a,V,f,i,ye,Se,Ne]),Ws=react.useCallback(k=>{let Q={name:ye.columns.name,status:ye.columns.status,priority:ye.columns.priority,assignees:ye.columns.assignees,startDate:ye.columns.startDate,endDate:ye.columns.endDate,progress:ye.columns.progress,tags:ye.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:ye.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:ye.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:ye.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:ye.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:ye.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:ye.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:ye.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:ye.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:ye.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:ye.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:ye.columns.weight||(f==="es"?"Peso":"Weight")}[k.type]||k.label;return typeof Q=="string"?Q:String(Q||k.type)},[ye,f]),Hn=react.useMemo(()=>{let Q=Xt.reduce((me,Oe)=>me+Oe.width,0)+(C?48:0),se={};for(let me of Xt)se[me.id]=`${me.width/Q*100}%`;return se},[Xt,C]);return r?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",V?"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",V?"text-white/60":"text-gray-600"),children:[ye.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",V?"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",V?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",V?"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",V?"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",V?"text-white":"text-gray-900"),children:ye.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",V?"text-white/60":"text-gray-600"),children:ye.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:ot,className:g(V?"bg-[#0D0D0D]":"bg-white",Z&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let k=!!t.toolbarContainer,q=jsxRuntime.jsx("div",{className:k?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",V?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:k?"flex items-center gap-2":"flex items-center gap-4",children:[jsxRuntime.jsx("div",{className:g("text-sm whitespace-nowrap",V?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let Q=vr.filter(Oe=>(Oe.subtasks?.length??0)>0).length,se=vr.length-Q,me=f==="es";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[se," ",ye.pagination.tasks,Q>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" \xB7 ",Q," ",me?Q===1?"tarea padre":"tareas padre":Q===1?"parent task":"parent tasks"]})]})})()}),b&&!k&&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",V?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Nt,onChange:Q=>lt(Q.target.value),placeholder:ye.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",V?"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")})]}),!k&&jsxRuntime.jsx("div",{className:"flex-1"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),h&&B>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:he,onClick:()=>j(!pt),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",V?pt?"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]":pt?"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"}),ie==="all"?f==="es"?"Todos":"All":`L${ie}`]}),pt&&jsxRuntime.jsx("div",{ref:re,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",V?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(B,5)},(Q,se)=>({value:se+1,label:`L${se+1}`}))].map(Q=>jsxRuntime.jsxs("button",{onClick:()=>{fe(Q.value),j(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",V?ie===Q.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":ie===Q.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:Q.label}),ie===Q.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(Q.value)))})]}),t.showStatusFilter!==false&&jsxRuntime.jsx(j0,{value:Ee,hideCompleted:xt,onChange:ct,onHideCompletedChange:Ke,isDark:V,locale:f}),ze?.enabled&&ze.data&&!Le&&jsxRuntime.jsx("button",{onClick:()=>$e(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",V?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&S&&!k&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:S,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:ye.toolbar.newTask})]})]})});return k?reactDom.createPortal(q,t.toolbarContainer):q})(),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",V?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[sn&&jsxRuntime.jsx("div",{className:"w-6 flex-shrink-0"}),Qe&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Xt.map(k=>{let q=k.id!=="name",Q=gt===k.id&&be!==k.id;return jsxRuntime.jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",V?"text-white/60":"text-gray-500",q&&"cursor-grab",k.type!=="name"&&"justify-center",be===k.id&&"opacity-50",Q&&(V?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Hn[k.id],minWidth:k.minWidth},draggable:q,onDragStart:q?se=>Zn(se,k.id):void 0,onDragEnd:q?Pi:void 0,onDragOver:q?se=>Zo(se,k.id):void 0,onDragLeave:q?Fi:void 0,onDrop:q?se=>qa(se,k.id):void 0,onContextMenu:se=>Bn(se,void 0,k.id),children:[q&&jsxRuntime.jsx(lucideReact.GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",V?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxRuntime.jsxs("button",{draggable:false,onClick:se=>{let me=se.currentTarget.getBoundingClientRect();u(k.id,me);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ws(k),p?.includes(k.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),je===k.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):k.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>yr(k.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ws(k),p?.includes(k.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",je===k.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ws(k),p?.includes(k.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),P&&k.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:se=>Qn(se,k.id),children:jsxRuntime.jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",Z===k.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},k.id)}),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),Ce(q=>!q);},className:g("p-0.5 rounded transition-colors",V?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",J&&(V?"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(O0,{isOpen:J,onClose:()=>Ce(false),columns:st,customFields:c,mostrarColumnasDensas:w,onColumnsChange:Sr,onCreateCustomField:()=>{Ce(false),K(true);},isDark:V,locale:f})]})]}),jsxRuntime.jsxs(framerMotion.AnimatePresence,{mode:"popLayout",children:[Br.map((k,q)=>Us(q,(()=>{let Q=_t.has(k.id),se=Math.min(q*.01,.2),me=k.hasChildren&&k.level===0,Oe=k.subtasks?.length||0;if(me){let{spent:mt,allocated:ft,quoted:pa}=Ls(k),Vt=fC(k);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:se},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",V?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Ve===k.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(k),children:[sn&&ta(k.id),Qe&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Xt.map(Ya=>jsxRuntime.jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",Ya.type!=="name"&&"justify-center"),style:{width:Hn[Ya.id],minWidth:Ya.minWidth},children:Ya.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Kt=>{Kt.stopPropagation(),ir(k.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Q?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",V?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",V?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Kt=>{Kt.stopPropagation(),ir(k.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Q?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}})}),k.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:V?"#FFD60A":"#B45309"},children:k.wbsCode}),jsxRuntime.jsxs("div",{className:g("flex min-w-0",R?"flex-row items-baseline gap-2":"flex-col"),children:[jsxRuntime.jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",R&&"truncate",V?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:k.name}),jsxRuntime.jsxs("span",{className:g(R?"text-[12px] flex-shrink-0":"text-[10px] font-mono",V?"text-white/30":"text-gray-500"),children:["(",Oe," ",f==="es"?Oe===1?"Tarea":"Tareas":Oe===1?"Item":"Items",")"]}),Vt!==null&&x&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",Vt>=1?"text-[#32D74B] bg-[#32D74B]/10":Vt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",Vt.toFixed(2)]})]})]}):Ya.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Kt=k.executedDollarsCanonical,aa=Kt!=null?Math.round(Kt):Math.round(ne(k).dollarSpent);return aa>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",aa.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Wr,{value:mt>0?mt:void 0,isDark:V,locale:f,disabled:true,lens:O,hourlyRate:Ue(k)}):Ya.type==="soldEffortMinutes"?O==="financial"?(()=>{let Kt=ne(k),aa=Math.round(Kt.dollarQuoted);return aa>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",aa.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Wr,{value:pa>0?pa:void 0,isDark:V,locale:f,disabled:true,lens:O,hourlyRate:Ue(k)}):Ya.type==="effortMinutes"?O==="financial"?(()=>{let Kt=ne(k),aa=Math.round(Kt.dollarAllocated),Dt=Math.round(Kt.dollarQuoted),Ot=Dt-aa;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[aa>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",aa.toLocaleString("es-CO")]}):null,Ot!==0&&aa>0&&Dt>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ot>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>0?"+":"",Math.abs(Ot)>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`]})]})})():jsxRuntime.jsx(Wr,{value:ft>0?ft:void 0,isDark:V,locale:f,disabled:true,lens:O,hourlyRate:Ue(k)}):ts(k,Ya)},Ya.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},k.id)}let ae=pe===k.id,Pe=ht===k.id,Ie=Pe&&kt==="above",Xe=Pe&&kt==="below",It=Pe&&kt==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":k.id,"data-listview-row":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:se},className:g("flex items-center border-b transition-colors relative group",V?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Ve===k.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100"),sn&&On.has(k.id)&&(V?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":sn&&On.has(k.id)?"true":void 0,style:{opacity:ae?.4:1,backgroundColor:It?V?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:It?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(k),onDoubleClick:()=>a.onTaskDoubleClick?.(k),onContextMenu:mt=>Bn(mt,k),onMouseEnter:()=>xa(k.id),onMouseLeave:()=>xa(mt=>mt===k.id?null:mt),children:[Ie&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Xe&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),sn&&ta(k.id),Qe&&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=>Ze(k.id,mt),style:{color:V?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Xt.map(mt=>{let ft=!!(k.subtasks&&k.subtasks.length>0),pa=fa(mt),Ya=!!pa&&!ft&&vt===k.id&&!At,Kt=!!At&&!!pa&&hr(At.column,pa)&&Rr(k.id);return jsxRuntime.jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",mt.type!=="name"&&"justify-center"),style:{width:Hn[mt.id],minWidth:mt.minWidth,position:"relative",backgroundColor:Kt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Kt?"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:[h&&k.level>0&&jsxRuntime.jsx("div",{style:{width:`${k.level*24}px`},className:"flex-shrink-0"}),h&&k.hasChildren&&jsxRuntime.jsx("button",{onClick:aa=>{aa.stopPropagation(),ir(k.id);},className:g("p-0.5 rounded flex-shrink-0",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Q?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",V?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",V?"text-white/60":"text-gray-400")})}),h&&!k.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:g("flex min-w-0 flex-1",R?"flex-row items-center gap-2":"flex-col"),children:[(k.wbsCode||k.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[k.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),children:k.wbsCode}),k.taskCode&&jsxRuntime.jsx("span",{"data-codigo-tarea":true,className:g(R?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",V?"text-white/40":"text-gray-400"),style:R&&!V?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:k.taskCode})]}),jsxRuntime.jsx("span",{className:g("truncate",k.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",k.progress===100?t.completedStyle==="dim"?V?"text-white/45":"text-gray-400":V?"line-through text-white/50":"line-through text-gray-400":k.hasChildren?V?"text-white":"text-gray-900":V?"text-[#D1D5DB]":"text-gray-600"),children:k.name}),k.tags?.[0]&&jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",R&&"flex-shrink-0"),style:{backgroundColor:`${k.tags[0].color}20`,color:k.tags[0].color},children:k.tags[0].name})]})]}):Ya&&pa?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[ts(k,mt),jsxRuntime.jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:aa=>Ta(aa,k.id,pa,q),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}})]}):ts(k,mt)},mt.id)}),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},k.id)})())),Us(Br.length,null)]}),G&&Br.length>0&&(()=>{let{spent:k,allocated:q,quoted:Q}=ce,se=q-k,me=se<0,Oe=me?`+${Fs(Math.abs(se))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Fs(se)} ${f==="es"?"AHORRADO":"SAVED"}`,ae=O==="financial"&&X>0,Pe=ve?.breakdown,Ie=!!Pe&&((Pe.equipment??0)>0||(Pe.travel??0)>0),Xe=Pe?.laborSpent!=null?Pe.laborSpent:ve?.spent!=null?ve.spent:ce.dollarSpent,It=Pe?.laborAllocated!=null?Pe.laborAllocated:ve?.allocated!=null?ve.allocated:ce.dollarAllocated,mt=ve?.quoted!=null?ve.quoted:ce.dollarQuoted,ft=(Kt,aa)=>{if(ae){let Dt=aa??Kt/60*X;return `$${Math.round(Dt).toLocaleString("es-CO")}`}return Fs(Kt)},pa=ae?Math.abs(It-Xe):0,Vt=ae?`+$${pa.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${me?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:Oe,Ya=ae&&Ie?f==="es"?"solo mano de obra":"labor only":void 0;return jsxRuntime.jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",V?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:V?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[sn&&jsxRuntime.jsx("div",{className:"w-6 flex-shrink-0"}),Qe&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Xt.map(Kt=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Kt.type!=="name"&&"justify-center"),style:{width:Hn[Kt.id],minWidth:Kt.minWidth},children:Kt.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Ya&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",V?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),Ya]})]}):Kt.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",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(k,ae?Xe:void 0)}),jsxRuntime.jsx("span",{className:g("text-[11px]",V?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:g("text-[11px]",V?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(q,ae?It:void 0)})]}),q>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",me?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ae?Vt:Oe})]}):Kt.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?ft(Q,ae?mt:void 0):"\u2013"}):Kt.type==="effortMinutes"?(()=>{if(ae&&Q>0&&q>0){let aa=Math.round(mt),Dt=Math.round(It),Ot=aa-Dt,Ra=aa>0?Math.round(Ot/aa*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(q,It)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ot>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>=0?"+":"",Math.abs(Ot)>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Ra,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:q>0?ft(q,ae?It:void 0):"\u2013"})})():Kt.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:k>0?ft(k,ae?Xe:void 0):"\u2013"}):Kt.type==="progress"?(()=>{let aa=Q0(uu(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[aa,"%"]})})():Kt.type==="weight"?(()=>{let aa=e||[],Dt=[],Ot=lr=>{for(let Va of lr)Dt.push(Va),Va.subtasks?.length&&Ot(Va.subtasks);};Ot(aa);let wr=Dt.filter(lr=>!lr.subtasks?.length||lr.subtasks.length===0).reduce((lr,Va)=>lr+(Va.weight||0),0),Er=Math.abs(wr-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Er?V?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(wr.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",V?"text-white/30":"text-gray-300"),children:"\u2013"})},Kt.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Br.length===0&&Nt&&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",V?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(V?"text-white/60":"text-gray-600"),children:ye.empty.noResults})]})})]})}),ze?.enabled&&ze.data&&Le&&jsxRuntime.jsx(K0,{data:ze.data,isDark:V,locale:f,onClose:()=>$e(false),lens:t?.lens,onUnassignedTaskClick:k=>{let q=document.querySelector(`[data-task-id="${k}"]`);q&&(q.scrollIntoView({behavior:"smooth",block:"center"}),oe(k),setTimeout(()=>oe(null),2e3));}})]}),jsxRuntime.jsx(E0,{state:we,onClose:_r,isDark:V,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ia,onColumnSort:Qo,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),bt&&De&&pe&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:De.x+12,top:De.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let q=Me.flattenTasks(e).find(Q=>Q.id===pe);return q?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:V?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${V?"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:V?"#e6edf3":"#111827"},children:q.name})]}):null})()}),document.body),jsxRuntime.jsx(W0,{isOpen:I,onClose:()=>K(false),onSave:Bs,isDark:V,locale:f})]})}var tf=[{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}],af=[{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"}],rf=[{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 pu={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"},mu={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"},gu={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"},Kl={dark:pu,light:mu,neutral:gu};function nf(e){return Kl[e]||Kl.dark}function ql(e,t,a,r,n=5){let s=[],o=[],i=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of i){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),b=0;for(;(s[b]||[]).some(([h,y])=>!(v<h||f>y));)b++;(s[b]=s[b]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:b,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let l=[],u=[],p={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],b=[];for(let h=0;h<n;h++)c[f].has(h)||b.push(h);if(v.length<=b.length)v.forEach((h,y)=>l.push({it:h,day:f,lane:b[y]}));else {let h=Math.max(b.length-1,0);v.slice(0,h).forEach((y,x)=>l.push({it:y,day:f,lane:b[x]})),u.push({day:f,lane:b[h]!=null?b[h]:n-1,count:v.length-h,items:v.slice(h)});}});let d=s.length;return l.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:l,more:u,laneCount:Math.max(d,1)}}var hC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],yC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function of(e){return e==="es"?hC:yC}function sf(e){return (e.getDay()+6)%7}function lf(e,t){let a=new Date(e,t,1),r=sf(a),n=new Date(e,t,1-r),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},i=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=i(a),l=new Date(e,t+1,0),u=i(l);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:i,monthStartSerial:c,monthEndSerial:u}}function wi(e,t){return sf(e.serialToDate(t))>=5}function cf(e,t,a,r,n){let s=[],o=[],i=[],c=Math.max(1,n),l=0;for(let u=a;u<=r;u++){let p=e.filter(b=>!b.container&&b.endSerial===u).sort((b,h)=>+!!b.done-+!!h.done||b.name.localeCompare(h.name)),d=t.filter(b=>b.serial===u),m=p.length+d.length;if(m===0)continue;let f=Math.min(m,c),v=0;for(let b of p.slice(0,f))s.push({t:b,s:u,e:u,lane:v++,contL:false,contR:false});for(let b of d.slice(0,Math.max(0,f-Math.min(p.length,f))))o.push({it:b,day:u,lane:v++});if(m>f){let b=d.slice(Math.max(0,f-Math.min(p.length,f)));i.push({day:u,lane:-1,count:m-f,items:b});}l=Math.max(l,v);}return {bars:s,chips:o,more:i,laneCount:Math.max(l,1)}}function xC(e){let t=[],a=(r,n,s)=>{for(let o of r){let i=n||o.id,c=s||o.name;t.push({t:o,phaseId:i,phaseName:c}),o.subtasks?.length&&a(o.subtasks,i,c);}};return a(e,"",""),t}function df(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function uf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Yl(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=xC(t),i=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=df(u.startDate),f=df(u.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),b=a.dateToSerial(f);if(b<1||v>i)continue;let h=u.effortMinutes??0,y=Math.round(h/60*10)/10,x=u.costAtCompletion,w=x!=null?uf(x):uf(y*n),C=u.assignees?.[0],P=C?.initials||(C?.name?kC(C.name):void 0),$=u.displayId||u.wbsCode||"",T=wC($||u.id)?"":$||u.id;c.push({uid:u.id,id:T,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(b,i),hrs:y,cost:w,critical:!!u.isCriticalPath,who:P,realStart:m,realEnd:f,phaseId:p,phaseName:d,done:u.progress===100||u.status==="completed",overdue:!(u.progress===100||u.status==="completed")&&(()=>{let S=new Date;S.setHours(0,0,0,0);let M=new Date(f);return M.setHours(0,0,0,0),M<S})(),milestone:!!u.isMilestone,container:!!(u.subtasks&&u.subtasks.length>0)});}let l=[];return {calTasks:c,dayItems:l,isEmpty:c.length===0&&l.length===0}}var vC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function wC(e){return vC.test(e)||/^task-\d+/.test(e)}function kC(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 CC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],TC=["January","February","March","April","May","June","July","August","September","October","November","December"];function pf(e,t,a){return `${(a==="es"?CC:TC)[t]} ${e}`}var fu=26,NC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Xl({locale:e}){let t=of(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsxRuntime.jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function Jl({bar:e,ws:t,money:a,projColor:r,slotH:n=fu,due:s=false,showValues:o=true}){let{t:i}=e,c=e.s-t,l=e.e-e.s+1,u="cal-bar"+(i.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":"")+(s?" due":"")+(s&&i.done?" done":"")+(s&&i.overdue?" overdue":"")+(s&&i.milestone?" hito":""),p=a==="$"?i.cost:`${i.hrs}h`,d=o&&(a==="$"||i.hrs>0),m={"--proj":e.color??i.color??r,left:`calc(${c}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:u,style:m,children:[i.critical&&l>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s&&i.done?jsxRuntime.jsx("span",{className:"ico","aria-hidden":true,children:"\u2713"}):null,s&&i.overdue?jsxRuntime.jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 12 12","aria-hidden":true,children:[jsxRuntime.jsx("circle",{cx:"6",cy:"6",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"6",y1:"3.4",x2:"6",y2:"6.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"8.6",r:"0.8",fill:"currentColor"})]}):null,s&&i.milestone?jsxRuntime.jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":true,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}):null,i.id?jsxRuntime.jsx("span",{className:"tk",children:i.id}):null,jsxRuntime.jsx("span",{className:"nom",children:i.name}),l>=3&&d?jsxRuntime.jsx("span",{className:"val",children:p}):null,s&&i.overdue?jsxRuntime.jsx("span",{className:"sr-only",children:"Overdue"}):null]})}function Ql({chip:e,ws:t,slotH:a=fu}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:NC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Zl({more:e,ws:t,slotH:a=fu,onClick:r,enCabecera:n=false,locale:s="es"}){let o=e.day-t,i=n?{left:`calc(${o+1}/7*100% - 4px)`,top:"-25px",transform:"translateX(-100%)"}:{left:`calc(${o}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxRuntime.jsxs("div",{className:n?"cal-more en-cabecera":"cal-more",style:i,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," ",s==="en"?"more":"m\xE1s"]})}function mf({projects:e,locale:t="es"}){let a=t==="en";return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var MC=[{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 bu({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:i=false,hiddenViews:c=[]}){let l=o==="en",u=MC.filter(p=>!c.includes(p.id));return i?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:`${l?p.en:p.es} (${p.key})`,children:l?p.en:p.es},p.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),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:[l?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:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function gf({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:i,phaseFilter:c="all",onPhaseChange:l,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=react.useState(false),v=react.useRef(null),b=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 h=c==="all"?b?"Todas":"All":i?.find(y=>y.id===c)?.name??(b?"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:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:b?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),i&&i.length>0&&l?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:b?"Fase":"Phase"})," ",h," \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:()=>{l("all"),f(false);},children:jsxRuntime.jsx("span",{className:"nm",children:b?"Todas las fases":"All phases"})}),i.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:()=>{l(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 ",b?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var PC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function ff({off:e,onToggle:t}){let a=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:PC.map(r=>{let n=a.includes(r.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:r.nm}),jsxRuntime.jsx("div",{className:"sub",children:r.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var IC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},RC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function hf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let i=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 l=a.length+t.length,p=r||(d=>{switch(d.type){case "hito":return i?"Milestone":"Hito";case "desembolso":return i?"Disb.":"Desemb.";case "deadline":return i?"Due":"Vence";case "aus":return i?"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 ${l} ${i?"items":"elementos"}`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",i?l===1?"item":"items":l===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[a.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:RC[d.type]},children:IC[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 bf={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 yf({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r}){let n=bf[a]||bf.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})]}),r?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,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 vf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function OC(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 xf=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function HC(e){return xf[e%xf.length]}function UC(e){return e>1?"over":e>=.9?"warn":"ok"}var hu="\xA0";function _o(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function wf(e,t,a){let r=new Map,n=new Set;for(let i of t)i.isWeekend||i.isHoliday||n.add(vf(i.date));if(n.size===0)return r;let s=new Map;e.forEach((i,c)=>{s.set(i.userId,{color:HC(c),initials:OC(i.name)});});let o=new Map;for(let i of e)for(let c of i.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let l=o.get(c.date);l.set(i.userId,(l.get(i.userId)??0)+(c.hours||0));}for(let i of n){let c=o.get(i)??new Map,l=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:a}}),u=l.reduce((p,d)=>p+d.hours,0);r.set(i,{assigned:Math.round(u*100)/100,capacity:a*e.length,perPerson:l});}return r}function kf({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=vf(n.date),o=n.isWeekend||n.isHoliday,i=o?void 0:t.get(s),c=!!i&&i.capacity>0,l=c?i.assigned/i.capacity:0,p="cal-cap-cell "+(o?"off":UC(l))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:p,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${hu}/${hu}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[_o(i.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",hu,_o(i.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:c?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(l*100,100)+"%"}}):null})]},n.serial)})})}function Cf({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=react.useRef(null);react.useEffect(()=>{let l=p=>{p.key==="Escape"&&a();},u=p=>{n.current&&!n.current.contains(p.target)&&a();};return document.addEventListener("keydown",l),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",l),document.removeEventListener("mousedown",u);}},[a]);let s=t.reduce((l,u)=>l+u.hours,0),o=t.reduce((l,u)=>l+u.capacity,0),i=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,...r},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:i?{color:"var(--red)"}:void 0,children:[_o(s),"h asignadas / ",_o(o),"h"]}),i?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",_o(c),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(l=>{let u=l.capacity>0&&l.hours>l.capacity,p=l.capacity>0?l.capacity:1;return jsxRuntime.jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:l.color},children:l.initials}),jsxRuntime.jsx("span",{className:"nm",title:l.name,children:l.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(l.hours/p*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[_o(l.hours),"h / ",_o(l.capacity),"h"]})]},l.name)})})]})}var yu=28,zC=182;function Nf({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:i,capRows:c,teamSize:l,onTaskOpen:u,onMore:p,onCapDay:d}){let m=i==="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(GC,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),c&&c[v]?jsxRuntime.jsx(kf,{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",l!=null?` \xB7 ${l} ${m?l===1?"persona":"personas":l===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 GC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,onTaskOpen:c,onMore:l}){let u=react.useMemo(()=>ql(r,n,t,a),[r,n,t,a]),p=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=a;f++)d.push(f);let m={height:`${zC}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),b=f>=e.monthStartSerial&&f<=e.monthEndSerial,h="cal-day";return wi(e,f)&&(h+=" wknd"),b||(h+=" out"),f===i&&(h+=" today"),p.has(f)&&(h+=" deadline-day"),jsxRuntime.jsx("div",{className:h,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(Jl,{bar:f,ws:t,money:s,projColor:o,slotH:yu})},`b${v}`)),u.chips.map((f,v)=>jsxRuntime.jsx(Ql,{chip:f,ws:t,slotH:yu},`c${v}`)),u.more.map((f,v)=>jsxRuntime.jsx(Zl,{more:f,ws:t,slotH:yu,onClick:()=>l(f.day,f.items,r.filter(b=>b.startSerial<=f.day&&b.endSerial>=f.day))},`m${v}`))]})]})}var VC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jC(e){return VC.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 Df(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function KC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Sf(e,t){let a=KC(e),r=[];for(let n of a){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,i=n.costAtCompletion,c=i!=null?Df(i):Df(o*t),l=n.assignees?.[0],u=l?.initials||(l?.name?_C(l.name):void 0),p=n.displayId||n.wbsCode||"",d=jC(p||n.id)?"":p||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return r}function Ef({items:e,onItemClick:t,onCollapse:a,money:r,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:a,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(i=>{let c=r==="$"?i.cost:`${i.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(i.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[i.id?jsxRuntime.jsx("span",{className:"tk",children:i.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:i.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:i.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[i.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:c}),i.who?jsxRuntime.jsx("span",{className:"cal-ava",children:i.who}):null]})]},i.taskId)})]})}function Mf({onExpand:e,locale:t="es"}){let a=t==="en";return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"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 ",a?"Status":"Estado"]})]})}function Is(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Pf({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:i}){let c=react.useRef(null),l=n==="es";react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=a.wasCritical,p=a.projectEndDeltaDays,d=p>0?`+${p} ${l?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Is(a.oldProjectEnd,n)} \u2192 ${Is(a.newProjectEnd,n)}`:`+0 ${l?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${l?"holgura":"slack"} ${a.slackDays}d`:""}`,m=p>0?l?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:l?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...i},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:l?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Is(a.oldStart,n)," \u2013 ",Is(a.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Is(a.newStart,n)," \u2013 ",Is(a.newEnd,n)]})]})]}),u?jsxRuntime.jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",l?"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:l?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.jsx("span",{className:"v",children:a.movedSuccessors.length===0?l?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:l?"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:l?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.jsx("span",{className:"v",children:a.stillCritical?l?"Sigue en CPM":"Stays critical":a.wasCritical?l?"Sale de CPM":"Leaves critical":l?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:l?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?l?"Guardando\u2026":"Saving\u2026":m})]})]})}var JC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Ff({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:i}){let c=o==="es",l=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 a)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,a,e]);if(l.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:l.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:()=>i?.(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:r==="$"?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:JC[d.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function QC(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function ec(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function xu(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function Lf(e,t){let a=new Map(e.map(l=>[l.id,l])),r=new Map;for(let l of e)for(let u of ec(l))r.has(u)||r.set(u,[]),r.get(u).push(l.id);let n=new Map,s=new Map,o=new Set,i=l=>{if(s.has(l))return s.get(l);if(o.has(l))return s.get(l)??0;o.add(l);let u=a.get(l);if(!u)return o.delete(l),0;let p=ec(u).filter(f=>a.has(f)),d=t.has(l)?t.get(l):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=i(f);v>d&&(d=v);}let m=xu(u)*864e5;return n.set(l,d),s.set(l,d+m),o.delete(l),s.get(l)};for(let l of e)i(l.id);let c=0;return s.forEach(l=>{l>c&&(c=l);}),{finish:s,start:n,projectEnd:c}}function Af(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let l of ec(c))n.has(l)||n.set(l,[]),n.get(l).push(c.id);let s=new Map,o=[...e].sort((c,l)=>(t.get(l.id)??0)-(t.get(c.id)??0));for(let c of o){let l=n.get(c.id)??[];if(l.length===0)s.set(c.id,a);else {let u=1/0;for(let p of l){let d=s.get(p),m=r.get(p);d!=null&&m&&(u=Math.min(u,d-xu(m)*864e5));}s.set(c.id,u===1/0?a:u);}}let i=new Set;for(let c of e){let l=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(l)<864e5/2&&ec(c).length+(n.get(c.id)?.length??0)>0&&i.add(c.id);}return i}function tc(e,t,a,r){let n=QC(e),s=n.find(h=>h.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),i=new Date(s.endDate),c=Lf(n,new Map),l=Af(n,c.finish,c.projectEnd),u=n.map(h=>h.id===t?{...h,startDate:a,endDate:r}:h),p=Lf(u,new Map([[t,a.getTime()]])),d=Af(u,p.finish,p.projectEnd),m=new Map(u.map(h=>[h.id,h])),f=[];for(let h of n){if(h.id===t)continue;let y=c.start.get(h.id),x=p.start.get(h.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=xu(m.get(h.id))*864e5;f.push({id:h.id,name:h.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),b=l.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:i,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:l.has(t),stillCritical:d.has(t),slackDays:b}}function Rf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var $f=132,ac=26,wu=20,e2="#5B7FD4";function Of({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:i,onMoneyChange:c,onTaskOpen:l,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:b,members:h=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w,monthMode:C="span",showValues:P=true}){let $=react.useRef(null),[T,S]=react.useState(0);react.useEffect(()=>{if(C!=="due")return;let de=$.current;if(!de||typeof ResizeObserver>"u")return;let De=new ResizeObserver(()=>S(de.clientHeight));return De.observe(de),S(de.clientHeight),()=>De.disconnect()});let[M,N]=react.useState("mes"),[U,O]=react.useState(()=>{let de=new Date,De={y:de.getFullYear(),m:de.getMonth()},tt=(e??[]).map(Qe=>Qe.startDate?new Date(Qe.startDate):null).filter(Qe=>!!Qe&&!isNaN(Qe.getTime()));if(tt.length===0||(e??[]).some(Qe=>{let vt=Qe.startDate?new Date(Qe.startDate):null,xa=Qe.endDate?new Date(Qe.endDate):vt;if(!vt||isNaN(vt.getTime()))return false;let At=new Date(De.y,De.m,1),er=new Date(De.y,De.m+1,0,23,59,59);return vt<=er&&(xa??vt)>=At}))return De;let Wt=tt.reduce((Qe,vt)=>Qe<vt?Qe:vt);return {y:Wt.getFullYear(),m:Wt.getMonth()}}),[X,A]=react.useState(false),[Se,G]=react.useState([]),[ve,R]=react.useState("all"),[ye,V]=react.useState(null),[Ue,ne]=react.useState(null),[Be,ce]=react.useState(false),[Ne,ze]=react.useState(null),[Le,$e]=react.useState(false),Ve=react.useMemo(()=>lf(U.y,U.m),[U.y,U.m]),oe=r||e2,je=react.useMemo(()=>{let de=new Set;for(let De of y){let tt=new Date(`${De}T12:00:00`),Bt=Ve.dateToSerial(tt);Bt>=1&&Bt<=42&&de.add(Bt);}return de},[y,Ve]);react.useEffect(()=>{w?.({start:Rf(Ve.serialToDate(1)),end:Rf(Ve.serialToDate(42))});},[U.y,U.m]);let et=h.length,Re=react.useMemo(()=>{let de=x?.hoursPerDay;if(!de)return 8;let De=[de.monday,de.tuesday,de.wednesday,de.thursday,de.friday].map(tt=>tt||0).filter(tt=>tt>0);return De.length?Math.round(De.reduce((tt,Bt)=>tt+Bt,0)/De.length*10)/10:8},[x]),ut=react.useMemo(()=>Yl({tasks:e,grid:Ve,projectColor:()=>oe,hourlyRate:o,projectId:a}),[e,Ve,oe,o,a]),Nt=react.useMemo(()=>{if(d===false)return [];let de=new Map;for(let De of ut.calTasks)De.phaseId&&De.phaseName&&de.set(De.phaseId,De.phaseName);return [...de.entries()].map(([De,tt])=>({id:De,name:tt})).sort((De,tt)=>De.name.localeCompare(tt.name))},[ut.calTasks,d]),lt=!Se.includes("tareas"),Ee=!Se.includes("cpm"),ct=react.useMemo(()=>{let de=lt?ut.calTasks:[];return ve!=="all"&&(de=de.filter(De=>De.phaseId===ve)),Ee||(de=de.map(De=>De.critical?{...De,critical:false}:De)),de},[ut.calTasks,lt,Ee,ve]),xt=react.useMemo(()=>{let de=new Set;return Se.includes("hitos")&&(de.add("hito"),de.add("desembolso")),Se.includes("ext")&&de.add("ext"),Se.includes("aus")&&de.add("aus"),ut.dayItems.filter(De=>!de.has(De.type))},[ut.dayItems,Se]),Ke=!Se.includes("festivos"),st=new Date,L=Ve.dateToSerial(new Date(st.getFullYear(),st.getMonth(),st.getDate())),J=de=>G(De=>De.includes(de)?De.filter(tt=>tt!==de):[...De,de]),Ce=()=>O(de=>{let De=new Date(de.y,de.m-1,1);return {y:De.getFullYear(),m:De.getMonth()}}),I=()=>O(de=>{let De=new Date(de.y,de.m+1,1);return {y:De.getFullYear(),m:De.getMonth()}}),K=()=>{let de=new Date;O({y:de.getFullYear(),m:de.getMonth()});},we=(de,De,tt)=>{if(!v||De===0)return;let Bt=ut.calTasks.find(At=>At.uid===de);if(!Bt)return;let Wt=De*864e5,Qe=new Date(Bt.realStart.getTime()+Wt),vt=new Date(Bt.realEnd.getTime()+Wt),xa=tc(e,de,Qe,vt);xa&&ze({uid:de,taskId:Bt.id,taskName:Bt.name,sim:xa,anchor:tt});},Ge=async()=>{if(!Ne||!b)return;$e(true);let de=[{id:Ne.uid,startDate:Ne.sim.newStart,endDate:Ne.sim.newEnd},...Ne.sim.movedSuccessors.map(tt=>({id:tt.id,startDate:tt.newStart,endDate:tt.newEnd}))],De=await b(de);$e(false),De&&ze(null);},pe=pf(U.y,U.m,n),rt=[{id:"",name:t,color:oe}],bt=react.useMemo(()=>Sf(e,o),[e,o]),qe=react.useMemo(()=>{if(M==="lookahead"){let de=Ve.weeks.find(tt=>L>=tt.ws&&L<=tt.we)??Ve.weeks[0],De=Ve.weeks.indexOf(de);return Ve.weeks.slice(De,De+2)}return M==="semana"?[Ve.weeks.find(De=>L>=De.ws&&L<=De.we)??Ve.weeks[0]]:[]},[M,Ve.weeks,L]),ht=react.useMemo(()=>{let de={};return qe.forEach((De,tt)=>{let Bt=[];for(let Qe=De.ws;Qe<=De.we;Qe++)Bt.push({serial:Qe,date:Ve.serialToDate(Qe),isWeekend:wi(Ve,Qe),isHoliday:je.has(Qe)});let Wt=wf(h,Bt,Re);de[tt]={days:Bt,capByDay:Wt};}),de},[qe,Ve,je,h,Re]),Yt=M==="semana"||M==="lookahead",kt=M==="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(bu,{enCabecera:true,hiddenViews:p,view:M,onViewChange:N,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:de=>c(de==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsxRuntime.jsx(bu,{view:M,onViewChange:N,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:de=>c(de==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsxRuntime.jsx(gf,{monthLabel:pe,onPrev:Ce,onNext:I,onToday:K,layersOpen:X,onToggleLayers:()=>A(de=>!de),layersOff:Se,phases:Nt,phaseFilter:ve,onPhaseChange:R,locale:n,children:X?jsxRuntime.jsx(ff,{off:Se,onToggle:J}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:kt?"hidden":void 0},children:[kt?jsxRuntime.jsx(Ff,{grid:Ve,tasks:ct,items:xt,money:i,projColor:oe,todaySerial:L,locale:n,onTaskOpen:l}):Yt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xl,{locale:n}),jsxRuntime.jsx(Nf,{grid:Ve,weeks:qe,tasks:ct,items:xt,money:i,projColor:oe,todaySerial:L,locale:n,capRows:ht,teamSize:et,onTaskOpen:l,onMore:(de,De,tt)=>V({day:de,items:De,tasks:tt}),onCapDay:(de,De,tt)=>{for(let Bt of Object.keys(ht)){let Wt=ht[+Bt].capByDay.get(de);if(Wt){ne({dayLabel:De,perPerson:Wt.perPerson,anchor:tt.getBoundingClientRect()});break}}}})]}):ut.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Ve.weeks.map(de=>jsxRuntime.jsx("div",{className:"cal-week",style:{minHeight:C==="due"?0:`${$f}px`},children:jsxRuntime.jsx(Hf,{grid:Ve,ws:de.ws,we:de.we,todaySerial:L,showFestivos:Ke,holidaySerials:je,locale:n,deadlineDays:new Set})},de.ws))}),jsxRuntime.jsx(yf,{monthLabel:pe,locale:n,onCreateTask:f})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",ref:$,style:C==="due"?{minHeight:0,overflow:"hidden"}:void 0,children:Ve.weeks.map(de=>jsxRuntime.jsx(t2,{due:C==="due",slots:T>0?Math.max(1,Math.floor((T/Ve.weeks.length-26)/wu)):2,showValues:P,grid:Ve,ws:de.ws,we:de.we,tasks:ct,items:xt,money:i,projColor:oe,todaySerial:L,showFestivos:Ke,holidaySerials:je,locale:n,onTaskOpen:l,onMore:(De,tt,Bt)=>V({day:De,items:tt,tasks:Bt}),canReschedule:v,onDragReschedule:we,pendingGhost:Ne?{uid:Ne.uid,days:Math.round((Ne.sim.newStart.getTime()-Ne.sim.oldStart.getTime())/864e5)}:null},de.ws))})]}),ye?jsxRuntime.jsx(hf,{dayLabel:`${Ve.serialToDate(ye.day).getDate()}`,items:ye.items,tasks:ye.tasks.map(de=>({swatch:oe,taskId:de.id,label:de.name,critical:de.critical,value:i==="$"?de.cost:`${de.hrs}h`})),onClose:()=>V(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,Ue?jsxRuntime.jsx(Cf,{dayLabel:Ue.dayLabel,perPerson:Ue.perPerson,onClose:()=>ne(null),style:{position:"fixed",top:`${Ue.anchor.top-8}px`,left:`${Ue.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Ne?jsxRuntime.jsx(Pf,{taskName:Ne.taskName,taskId:Ne.sim.taskId,sim:Ne.sim,busy:Le,locale:n,onConfirm:Ge,onCancel:()=>ze(null),style:{position:"fixed",top:`${Ne.anchor.top+12}px`,left:`${Math.min(Ne.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),Be?jsxRuntime.jsx(Ef,{items:bt,money:i,projColor:oe,onItemClick:de=>l?.(de),onCollapse:()=>ce(false),locale:n==="en"?"en":"es"}):jsxRuntime.jsx(Mf,{onExpand:()=>ce(true),locale:n==="en"?"en":"es"})]}),jsxRuntime.jsx(mf,{projects:rt,locale:n==="en"?"en":"es"})]})}function Hf({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let i=[];for(let c=t;c<=a;c++)i.push(c);return jsxRuntime.jsx("div",{className:"cal-week-bg",children:i.map(c=>{let l=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return wi(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxRuntime.jsxs("div",{className:d,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:l.getDate()}),p?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function t2({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,showFestivos:c,holidaySerials:l,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v,due:b=false,slots:h=2,showValues:y=true}){let x=react.useMemo(()=>b?cf(r,n,t,a,h):ql(r,n,t,a),[r,n,t,a,b,h]),w=react.useMemo(()=>new Set(n.filter(M=>M.type==="deadline").map(M=>M.serial)),[n]),C=b?0:Math.max($f,x.laneCount*ac+36),P=react.useRef(null),[$,T]=react.useState(null),S=(M,N)=>{if(!m||!f){p?.(N);return}M.preventDefault();let U=P.current;if(!U)return;let O=U.getBoundingClientRect().width/7,X=M.clientX,A=0,Se=ve=>{let R=Math.round((ve.clientX-X)/O);A=R,T({id:N,days:R});},G=ve=>{if(window.removeEventListener("pointermove",Se),window.removeEventListener("pointerup",G),T(null),A===0){p?.(N);return}let R=new DOMRect(ve.clientX,ve.clientY,0,0);f(N,A,R);};window.addEventListener("pointermove",Se),window.addEventListener("pointerup",G);};return jsxRuntime.jsxs("div",{ref:P,className:"cal-week",style:{minHeight:`${C}px`},children:[jsxRuntime.jsx(Hf,{grid:e,ws:t,we:a,todaySerial:i,showFestivos:c,holidaySerials:l,locale:u,deadlineDays:w}),jsxRuntime.jsxs("div",{className:"cal-items",children:[x.bars.map((M,N)=>{let U=$?.id===M.t.uid?$.days:null,O=v?.uid===M.t.uid?v.days:null,X=U??O??0,A=U==null&&O!=null,Se=X!==0?{...M,s:M.s+X,e:M.e+X}:M;return jsxRuntime.jsx("div",{onPointerDown:G=>S(G,M.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:A?.6:1},children:jsxRuntime.jsx(Jl,{bar:Se,ws:t,money:s,projColor:o,slotH:b?wu:ac,due:b,showValues:y})},`b${N}`)}),x.chips.map((M,N)=>jsxRuntime.jsx(Ql,{chip:M,ws:t,slotH:ac},`c${N}`)),x.more.map((M,N)=>jsxRuntime.jsx(Zl,{more:M,ws:t,slotH:b?wu:ac,enCabecera:b,locale:u,onClick:()=>d(M.day,M.items,b?r.filter(U=>!U.container&&U.endSerial===M.day):r.filter(U=>U.startSerial<=M.day&&U.endSerial>=M.day))},`m${N}`))]})]})}function r2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:i}){let[c,l]=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(h=>h.assignedUserIds||[])).size,v=u.map(h=>h.priority).filter(Boolean),b=new Set(u.flatMap(h=>h.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:b}},[u]),d=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(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:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(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 Wf={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 Ti(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 zf(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 Gf({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:i}){let c=react.useMemo(()=>({...Wf,...o}),[o]),[l,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],C=y.get(w);C?C.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((C,P)=>P.timestamp.getTime()-C.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});},b=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),$=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:$<7?`${$}d ago`:y.toLocaleDateString()},h=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",i),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",i),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;a({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[Ti(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;a({...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=>a({...t,searchTerm:y.target.value})})]}),h>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref: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 C=l.has(x.id),P=s===x.id,$=zf(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:$},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ti(x.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:$}})]}),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?b(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),v(x.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([T,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},T)),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(([T,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},T))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function jf({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:i,onSpeedChange:c,className:l}){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",l),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",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:p&&Ti(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=>i(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:()=>i(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:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children: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",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ku(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 Cu(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 _f(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 Kf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function c2(e,t,a,r,n,s=100){let o=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;o.forEach(u=>{let p=a/2,d=r/2;u.vx+=(p-u.x)*n.centerForce*l,u.vy+=(d-u.y)*n.centerForce*l,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,b=Math.sqrt(f*f+v*v)||1,h=n.chargeStrength*l/(b*b);u.vx+=f/b*h,u.vy+=v/b*h;});}),t.forEach(u=>{let p=i.get(typeof u.source=="string"?u.source:u.source.id),d=i.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,b=(v-n.linkDistance)/v*n.forceStrength*l;p.vx+=m*b,p.vy+=f*b,d.vx-=m*b,d.vy-=f*b;}),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(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function qf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:i,className:c}){let l=react.useRef(null),[u,p]=react.useState([]),[d,m]=react.useState(null),[f,v]=react.useState(null),[b,h]=react.useState(null),[y,x]=react.useState(1),[w,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=c2(e,t,a.width,a.height,a,150);p(O);},[e,t,a]);let P=react.useCallback((O,X)=>{a.enableDragging&&(X.stopPropagation(),m(O));},[a.enableDragging]),$=react.useCallback(O=>{if(!d||!l.current)return;let A=l.current.getBoundingClientRect(),Se=(O.clientX-A.left-w.x)/y,G=(O.clientY-A.top-w.y)/y;p(ve=>ve.map(R=>R.id===d?{...R,x:Se,y:G,fx:Se,fy:G}:R));},[d,y,w]),T=react.useCallback(()=>{m(null);},[]),S=react.useCallback((O,X)=>{X.stopPropagation(),i?.({type:"node-click",node:O,position:{x:X.clientX,y:X.clientY}});},[i]),M=react.useCallback((O,X)=>{X.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:X.clientX,y:X.clientY}});},[i]),N=react.useCallback(O=>{let X=u.find(A=>A.id===O);return X?{x:X.x,y:X.y}:{x:0,y:0}},[u]),U=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.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"}},[a.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"})]})]}),a.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),C({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:ku(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[_f(O)," ",Cu(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:$,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let X=N(typeof O.source=="string"?O.source:O.source.id),A=N(typeof O.target=="string"?O.target:O.target.id),Se=Kf(O.type),G=b===O.id,ve=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",G&&"hovered",ve&&"critical"),onMouseEnter:()=>h(O.id),onMouseLeave:()=>h(null),onClick:R=>M(O,R),children:[jsxRuntime.jsx("line",{x1:X.x,y1:X.y,x2:A.x,y2:A.y,stroke:ku(O.type),strokeWidth:ve?a.edgeWidth*2:a.edgeWidth,strokeOpacity:G?1:.6,markerEnd:Se?"url(#arrowhead)":void 0}),a.showEdgeLabels&&G&&jsxRuntime.jsx("text",{x:(X.x+A.x)/2,y:(X.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Cu(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let X=f===O.id,A=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",X&&"hovered",A&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Se=>P(O.id,Se),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Se=>S(O,Se),children:[jsxRuntime.jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:U(O),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:X?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.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 Jf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=react.useState(""),[i,c]=react.useState(false),[l,u]=react.useState(null),[p,d]=react.useState(null),m=react.useRef(null),f=i||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());},b=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{p&&(a(p),v());};return e?jsxRuntime.jsxs(ma,{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."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),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:h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:b,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 Tu={"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 u2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},p2={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 m2(e,t,a){let r=Tu[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function Ni(e){return `$${e.toFixed(4)}`}var Nu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=m2(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let r=a.length,n=a.reduce((p,d)=>p+d.cost,0),s=a.reduce((p,d)=>p+d.inputTokens,0),o=a.reduce((p,d)=>p+d.outputTokens,0),i=a.filter(p=>p.success),c=a.reduce((p,d)=>p+d.duration,0),l={},u={};return a.forEach(p=>{l[p.feature]=(l[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:l,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let i=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,n-i),l=i/n*100;return {used:i,limit:n,remaining:c,percentUsed:l,isExceeded:i>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},qo=new Nu;function eb({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=react.useState(qo.getStats()),[s,o]=react.useState(qo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(qo.getStats()),o(qo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=qo.getRecentOperations(5);return jsxRuntime.jsxs(ma,{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 (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ni(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let u=r.costsByFeature[c]||0,p=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(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"}),i.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:i.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:Ni(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 rb({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,i]=react.useState(""),[c,l]=react.useState(""),[u,p]=react.useState(""),[d,m]=react.useState(false),[f,v]=react.useState(null),[b,h]=react.useState(null),[y,x]=react.useState(null),w=react.useRef(null),C=d||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let M=N=>{N.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,C]);let P=()=>{C||(i(""),l(""),p(""),v(null),h(null),x(null),t());},$=async()=>{if(!(!o.trim()||C)){m(true),v(null),h(null),x(null);try{let M=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});h(M.tasks.tasks),x({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){v(M instanceof Error?M.message:"Failed to generate tasks");}finally{m(false);}}},T=()=>{b&&(a(b),P());};if(!e)return null;let S=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ma,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:P}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:P,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:b?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 (",S,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[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:[b.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((M,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:M.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"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:M.priority})]})},M.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:M=>i(M.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:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:M=>l(M.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:C})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:M=>p(M.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:C})]})]}),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((M,N)=>jsxRuntime.jsx("button",{onClick:()=>i(M),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#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:P,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),b?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:$,disabled:!o.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function oc({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),n=react.useCallback(b=>{t&&Hi(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),s=react.useCallback(async(b,h,y)=>{r(x=>{let w=x.cards.find(M=>M.id===b);if(!w)return x;let C=w.columnId,P={...w,columnId:h,position:y},$=x.cards.map(M=>M.id===b?P:M),T=x.columns.map(M=>{if(M.id===C)return {...M,cardIds:M.cardIds.filter(N=>N!==b)};if(M.id===h){let N=$.filter(U=>U.columnId===h).sort((U,O)=>U.position-O.position);return {...M,cardIds:N.map(U=>U.id)}}return M}),S={...x,cards:$,columns:T};return n(S),S});},[n]),o=react.useCallback(async(b,h)=>{r(y=>{let x=y.cards.map(C=>C.id===b?{...C,...h}:C),w={...y,cards:x};return n(w),w});},[n]),i=react.useCallback(async b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h},w=y.columns.map(P=>P.id===b.columnId?{...P,cardIds:[...P.cardIds,h]}:P),C={...y,cards:[...y.cards,x],columns:w};return n(C),C});},[n]),c=react.useCallback(async b=>{r(h=>{let y=h.cards.find(P=>P.id===b);if(!y)return h;let x=h.cards.filter(P=>P.id!==b),w=h.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter($=>$!==b)}:P),C={...h,cards:x,columns:w};return n(C),C});},[n]),l=react.useCallback(async b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=react.useCallback(async(b,h)=>{r(y=>{let x=y.columns.map(C=>C.id===b?{...C,...h}:C),w={...y,columns:x};return n(w),w});},[n]),p=react.useCallback(async b=>{r(h=>{let y=h.cards.filter(C=>C.columnId!==b),x=h.columns.filter(C=>C.id!==b),w={...h,cards:y,columns:x};return n(w),w});},[n]),d=react.useCallback(b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(b),h},[i]),m=react.useCallback(b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),h},[l]),f=react.useCallback(()=>{r(b=>{let h={...b,cards:[],columns:[]};return n(h),h});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function ob({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=oc({initialBoard:e,onPersist:a}),o=react.useMemo(()=>({addCard:(c,l,u={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,l)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:c,position:l??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var Di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ib={by:"none",order:"asc"};function lb({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=react.useState({...Di,...e}),[s,o]=react.useState({...ib,...t}),i=react.useCallback(v=>{n(b=>({...b,...v}));},[]),c=react.useCallback(v=>{o(b=>({...b,...v}));},[]),l=react.useCallback(()=>{n(Di),o(ib);},[]),u=react.useCallback(()=>{a&&n({...Di,assignees:[a]});},[a]),p=react.useCallback(()=>{n({...Di,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{n({...Di,priorities:["HIGH","URGENT"]});},[]),m=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),f=react.useCallback(v=>{let b=[...v];if(r.search){let h=r.search.toLowerCase();b=b.filter(y=>y.title.toLowerCase().includes(h)||y.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,y=h.getFullYear(),x=String(h.getMonth()+1).padStart(2,"0"),w=String(h.getDate()).padStart(2,"0"),C=`${y}-${x}-${w}`;b=b.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let $=P.endDate||P.dueDate;if(!$)return false;let T;if(typeof $=="string")T=$.split("T")[0]||$;else {let S=$.getUTCFullYear(),M=String($.getUTCMonth()+1).padStart(2,"0"),N=String($.getUTCDate()).padStart(2,"0");T=`${S}-${M}-${N}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let S=new Date(C+"T00:00:00"),M=new Date(T+"T00:00:00"),N=new Date(S);return N.setDate(N.getDate()+7),M>=S&&M<=N;case "custom":if(r.dateRange){let U=typeof $=="string"?new Date($):$;return U>=r.dateRange.start&&U<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(b=b.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(b=b.filter(h=>h.labels&&h.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(b=b.filter(h=>r.columns.includes(h.columnId))),s.by!=="none"&&b.sort((h,y)=>{let x=0;switch(s.by){case "created":let w=h.createdAt?new Date(h.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;x=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},$=P[h.priority||"LOW"],T=P[y.priority||"LOW"];x=$-T;break;case "dueDate":let S=h.endDate||h.dueDate,M=y.endDate||y.dueDate;if(!S)return 1;if(!M)return -1;let N=typeof S=="string"?new Date(S).getTime():S.getTime(),U=typeof M=="string"?new Date(M).getTime():M.getTime();x=N-U;break;case "title":x=h.title.localeCompare(y.title);break;case "estimate":let O=h.estimatedTime||0,X=y.estimatedTime||0;x=O-X;break;default:x=0;}return s.order==="asc"?x:-x}),b},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var db,ub;if(typeof window<"u")try{let e=Bi("ai");db=e.generateObject,ub=e.generateText;}catch{}function pb(e={}){let[t,a]=react.useState(false),[r,n]=react.useState(null),s=!!(db&&ub&&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');a(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{a(false);}},[s]),i=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");a(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{a(false);}},[s]),c=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");a(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{a(false);}},[s]),l=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");a(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{a(false);}},[s]),u=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");a(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{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Su(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function mb(e){let{cards:t}=e,[a,r]=Su(),n=react.useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=react.useCallback((p,d)=>{if(!d){r({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(p)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let v=t.find(h=>h.id===p),b=t.find(h=>h.id===a.lastSelectedCardId);if(v&&b&&v.columnId===b.columnId){let h=t.filter(T=>T.columnId===v.columnId).sort((T,S)=>T.position-S.position),y=h.findIndex(T=>T.id===a.lastSelectedCardId),x=h.findIndex(T=>T.id===p),[w,C]=y<x?[y,x]:[x,y],P=h.slice(w,C+1).map(T=>T.id),$=Array.from(new Set([...a.selectedCardIds,...P]));r({selectedCardIds:$,lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,r]),o=react.useCallback(p=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(p=>{a.selectedCardIds.includes(p)?o(p):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,o,r]),u=react.useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:u}}var gb={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function fb(e){let{cards:t,config:a,aiService:r}=e,n=react.useMemo(()=>({...gb,...a}),[a]),[s,o]=react.useState([]),i=react.useCallback((v,b,h,y,x)=>{if(b.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:b,columnId:h,strategy:y,color:x,isExpanded:true,position:s.filter(C=>C.columnId===h).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),c=react.useCallback(v=>{o(b=>b.filter(h=>h.id!==v));},[]),l=react.useCallback(v=>{o(b=>b.map(h=>h.id===v?{...h,isExpanded:!h.isExpanded}:h));},[]),u=react.useCallback((v,b)=>{o(h=>h.map(y=>y.id===v&&!y.cardIds.includes(b)?{...y,cardIds:[...y.cardIds,b]}:y));},[]),p=react.useCallback((v,b)=>{o(h=>h.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==b);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=react.useCallback(v=>s.filter(b=>b.columnId===v).sort((b,h)=>b.position-h.position),[s]),m=react.useCallback(async v=>{let b=t.filter(C=>C.columnId===v);if(b.length<n.minCardsPerStack*2)return [];let h=[],y=new Map;b.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(P=>{y.has(P)||y.set(P,[]),y.get(P).push(C);});}),y.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map($=>$.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let x=new Map;b.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{x.has(P)||x.set(P,[]),x.get(P).push(C);});}),x.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map($=>$.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(b.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,P)=>{if(C.length>=n.minCardsPerStack){let $={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";h.push({stack:{title:`${$} ${P} Priority`,cardIds:C.map(T=>T.id),columnId:v,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let C of b){let $=(await r.findSimilar(C,b)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if($.length>=n.minCardsPerStack-1){let T=[C.id,...$.map(M=>M.card.id)],S=$.reduce((M,N)=>M+N.similarity,0)/$.length;h.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${$.length+1} similar tasks`,confidence:S});}}return h.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,r]),f=react.useCallback(v=>{i(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[i]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let h=await m(b),y=h[0];h.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var bb=react.createContext(null);function hb({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:l}=Bi("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Bi("@libxai/core");o.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Bi("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:o});}let n=r.current;return react.useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsxRuntime.jsx(bb.Provider,{value:{store:n},children:e})}function sc(){let e=react.useContext(bb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ei(){let e=sc(),[t,a]=react.useState(e.getBoard()),[r,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let i=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),l=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]),b=react.useCallback(y=>e.getCard(y),[e]),h=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:b,getCardsByColumn:h}}function xb(e){let{cards:t}=Ei();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function vb(e="position",t="asc"){let{cards:a}=Ei();return react.useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?i[n.priority]:0,l=s.priority?i[s.priority]:0;o=c-l;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}),[a,e,t])}var ic=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=np.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let i=await Promise.resolve(o.apply(s,a));i!==void 0&&(n=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},P2=new ic;function kb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:i}),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:l,style:d,className:n,children:jsxRuntime.jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let b=c?c(v,f.index):f.index,h={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:h,"data-index":f.index,children:r(v,f.index)},b)})})})}function Cb(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 Nb({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:i=16,getItemKey:c,horizontal:l=true}){let u=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,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 b=e[v.index];if(!b)return null;let h=c?c(b,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(b,v.index)},h)})})})}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 Sb(e,t=10){return e>t}var Fu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Au={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Iu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ru={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Bu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$u={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ou={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)"},Hu={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)"},Uu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wu={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}},zu={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}},lc={spacing:Fu,borderRadius:Lu,fontSize:Au,fontWeight:Iu,lineHeight:Ru,zIndex:Bu,duration:$u,easing:Ou,shadows:Hu,opacity:Uu,kanban:Wu,gantt:zu};function Eb(e,t,a){return e[t]??a}function Gu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Gu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function A2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vu(e="asakaa"){let t=Gu(lc),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=A2(n);a.push(` ${s}: ${o};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Fg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function jn(e,t){let a=Fg(e),r=t.toLowerCase().trim(),n=a.find(i=>i.name.toLowerCase()===r);if(n)return n;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return o.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.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(r),v=f.getDay(),b=m-v;return b<=0&&(b+=7),f.setDate(f.getDate()+b),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);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(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let d=parseInt(i[1],10),m=parseInt(i[2],10)-1,f=parseInt(i[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},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),m=c[l[2].toLowerCase()],f=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,d)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},u=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(u&&u[1]&&u[2]){let d=p[u[1].toLowerCase()],m=parseInt(u[2],10),f=u[3]?parseInt(u[3],10):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function $d(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Lg(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 Ag(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),p=r[2].trim(),u=jn(t,l),d=Bd(p);if(!u)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:u.id,taskName:u.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=u.startDate&&u.endDate?Math.round((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:u.id,taskName:u.name,updates:{startDate:d,endDate:f},message:`Moved "${u.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),p=n[2].trim(),u=jn(t,l),d=$d(p);if(!u)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!u.endDate)return {type:"resize_task",taskId:u.id,taskName:u.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let m=new Date(u.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:u.id,taskName:u.name,updates:{endDate:m},message:`Extended "${u.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),u=jn(t,l),d=Od(p);return u?d===null?{type:"set_progress",taskId:u.id,taskName:u.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:u.id,taskName:u.name,updates:{progress:d},message:`Set "${u.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),u=jn(t,l);return u?{type:"rename_task",taskId:u.id,taskName:u.name,updates:{name:p},message:`Renamed "${u.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),u=jn(t,l),d=jn(t,p);return u?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:u.id,dependencyTo:d.id,message:`Linked "${u.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=jn(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Ig(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 sk(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 ik(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Pl(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let u=a.find(d=>d.id===p);return u?{name:u.name,initials:u.initials,color:u.color}:null}).filter(p=>p!==null),n=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Pl(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let o=p=>{if(p)return typeof p=="string"?new Date(p):p},i=o(e.startDate),c=o(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:sk(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Rg(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:ik(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Bg(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Pl(r,e,t))}var Hd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ud={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:Hd,es:Ud};function Wd(e){return Fl[e]||Fl.en}function Ll(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var zd=[{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 $g(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 Og({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=react.useState(false),i=react.useRef(null);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]);let c=$g(e),l=zd[0],p=zd.find(m=>m.value===c)??l,u=p.icon,d=m=>{switch($g(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(u,{className:g("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxRuntime.jsxs("div",{ref:i,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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(u,{className:g("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",a?"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]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:zd.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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function xo(e,t,a=320){let[r,n]=react.useState(false);return react.useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,i=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!i&&c);},[t,a,e]),r}var Gd=[{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 Ug({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=react.useState(false),i=react.useRef(null),c=xo(i,s,180);react.useEffect(()=>{let u=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let l=Gd.find(u=>u.value===e)??Gd[4],p=r==="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",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[p]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[p]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",a?"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]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gd.map(u=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(u.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[p]})]},u.value))})]})}function bi(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Vd(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]"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-[#00E5CC]"}function Rl({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,i]=react.useState(false),[c,l]=react.useState(""),p=react.useRef(null),u=react.useRef(null),d=xo(p,o);react.useEffect(()=>{let b=h=>{p.current&&!p.current.contains(h.target)&&(i(false),l(""));};return o&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{o&&u.current&&u.current.focus();},[o]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),f=b=>e.some(h=>h.name===b),v=b=>{if(a){if(f(b.name))a(e.filter(h=>h.name!==b.name));else {let h={name:b.name,initials:bi(b.name),color:b.color||Vd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,h)=>jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),i(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"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",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,h)=>jsxRuntime.jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",r?"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:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"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 ${r?"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:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:u,type:"text",value:c,onChange:b=>l(b.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"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 ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)}),b.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==b.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}})})]},`${b.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let h=f(b.name);return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{h||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{h||(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:b.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):bi(b.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function jg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:i=false,placeholder:c}){let[l,p]=react.useState(false),[u,d]=react.useState(n),[m,f]=react.useState(()=>{let T=n==="start"?e:t;if(T){let z=T instanceof Date?T:new Date(T);return new Date(z.getFullYear(),z.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=react.useRef(null),b=react.useRef(null),h=react.useRef(null),[y,x]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let T=z=>{let $=z.target;v.current&&v.current.contains($)||h.current&&h.current.contains($)||p(false);};return l&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useLayoutEffect(()=>{if(!l){x(null);return}let T=()=>{let z=b.current?.getBoundingClientRect();if(!z)return;let $=520,J=360,L=window.innerHeight-z.bottom,Ae=L<J&&z.top>L,U=Ae?z.top-4:z.bottom+4,we=Math.min(Math.max(z.left,8),window.innerWidth-$-8);x({top:U,left:we,flipUp:Ae});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[l]),react.useEffect(()=>{l&&d(r?n:"start");},[l,r,n]);let P=T=>T?T.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",O=react.useCallback(()=>{let T=m.getFullYear(),z=m.getMonth(),$=new Date(T,z,1),L=new Date(T,z+1,0).getDate(),Ae=$.getDay(),U=[],R=new Date(T,z,0).getDate();for(let G=Ae-1;G>=0;G--)U.push({date:new Date(T,z-1,R-G),isCurrentMonth:false});for(let G=1;G<=L;G++)U.push({date:new Date(T,z,G),isCurrentMonth:true});let xe=42-U.length;for(let G=1;G<=xe;G++)U.push({date:new Date(T,z+1,G),isCurrentMonth:false});return U},[m]),N=T=>{if(r)n==="start"?a(T,C||void 0):a(w||void 0,T),p(false);else if(u==="start"){let z=C&&T>C?T:C;a(T,z||void 0),d("end");}else {let z=w&&T<w?T:w;a(z||void 0,T),p(false);}},S=()=>{let T=new Date,z=new Date(T);z.setDate(T.getDate()+1);let $=new Date(T);$.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let J=new Date(T);J.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 Ae=new Date(T);Ae.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:z,display:z.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:J,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Ae,display:Ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:U,display:U.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let T=r&&n==="start"?w:C;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:P(T)})]})}let M=r&&n==="start"?w:C;return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,onClick:T=>{T.stopPropagation(),p(!l);let z=n==="start"?w:C;z&&f(new Date(z.getFullYear(),z.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:P(M)})]}),l&&y&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:h,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:[S().map((T,z)=>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:()=>N(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})]},z)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,C||void 0):a(w||void 0,void 0):a(void 0,void 0),p(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:[!r&&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:u==="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:O().map((T,z)=>{let $=T.date.toDateString()===new Date().toDateString(),J=w?.toDateString()===T.date.toDateString(),L=C?.toDateString()===T.date.toDateString(),Ae=J||L,U=!r&&w&&C&&T.date>=w&&T.date<=C;return jsxRuntime.jsx("button",{onClick:()=>N(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"),$&&"ring-2 ring-[#00E5CC]",J&&"bg-[#00E5CC] text-white",L&&!J&&"bg-[#7C3AED] text-white",U&&!Ae&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ae&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:T.date.getDate()},z)})})]})]}),document.body)]})}function $l({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(jg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:i||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function Ss(e=600){let[t,a]=react.useState(false),r=react.useRef(null),n=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:n}}function Ol(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){o(e),l.current=e;return}let u=l.current??0,d=e,m=d-u,f=r/n;c(true);for(let v=1;v<=n;v++){let b=setTimeout(()=>{let h=v/n,y=1-Math.pow(1-h,3),x=Math.round(u+m*y);o(x),v===n&&(c(false),o(d));},f*v);p.current.push(b);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:i}}function Kg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=react.useState(null),[o,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),p=react.useCallback(m=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(m),i(0);let f=Date.now();l.current=setInterval(()=>{let v=Date.now()-f,b=Math.min(v/a*100,100);i(b);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(m),s(null),i(0);},a);},[a,e]),u=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:p,cancelChange:u}}function Yg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,i]=react.useState(false),[c,l]=react.useState(""),p=react.useRef(null),{isFlashing:u,triggerFlash:d}=Ss(),{displayValue:m,isAnimating:f}=Ol(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),P=w.clientX-C.left,O=Math.round(P/C.width*100),N=Math.max(0,Math.min(100,O));N!==e&&(t(N),s&&d());},b=react.useCallback(w=>{r||!t||(w.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{o&&p.current&&(p.current.focus(),p.current.select());},[o]);let h=react.useCallback(()=>{i(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&d());}},[c,t,e,s,d]),y=react.useCallback(w=>{w.key==="Enter"&&h(),w.key==="Escape"&&i(false);},[h]),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",u&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsxRuntime.jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&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:p,value:c,onChange:w=>l(w.target.value.replace(/[^0-9]/g,"")),onBlur:h,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"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",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:b,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Qg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),o(false);},u=d=>{d.key==="Enter"?p():d.key==="Escape"&&(c(e),o(false));};return n||!t?jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:d=>c(d.target.value),onBlur:p,onKeyDown:u,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"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",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function t0({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=react.useState(false),[u,d]=react.useState(e?.toString()||""),m=react.useRef(null),{isFlashing:f,triggerFlash:v}=Ss(),{displayValue:b,isAnimating:h}=Ol(e,{enabled:i&&!l});react.useEffect(()=>{l&&m.current&&(m.current.focus(),m.current.select());},[l]),react.useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(u);if(!isNaN(w)){let C=w;n!==void 0&&(C=Math.max(n,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&v());}p(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),p(false));};return o||!t?jsxRuntime.jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",h&&"font-medium"),children:b!==void 0?b:r}):l?jsxRuntime.jsx("input",{ref:m,type:"number",value:u,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",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),p(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",b===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),h&&"font-medium scale-105"),children:b!==void 0?b:r})}function a0({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,i]=react.useState(false),c=react.useRef(null),l=xo(c,o,220);return react.useEffect(()=>{let p=u=>{c.current&&!c.current.contains(u.target)&&i(false);};return o&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),s||!a?jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),i(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 left-0 "+(l?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(p=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(p),i(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:p}),e===p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},p))})]})}function n0({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:i,progress:c,startChange:l,cancelChange:p}=Kg(t,{delay:s}),u=m=>{m.stopPropagation(),!r&&t&&(n?i?p():l(!e):t(!e));},d=i?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:u,disabled:r||!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]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&d&&"ring-green-500/50",i&&!d&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&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"})}),i?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]}),i&&jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),p();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"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 o0({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:i=2}){let[c,l]=react.useState(false),p=react.useRef(null),u=xo(p,c,220);react.useEffect(()=>{let h=y=>{p.current&&!p.current.contains(y.target)&&l(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let d=e.slice(0,i),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=h=>{let y=e.includes(h),x=y?e.filter(w=>w!==h):[...e,h];!y&&o!=null&&e.length>=o||a(x);},b=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),l(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),c&&jsxRuntime.jsx("div",{className:g("absolute z-50 left-0 "+(u?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let y=e.includes(h),x=!y&&b;return jsxRuntime.jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(h);},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":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:h}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Xk(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 l0({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Xk(e);if(n.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,i=o>0?`${s.name} +${o}`:s.name;return r?jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),r(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:i})]}):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"}),i]})}function u0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.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 a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function e1(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*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 zr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0,financialOverride:p}){let[u,d]=react.useState(false),[m,f]=react.useState(""),v=react.useRef(null),{isFlashing:b,triggerFlash:h}=Ss(),y=c==="financial"&&(l>0||p!=null),x=p??(e?e/60*l:0),w=y&&(p!=null?p>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Zk(e,r);react.useEffect(()=>{u&&v.current&&(v.current.focus(),v.current.select());},[u]),react.useEffect(()=>{if(e){let N=Math.floor(e/60),S=e%60;N>0&&S>0?f(`${N}h ${S}m`):N>0?f(`${N}h`):f(`${S}m`);}else f("");},[e,u]);let C=()=>{let N=e1(m);N!==e&&(t?.(N),o&&h()),d(false);},P=N=>{N.key==="Enter"?C():N.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="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",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let O=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(O,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):u?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,onChange:N=>f(N.target.value),onBlur:C,onKeyDown:P,onClick:N=>N.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"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:N=>{N.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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(O,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function f0({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=n==="es";return a===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:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"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",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),i()]})}function h0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,u=U=>p?`$${Math.round(U*c).toLocaleString("en-US")}`:`${U}h`,[d,m]=react.useState(false),[f,v]=react.useState(false),[b,h]=react.useState(null),y=react.useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(x/60*10)/10,O=Math.round(w/60*10)/10,N=w>0?x/w*100:0,S=N>100?Math.round((x-w)/60*10)/10:0,M=N>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!b)return;let U=we=>{y.current&&!y.current.contains(we.target)&&(v(false),h(null));};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[f,b]);let T=U=>{if(U.stopPropagation(),r&&!n&&!s){h("log");return}if(r||n||s){v(we=>!we),h(null);return}o&&o(e);},z=U=>{v(false),h(U);},$=async(U,we)=>{b==="log"&&r&&U?r(e,U,we):b==="estimate"&&n?n(e,U):b==="quoted"&&s&&s(e,U),h(null);},J=r||n||s||o,L=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(U=>U.show),Ae=b==="estimate"?w:b==="quoted"?C:void 0;return w===0&&x===0&&C===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&&J&&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:l?"+ 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:we=>{we.stopPropagation(),z(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:we=>{we.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:we=>{we.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:b&&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(En,{mode:b,locale:a,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>h(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,R=(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:u(P)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",u(O)]}),S>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:R?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:R?"rgba(239,68,68,0.15)":"transparent"},children:["+",u(S)," ",l?"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(N,100)}%`,backgroundColor:M,borderRadius:2,transition:"width 0.3s"}})})]}),J&&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:l?"+ 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:we=>{we.stopPropagation(),z(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:we=>{we.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:we=>{we.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:b&&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(En,{mode:b,locale:a,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>h(null)})})})})]})}function i1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function l1(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 y0({assignee:e,size:t=28,isDark:a}){let r=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(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function x0({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let p=i1(e);if(p.length===0)return null;let u=p.slice(0,3),d=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:u.map((m,f)=>jsxRuntime.jsx(y0,{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:p.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:r?"Sin asignar":"Unassigned"})]});let i=o?.percentage??0,c=!!o&&i>0,l=c?l1(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(y0,{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&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var c1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function w0({blockers:e,isDark:t,locale:a="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:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",c1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function T1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function N1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function E0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:u,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:b}){let h=react.useRef(null),y=r==="es"?T0.es:T0.en,[x,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let S=h.current;if(!S)return;let M=S.getBoundingClientRect(),T=8,z=e.x,$=e.y;e.y+M.height>window.innerHeight-T&&($=Math.max(T,e.y-M.height)),e.x+M.width>window.innerWidth-T&&(z=Math.max(T,window.innerWidth-M.width-T)),(z!==e.x||$!==e.y)&&w({left:z,top:$});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let S=T=>{h.current&&!h.current.contains(T.target)&&t();},M=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",S),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",M);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let S=[];return n&&S.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),S.push({id:"sep1",label:"",icon:null,separator:true}),i&&(S.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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),S.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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&S.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(M=>({id:`assign-${M.id}`,label:M.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:M.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],$=T.some(J=>J.name===M.name)?T.filter(J=>J.name!==M.name):[...T,{name:M.name,initials:T1(M.name),color:M.color||N1(M.name),avatar:M.avatarUrl}];i({...e.task,assignees:$}),t();}}))})),u&&S.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),d&&S.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&S.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),S.push({id:"sep2",label:"",icon:null,separator:true}),s&&S.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||b)&&(S.push({id:"sep3",label:"",icon:null,separator:true}),f&&(S.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),S.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&&S.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),b&&S.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{b(e.task.id),t();}})),o&&S.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),S},P=()=>{if(!e.columnId)return [];let S=[];return l&&(S.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),S.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(S.push({id:"sep-hide",label:"",icon:null,separator:true}),S.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),S},O=e.type==="task"?C():P(),N={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:h,style:N,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:O.map(S=>S.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},S.id):S.submenu?jsxRuntime.jsx(D1,{item:S,isDark:a},S.id):jsxRuntime.jsxs("button",{onClick:S.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",S.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(S.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:S.icon}),S.label]},S.id))})}function D1({item:e,isDark:t}){let[a,r]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(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")})]}),a&&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(i=>jsxRuntime.jsxs("button",{onClick:i.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:i.icon}),i.label]},i.id))})]})}var T0={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 B0={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"})},G1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function O0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:i,locale:c}){let[l,p]=react.useState(""),[u,d]=react.useState(null),[m,f]=react.useState(null),v=react.useRef(null),b=c==="es"?$0.es:$0.en;react.useLayoutEffect(()=>{if(!e||!v.current)return;let S=()=>{if(!v.current)return;let M=v.current.parentElement;if(M){let J=M.getBoundingClientRect();f({top:J.bottom+4,right:window.innerWidth-J.right});}let T=v.current.getBoundingClientRect(),$=window.innerHeight-T.top-20;d(Math.max(300,$));};return requestAnimationFrame(S),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[e]),react.useEffect(()=>{if(!e)return;let S=setTimeout(()=>{let M=z=>{v.current&&!v.current.contains(z.target)&&t();},T=z=>{z.key==="Escape"&&t();};document.addEventListener("mousedown",M),document.addEventListener("keydown",T),v._cleanup=()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(S),v._cleanup&&v._cleanup();}},[e,t]);let h=react.useMemo(()=>{let S=new Set([...G1]);return a.forEach(M=>{M.type&&M.type!=="assignees"&&S.add(M.type);}),Array.from(S)},[a]);if(!e)return null;let y=S=>{let M=b.columns[S];if(M)return M;let T=a.find(z=>z.type===S);return T?.label?T.label:S},x=S=>{if(S==="name")return;let M=a.map(T=>T.id===S?{...T,visible:!T.visible}:T);n(M);},w=(S,M)=>{let T=a.find($=>$.type===S&&(!M||$.customFieldId===M));if(T){x(T.id);return}let z={id:M||S,type:S,label:M?r.find($=>$.id===M)?.name||S:y(S),width:120,visible:true,sortable:true,resizable:true,customFieldId:M};n([...a,z]);},C=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],P=h.filter(S=>S!=="assignees"&&(o||!C.includes(S))&&y(S).toLowerCase().includes(l.toLowerCase())),O=r.filter(S=>S.name.toLowerCase().includes(l.toLowerCase())),N=i?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:v,style:{...u?{maxHeight:`${u}px`}:{},...m?{top:m.top,right:m.right}:{},background:i?"#111114":"#FFFFFF",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:i?"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 ${i?"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:i?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:b.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",S.currentTarget.style.color=i?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=i?"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:i?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:l,onChange:S=>p(S.target.value),placeholder:b.searchPlaceholder,style:{fontSize:12,background:i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:i?"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:S=>{S&&S.style.setProperty("--focus-border",N);},onFocus:S=>{S.currentTarget.style.borderColor=N,S.currentTarget.style.background=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:S=>{S.currentTarget.style.borderColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",S.currentTarget.style.background=i?"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:S=>S.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:b.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:P.map(S=>{let M=a.find($=>$.type===S&&!$.customFieldId),T=M?.visible??false,z=S==="name";return jsxRuntime.jsxs("button",{onClick:()=>{z||(M?x(M.id):w(S));},disabled:z,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:z?.4:1,cursor:z?"not-allowed":"pointer"},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?N:"transparent",border:T?`1.5px solid ${N}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${N}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?N:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:B0[S]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:T?500:400,color:T?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(S),children:y(S)})]},S)})})]}),O.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:b.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:O.map(S=>{let T=a.find(z=>z.customFieldId===S.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(S.type,S.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:z=>{z.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:z=>{z.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?N:"transparent",border:T?`1.5px solid ${N}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${N}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?N:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:B0[S.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:S.name})]},S.id)})})]})]})]})}var $0={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 Q1=[{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 W0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=react.useState(""),[i,c]=react.useState("text"),[l,p]=react.useState([""]),u=n==="es"?U0.es:U0.en;react.useEffect(()=>{e&&(o(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&t();};return e&&document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);let d=()=>{if(!s.trim())return;let b={name:s.trim(),type:i};i==="dropdown"&&(b.options=l.filter(h=>h.trim())),a(b),t();},m=()=>{p([...l,""]);},f=(b,h)=>{let y=[...l];y[b]=h,p(y);},v=b=>{l.length>1&&p(l.filter((h,y)=>y!==b));};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",r?"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",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:u.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",r?"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",r?"text-white":"text-gray-900"),children:u.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),placeholder:u.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"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",r?"text-white":"text-gray-900"),children:u.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Q1.map(b=>jsxRuntime.jsxs("button",{onClick:()=>c(b.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===b.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:b.icon}),jsxRuntime.jsx("span",{className:g("text-xs",i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:u.types[b.type]})]},b.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((b,h)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:b,onChange:y=>f(h,y.target.value),placeholder:`${u.option} ${h+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"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")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>v(h),className:g("p-2 rounded-lg transition-colors",r?"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"})})]},h)),jsxRuntime.jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),u.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"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",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:u.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:u.create})]})]})]}):null}var U0={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 V0={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 _0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),p=s==="es"?V0.es:V0.en;react.useEffect(()=>{if(!o)return;let m=v=>{Date.now()-l.current<100||c.current&&!c.current.contains(v.target)&&i(false);},f=v=>{v.key==="Escape"&&i(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let u=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:p.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||(l.current=Date.now()),i(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"}),p.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:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:u.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:()=>{a(m.value),r(false),i(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;r(m),m&&a("all"),i(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:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function j0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Co(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function K0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",i=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:i?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,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"})})})]}),i&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,l=e.totalEstimated??0,p=e.totalExecuted??0,u=c-p,d=c>0?Math.round(u/c*100):0,m=c-l,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(p/c*100),120):0,b=p>c&&c>0,h=b?"#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:Co(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=x>0||w>0,P=(O,N)=>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:O}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(N)})]});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:Co(l)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),p>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=x>0||w>0,P=(O,N)=>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:O}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(N)})]});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",b?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Co(p)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(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:h}})}),l>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?"+":"",Co(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:[u>=0?`+${Co(u)} ${o?"disponible (caja)":"available (cash)"}`:`${Co(Math.abs(u))} ${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,l=e.totalHoursAllocatedMinutes??0,p=l>0?Math.min(Math.round(c/l*100),100):0,m=(l>0?c/l:0)>1.1?"#F87171":p>=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:j0(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:j0(l)})]}),l>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:`${p}%`,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,l=c>0,p=c<0,u=e.scheduleVarianceLabel||(l?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${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",l&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!l&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),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,l)=>{let p=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:p}})})]},`${c.name}-${l}`)})})]})]})}var gC=[{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 Z0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...Z0(n.subtasks,t+1,s));}return r}function fC(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=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 p=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(p<=0)continue;let u=(s.progress||0)/p;r+=u,n++;}return n>0?r/n:null}function Ls(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Ls(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Fs(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function bC({value:e,onChange:t,isDark:a}){let[r,n]=react.useState(false),[s,o]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>o(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),n(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.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",a?"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:i=>{i.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Q0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let i of e){let c=i.weight||0;c>0&&(t+=(i.progress||0)*c,a+=c,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((i,c)=>i+(c.effort_minutes||0),0)>0){let i=0,c=0;for(let l of e){let p=l.effort_minutes||60;i+=(l.progress||0)*p,c+=p;}return Math.round(i/c*10)/10}let o=e.reduce((i,c)=>i+(c.progress||0),0);return Math.round(o/e.length*10)/10}function uu(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uu(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function ef({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:i=[],customFields:c=[],toolbarRightContent:l,onColumnHeaderClick:p,columnsWithFilter:u,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:b=true,showHierarchy:h=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:C=true,allowColumnResize:P=true,enableContextMenu:O=true,showCreateTaskButton:N=false,onCreateTask:S,persistFilter:M=false,financialBlur:T,healthSidebar:z,lens:$="hours",hourlyRate:J=0,rateMap:L,aggregateParentHours:Ae=false,showProjectTotals:U=false,totalsDollarOverride:we}=t,R=t.rowDensity==="compact",xe=Ll(f,v),G=m==="dark",Ve=k=>{if(!L||!k.assignees||k.assignees.length===0)return J;let Y=0,Q=0;for(let ue of k.assignees){let He=ue.id?L[ue.id]:void 0;if(He==null||He<=0)continue;let ee=typeof ue.estimatedMinutes=="number"?ue.estimatedMinutes:0;ee>0&&(Y+=He*ee,Q+=ee);}if(Q>0)return Y/Q;let oe=k.assignees.map(ue=>ue.id?L[ue.id]:void 0).filter(ue=>ue!=null&&ue>0);return oe.length===0?J:oe.reduce((ue,He)=>ue+He,0)/oe.length},ne=k=>{let Y=0,Q=0,oe=0,ue=He=>{for(let ee of He)if(ee.subtasks&&ee.subtasks.length>0){let Ne={s:Y,a:Q,q:oe};if(ue(ee.subtasks),Y-Ne.s+(Q-Ne.a)+(oe-Ne.q)===0){let je=Ve(ee);Y+=(ee.timeLoggedMinutes??0)/60*je,Q+=(ee.effortMinutes??0)/60*je,oe+=(ee.soldEffortMinutes??0)/60*je;}}else {let Ne=Ve(ee);Y+=(ee.timeLoggedMinutes??0)/60*Ne,Q+=(ee.effortMinutes??0)/60*Ne,oe+=(ee.soldEffortMinutes??0)/60*Ne;}};return k.subtasks&&ue(k.subtasks),{dollarSpent:Y,dollarAllocated:Q,dollarQuoted:oe}},Re=react.useCallback(()=>{if(!M||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let k=localStorage.getItem(M);if(k){let Y=JSON.parse(k);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(k){console.error("Error loading persisted filter:",k);}return {statusFilter:"all",hideCompleted:false}},[M]),ce=react.useMemo(()=>{function k(Y){let Q=0,oe=0,ue=0,He=0,ee=0,Ne=0;for(let Fe of Y)if(Fe.subtasks&&Fe.subtasks.length>0){let je=k(Fe.subtasks);if(je.spent+je.allocated+je.quoted>0)Q+=je.spent,oe+=je.allocated,ue+=je.quoted,He+=je.dollarSpent,ee+=je.dollarAllocated,Ne+=je.dollarQuoted;else {let it=Fe.timeLoggedMinutes??0,ot=Fe.effortMinutes??0,ea=Fe.soldEffortMinutes??0;Q+=it,oe+=ot,ue+=ea;let nt=Ve(Fe);He+=it/60*nt,ee+=ot/60*nt,Ne+=ea/60*nt;}}else {let je=Fe.timeLoggedMinutes??0,Ht=Fe.effortMinutes??0,it=Fe.soldEffortMinutes??0;Q+=je,oe+=Ht,ue+=it;let ot=Ve(Fe);He+=je/60*ot,ee+=Ht/60*ot,Ne+=it/60*ot;}return {spent:Q,allocated:oe,quoted:ue,dollarSpent:He,dollarAllocated:ee,dollarQuoted:Ne}}return k(e)},[e]),Be=react.useMemo(()=>{let k=new Map;function Y(Q){let oe=0;for(let ue of Q)if(ue.subtasks&&ue.subtasks.length>0){let He=Y(ue.subtasks);k.set(ue.id,He),oe+=He;}else oe+=ue.weight||0;return oe}return Y(e),k},[e]),Le=react.useMemo(()=>!z?.enabled||!z.data?z:{...z,data:{...z.data,totalHoursSpentMinutes:ce.spent,totalHoursAllocatedMinutes:ce.allocated}},[z,ce]),[Pe,Oe]=react.useState(true),[dt,Z]=react.useState(null),[ze,Xe]=react.useState("position"),[$e,St]=react.useState("asc"),[mt,gt]=react.useState(""),[De,ft]=react.useState(()=>Re().statusFilter),[Ct,_e]=react.useState(()=>Re().hideCompleted),[ut,A]=react.useState(y||gC),[q,Ce]=react.useState(false),[I,K]=react.useState(false),[ve,Ue]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[pe,tt]=react.useState(null),[ht,qe]=react.useState(false),[wt,qt]=react.useState(null),[Tt,Pt]=react.useState(null),[_t,be]=react.useState(null),Ee=react.useRef(0),Qe=react.useRef(false),at=!!(a.onTaskMove||a.onTaskReparent),[Nt,Ft]=react.useState(null),[kt,Ia]=react.useState(null),ra=k=>{let Y=k.type;return k.customFieldId?Y==="file"?null:{kind:"customField",fieldId:k.customFieldId}:Y==="assignees"||Y==="teamLoad"?"assignees":Y==="startDate"?"startDate":Y==="endDate"?"endDate":null},ir=(k,Y)=>typeof k=="string"||typeof Y=="string"?k===Y:k.fieldId===Y.fieldId,Ye=react.useRef([]),et=react.useCallback((k,Y)=>{at&&(Y.preventDefault(),Ee.current=Y.clientY,tt(k),Qe.current=false,qe(false),be({x:Y.clientX,y:Y.clientY}));},[at]),Ra=react.useCallback(k=>{if(!pe||(Math.abs(k.clientY-Ee.current)>5&&!Qe.current&&(Qe.current=true,qe(true)),be({x:k.clientX,y:k.clientY}),!Qe.current))return;let Q=document.querySelectorAll("[data-listview-row]"),oe=null,ue=null;Q.forEach(He=>{let ee=He.getBoundingClientRect(),Ne=He.getAttribute("data-listview-row");if(Ne&&Ne!==pe&&k.clientY>=ee.top&&k.clientY<=ee.bottom){oe=Ne;let Fe=k.clientY-ee.top,je=ee.height;ue=Fe<je*.25?"above":Fe>je*.75?"below":"child";}}),qt(oe),Pt(ue);},[pe]),Ba=react.useCallback(()=>{if(Qe.current&&pe&&wt&&Tt){if(Tt==="child"&&a.onTaskReparent)a.onTaskReparent(pe,wt);else if(Tt==="above"||Tt==="below"){let k=(oe,ue,He=null)=>{for(let ee of oe){if(ee.id===ue)return He;if(ee.subtasks){let Ne=k(ee.subtasks,ue,ee.id);if(Ne!==void 0)return Ne}}},Y=k(e,pe,null),Q=k(e,wt,null);if(a.onTaskReparent){let oe=(je,Ht)=>{if(Ht===null)return je;for(let it of je){if(it.id===Ht)return it.subtasks||[];if(it.subtasks){let ot=oe(it.subtasks,Ht);if(ot.length>0||it.subtasks.some(ea=>ea.id===Ht))return ot}}return []},ue=oe(e,Q??null),He=ue.findIndex(je=>je.id===wt),ee=Y===Q,Ne=ee?ue.findIndex(je=>je.id===pe):-1,Fe=Tt==="below"?He+1:He;ee&&Ne!==-1&&Ne<He&&(Fe-=1),a.onTaskReparent(pe,Q??null,Math.max(0,Fe));}}}tt(null),qt(null),Pt(null),be(null),Qe.current=false,qe(false);},[pe,wt,Tt,e,a]),lr=(k,Y)=>typeof Y!="string"?k.customFields?.find(oe=>oe.fieldId===Y.fieldId)?.value:Y==="assignees"?k.assignees:Y==="startDate"?k.startDate:k.endDate,Na=(k,Y,Q,oe)=>{k.preventDefault(),k.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ue=Array.from(document.querySelectorAll("[data-listview-row]")),He=ue.map(lt=>lt.getAttribute("data-listview-row")||""),ee=Math.max(0,He.indexOf(Y)),Ne=lt=>He.slice(ee,lt+1);Ia({sourceTaskId:Y,column:Q,sourceIndex:oe,targetIndex:oe,rangeIds:new Set([Y])});let je=(lt=>{let Rt=lt?.parentElement??null;for(;Rt;){let Er=window.getComputedStyle(Rt).overflowY;if((Er==="auto"||Er==="scroll")&&Rt.scrollHeight>Rt.clientHeight)return Rt;Rt=Rt.parentElement;}let $a=document.scrollingElement;return $a&&$a.scrollHeight>$a.clientHeight?$a:null})(k.currentTarget),Ht=lt=>{let Rt=ee,$a=false;ue.forEach((Er,dr)=>{let ja=Er.getBoundingClientRect();lt>=ja.top&&lt<=ja.bottom&&(Rt=dr,$a=true);});let wr=ue[ue.length-1];if(!$a&&wr){let Er=wr.getBoundingClientRect();lt>Er.bottom&&(Rt=ue.length-1);}return Rt<ee&&(Rt=ee),Rt},it=k.clientY,ot=null,ea=()=>{ot!==null&&(cancelAnimationFrame(ot),ot=null);},nt=()=>{let lt=Ht(it),Rt=new Set(Ne(lt));Ia($a=>$a&&{...$a,targetIndex:lt,rangeIds:Rt});},ta=()=>{if(ea(),!je)return;let lt=je,$a=lt===document.scrollingElement?{top:0,bottom:window.innerHeight}:lt.getBoundingClientRect(),wr=60,Er=12,dr=it-$a.top,ja=$a.bottom-it,to=lt.scrollHeight-lt.clientHeight;if(ja<wr&&lt.scrollTop<to){let as=Math.max(1,Math.round(Er*(1-Math.max(0,ja)/wr))),kr=()=>{lt.scrollTop+=as,nt(),lt.scrollTop<lt.scrollHeight-lt.clientHeight&&(ot=requestAnimationFrame(kr));};ot=requestAnimationFrame(kr);}else if(dr<wr&&lt.scrollTop>0){let as=Math.max(1,Math.round(Er*(1-Math.max(0,dr)/wr))),kr=()=>{lt.scrollTop-=as,nt(),lt.scrollTop>0&&(ot=requestAnimationFrame(kr));};ot=requestAnimationFrame(kr);}},vt=lt=>{it=lt.clientY,nt(),ta();},It=lt=>{window.removeEventListener("mousemove",vt),window.removeEventListener("mouseup",It),ea(),document.body.style.cursor="",document.body.style.userSelect="",Ia(null);let Rt=Ht(lt.clientY),$a=new Map(Ye.current.map(ja=>[ja.id,ja])),wr=$a.get(Y);if(!wr)return;let Er=lr(wr,Q),dr=[];for(let ja of Ne(Rt)){if(ja===Y)continue;let to=$a.get(ja);to&&(to.subtasks&&to.subtasks.length>0||dr.push(ja));}dr.length>0&&a.onBulkFill?.(dr,Q,Er);};window.addEventListener("mousemove",vt),window.addEventListener("mouseup",It);},Rr=k=>kt?kt.rangeIds.has(k):false;react.useEffect(()=>{if(pe)return document.addEventListener("mousemove",Ra),document.addEventListener("mouseup",Ba),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ra),document.removeEventListener("mouseup",Ba),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,Ra,Ba]);let[ie,ge]=react.useState("all"),[bt,_]=react.useState(false),he=react.useRef(null),se=react.useRef(null),B=react.useMemo(()=>{let k=0;function Y(Q,oe){for(let ue of Q)oe>k&&(k=oe),ue.subtasks?.length&&Y(ue.subtasks,oe+1);}return Y(e,1),k},[e]);react.useEffect(()=>{if(!bt)return;let k=Y=>{he.current?.contains(Y.target)||se.current?.contains(Y.target)||_(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[bt]),react.useEffect(()=>{if(ie==="all"){let Q=function(oe){for(let ue of oe)ue.subtasks?.length&&(ue.isExpanded===false&&a.onTaskToggleExpand?.(ue.id),Q(ue.subtasks));};Q(e);}else {let Q=function(oe,ue){for(let He of oe)if(He.subtasks?.length){let ee=ue<ie,Ne=He.isExpanded!==false;ee!==Ne&&a.onTaskToggleExpand?.(He.id),Q(He.subtasks,ue+1);}};Q(e,1);}},[ie]);let[te,Te]=react.useState(null),[D,W]=react.useState(0),[de,ke]=react.useState(0),st=react.useRef(null),[fe,j]=react.useState(null),[yt,xt]=react.useState(null);react.useEffect(()=>{y&&A(k=>{if(k.length===y.length){let Y=true;for(let Q=0;Q<k.length;Q++){let oe=k[Q],ue=y[Q];if(!oe||!ue||oe.id!==ue.id||oe.visible!==ue.visible||oe.width!==ue.width||oe.label!==ue.label){Y=false;break}}if(Y)return k}return y});},[y]),react.useEffect(()=>{if(!(!M||typeof window>"u"))try{localStorage.setItem(M,JSON.stringify({statusFilter:De,hideCompleted:Ct}));}catch(k){console.error("Error persisting filter state:",k);}},[M,De,Ct]);let Xt=react.useMemo(()=>{let k=new Set;function Y(Q){for(let oe of Q)oe.subtasks?.length&&(oe.isExpanded!==false&&k.add(oe.id),Y(oe.subtasks));}return Y(e),k},[e]),Qt=react.useMemo(()=>ut.filter(k=>k.visible),[ut]),cr=react.useCallback(k=>{a.onTaskToggleExpand?.(k);},[a]),yr=react.useCallback(k=>{ze===k?St(Y=>Y==="asc"?"desc":"asc"):(Xe(k),St("asc")),a.onSortChange?.({column:k,direction:$e==="asc"?"desc":"asc"});},[ze,$e,a]),Sr=react.useCallback(k=>{A(k),a.onColumnsChange?.(k);},[a]),ua=react.useCallback(k=>{let Y=ut.map(Q=>Q.id===k?{...Q,visible:false}:Q);Sr(Y);},[ut,Sr]),Qo=react.useCallback((k,Y)=>{Xe(k),St(Y);},[]),Bn=react.useCallback((k,Y,Q)=>{O&&(k.preventDefault(),Ue({isOpen:true,x:k.clientX,y:k.clientY,type:Y?"task":"header",task:Y,columnId:Q}));},[O]),qr=react.useCallback(()=>{Ue(k=>({...k,isOpen:false}));},[]),Qn=react.useCallback((k,Y)=>{if(!P)return;k.preventDefault(),k.stopPropagation();let Q=ut.find(oe=>oe.id===Y);Q&&(Te(Y),W(k.clientX),ke(Q.width));},[ut,P]);react.useEffect(()=>{if(!te)return;let k=ut,Y=oe=>{let ue=oe.clientX-D,He=Math.max(50,de+ue);k=k.map(ee=>ee.id===te?{...ee,width:He}:ee),A(k);},Q=()=>{a.onColumnsChange?.(k),Te(null);};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",Q);}},[te,D,de,a]);let Zn=react.useCallback((k,Y)=>{if(Y==="name"){k.preventDefault();return}j(Y),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("text/plain",Y),k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="0.5");},[]),Pi=react.useCallback(k=>{k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="1"),j(null),xt(null);},[]),Zo=react.useCallback((k,Y)=>{k.preventDefault(),Y!=="name"&&(k.dataTransfer.dropEffect="move",xt(Y));},[]),Fi=react.useCallback(()=>{xt(null);},[]),Xa=react.useCallback((k,Y)=>{if(k.preventDefault(),!fe||fe===Y||Y==="name")return;let Q=[...ut],oe=Q.findIndex(ee=>ee.id===fe),ue=Q.findIndex(ee=>ee.id===Y);if(oe===-1||ue===-1)return;let He=Q.splice(oe,1);He[0]&&(Q.splice(ue,0,He[0]),Sr(Q),j(null),xt(null));},[fe,ut,Sr]),Bs=react.useCallback(async k=>{if(a.onCreateCustomField){let Y={...k,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}K(false);},[a]),eo=react.useCallback(k=>k.progress===100||k.status==="completed"?"completed":k.progress&&k.progress>0||k.status==="in-progress"?"in-progress":"todo",[]),$s=t.groupBy==="status",xr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[Yr,$n]=react.useState(()=>{let k=new Set(t.defaultCollapsedGroups??["completed"]);if(!xr)return k;try{let Y=localStorage.getItem(xr);return Y?new Set(JSON.parse(Y)):k}catch{return k}}),Os=react.useCallback(k=>{$n(Y=>{let Q=new Set(Y);if(Q.has(k)?Q.delete(k):Q.add(k),xr)try{localStorage.setItem(xr,JSON.stringify([...Q]));}catch{}return Q});},[xr]),sn=!!t.selectable,[Hs,Li]=react.useState(new Set),On=react.useMemo(()=>t.selectedIds?new Set(t.selectedIds):Hs,[t.selectedIds,Hs]),Ai=react.useRef(null),{lista:Br,cabeceras:es,todas:vr}=react.useMemo(()=>{let k=Z0(e);if(mt.trim()){let Q=mt.toLowerCase();k=k.filter(oe=>oe.name.toLowerCase().includes(Q));}let Y=t.showStatusFilter!==false;if(Y&&De!=="all"){let Q=new Set(k.filter(oe=>eo(oe)===De).flatMap(oe=>oe.parentPath));k=k.filter(oe=>Q.has(oe.id));}if(Y&&Ct){let Q=new Set(k.filter(oe=>eo(oe)!=="completed").flatMap(oe=>oe.parentPath));k=k.filter(oe=>Q.has(oe.id));}if(t.groupBy==="assignee"||t.groupBy==="due"){let Q=t.groupBy==="assignee",oe=[],ue=(nt,ta,vt,It)=>{for(let lt of nt){let Rt=[...vt,lt.id];oe.push({...lt,level:ta,hasChildren:(lt.subtasks?.length||0)>0,parentPath:Rt,...It?{__padre:It}:{}}),lt.subtasks?.length&&ue(lt.subtasks,ta+1,Rt,lt.name);}};ue(e,0,[]);let He=mt.trim().toLowerCase(),ee=He?oe.filter(nt=>nt.name.toLowerCase().includes(He)):oe,Ne=f==="es",Fe=[["overdue","Vencidas","Overdue"],["today","Hoy","Today"],["week","Esta semana","This week"],["later","M\xE1s adelante","Later"],["past","Anteriores","Earlier"],["none","Sin fecha","No date"]],je=new Map;for(let nt of ee){let ta=Q?(()=>{let vt=(nt.assignees??[]).map(It=>It.name).filter(Boolean);return vt.length?vt:["__sin"]})():[t.dueBucket?.(nt)??"none"];for(let vt of ta){let It=Q?`user:${vt}`:`due:${vt}`,lt=Q?vt==="__sin"?Ne?"Sin responsable":"Unassigned":vt:Fe.find(Rt=>Rt[0]===vt)?.[Ne?1:2]??vt;je.has(It)||je.set(It,{titulo:lt,filas:[]}),je.get(It).filas.push({...nt,level:0,hasChildren:false,__claveFila:`${It}|${nt.id}`});}}let Ht=Q?[...je.keys()].sort((nt,ta)=>nt==="user:__sin"?1:ta==="user:__sin"?-1:je.get(nt).titulo.localeCompare(je.get(ta).titulo)):Fe.map(nt=>`due:${nt[0]}`).filter(nt=>je.has(nt)),it=nt=>nt.endDate?new Date(nt.endDate).getTime():1/0,ot=[],ea=new Map;for(let nt of Ht){let ta=je.get(nt),vt=Yr.has(nt);ea.set(ot.length,[...ea.get(ot.length)??[],{clave:nt,cuenta:ta.filas.length,plegado:vt,titulo:ta.titulo}]),vt||ot.push(...ta.filas.sort((It,lt)=>it(It)-it(lt)));}return {lista:ot,cabeceras:ea,todas:ee}}if($s){let Q=["todo","in-progress","completed"],oe=new Map,ue=[];for(let Fe of k){let je=Fe.parentPath[0]??Fe.id;Fe.level===0&&ue.push(Fe),oe.has(je)||oe.set(je,[]),oe.get(je).push(Fe);}let He=Fe=>Fe.endDate?new Date(Fe.endDate).getTime():1/0,ee=[],Ne=new Map;for(let Fe of Q){let je=ue.filter(nt=>eo(nt)===Fe).sort((nt,ta)=>He(nt)-He(ta)),Ht=je.flatMap(nt=>oe.get(nt.id)??[nt]),it=Ht.filter(nt=>!nt.hasChildren).length;if(it===0&&je.length===0)continue;let ot=Yr.has(Fe),ea=ee.length;Ne.set(ea,[...Ne.get(ea)??[],{clave:Fe,cuenta:it,plegado:ot}]),ot||ee.push(...Ht);}return {lista:ee,cabeceras:Ne,todas:k}}return k.sort((Q,oe)=>{let ue,He;switch(ze){case "name":ue=Q.name.toLowerCase(),He=oe.name.toLowerCase();break;case "startDate":ue=Q.startDate?.getTime()||0,He=oe.startDate?.getTime()||0;break;case "endDate":ue=Q.endDate?.getTime()||0,He=oe.endDate?.getTime()||0;break;case "progress":ue=Q.progress||0,He=oe.progress||0;break;case "status":ue=Q.status||"todo",He=oe.status||"todo";break;case "priority":let ee={urgent:0,high:1,medium:2,low:3,none:4};ue=ee[Q.priority]??4,He=ee[oe.priority]??4;break;case "position":return 0;default:return 0}return ue<He?$e==="asc"?-1:1:ue>He?$e==="asc"?1:-1:0}),{lista:k,cabeceras:new Map,todas:k}},[e,mt,De,Ct,ze,$e,eo,t.showStatusFilter,$s,Yr,t.groupBy,t.dueBucket,f]);Ye.current=Br;let No=(k,Y)=>{let Q=new Set(On),oe=Ai.current,ue=Ye.current.map(He=>He.id);if(Y&&oe&&oe!==k&&ue.includes(oe)&&ue.includes(k)){let He=ue.indexOf(oe),ee=ue.indexOf(k),Ne=Math.min(He,ee),Fe=Math.max(He,ee),je=!On.has(k);for(let Ht of ue.slice(Ne,Fe+1))je?Q.add(Ht):Q.delete(Ht);}else Q.has(k)?Q.delete(k):Q.add(k);Ai.current=k,t.selectedIds||Li(Q),a.onSelectionChange?.([...Q]);},Do=On.size>0,sa=k=>jsxRuntime.jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:Y=>Y.stopPropagation(),children:jsxRuntime.jsx("input",{type:"checkbox","data-casilla-fila":k,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:On.has(k),onChange:()=>{},onClick:Y=>{Y.stopPropagation(),No(k,Y.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",Do?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),dc={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En curso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Us=(k,Y)=>{let Q=es.get(k);if(!Q?.length)return Y;let oe=Q.map(ue=>jsxRuntime.jsx("div",{"data-grupo-de-estado":ue.clave,"data-plegado":ue.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",G?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>Os(ue.clave),"aria-expanded":!ue.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",G?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[ue.plegado?jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3.5 h-3.5"}),ue.titulo??dc[ue.clave]?.[f==="es"?"es":"en"]??ue.clave,jsxRuntime.jsx("span",{className:g("font-normal tabular-nums",G?"text-white/40":"text-gray-400"),children:ue.cuenta})]})},`grupo-${ue.clave}`));return Y?[...oe,Y]:oe},ts=react.useCallback((k,Y)=>{let Q=He=>{a.onTaskUpdate?.({...k,...He});},oe=He=>He?k.customFields?.find(Ne=>Ne.fieldId===He)?.value:void 0,ue=(He,ee)=>{if(!He)return;let Fe=[...k.customFields||[]],je=Fe.findIndex(Ht=>Ht.fieldId===He);je>=0?Fe[je]={fieldId:He,value:ee}:Fe.push({fieldId:He,value:ee}),Q({customFields:Fe});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(Og,{value:k.status||(k.progress===100?"completed":k.progress&&k.progress>0?"in-progress":"todo"),onChange:ee=>{Q({status:ee,progress:ee==="completed"?100:ee==="in-progress"?50:0});},isDark:G,locale:f,translations:xe.status});case "priority":return jsxRuntime.jsx(Ug,{value:k.priority,onChange:ee=>Q({priority:ee}),isDark:G,locale:f});case "assignees":{let ee=k.hasChildren,Ne=k.assignees||[];if(ee&&k.subtasks?.length){let Fe=new Map,je=Ht=>{(Ht||[]).forEach(it=>{(it.assignees||[]).forEach(ot=>{Fe.has(ot.name)||Fe.set(ot.name,ot);}),it.subtasks?.length&&je(it.subtasks);});};je(k.subtasks),Ne=Array.from(Fe.values());}else ee&&(Ne=[]);return jsxRuntime.jsx(Rl,{value:Ne,availableUsers:i,onChange:Fe=>Q({assignees:Fe}),isDark:G,locale:f,disabled:ee})}case "startDate":return jsxRuntime.jsx($l,{value:k.startDate,onChange:ee=>Q({startDate:ee}),isDark:G,locale:f,dateField:"start",startDate:k.startDate,endDate:k.endDate});case "endDate":{let ee=jsxRuntime.jsx($l,{value:k.endDate,onChange:Ne=>Q({endDate:Ne}),isDark:G,locale:f,dateField:"end",startDate:k.startDate,endDate:k.endDate});return t.isTaskOverdue?.(k)?jsxRuntime.jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:G?"#FF7A7F":"#C22F35"},children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),ee]}):ee}case "progress":{let ee=!!(k.subtasks&&k.subtasks.length>0),Ne=ee?Q0(uu(k.subtasks||[])):k.progress||0;return jsxRuntime.jsx(Yg,{value:Ne,onChange:ee?void 0:Fe=>{let je=Fe===100?"completed":Fe>0?"in-progress":"todo";Q({progress:Fe,status:je});},isDark:G,disabled:ee})}case "tags":return jsxRuntime.jsx(u0,{value:k.tags||[],isDark:G});case "text":return jsxRuntime.jsx(Qg,{value:oe(Y.customFieldId)||"",onChange:ee=>ue(Y.customFieldId,ee),isDark:G});case "number":return jsxRuntime.jsx(t0,{value:oe(Y.customFieldId)||0,onChange:ee=>ue(Y.customFieldId,ee),isDark:G});case "date":let He=oe(Y.customFieldId);return jsxRuntime.jsx($l,{value:He?new Date(He):void 0,onChange:ee=>ue(Y.customFieldId,ee),isDark:G,locale:f});case "dropdown":return jsxRuntime.jsx(a0,{value:oe(Y.customFieldId)||"",options:Y.options||[],onChange:ee=>ue(Y.customFieldId,ee),isDark:G});case "checkbox":return jsxRuntime.jsx(n0,{value:oe(Y.customFieldId)||false,onChange:ee=>ue(Y.customFieldId,ee),isDark:G});case "multiselect":return jsxRuntime.jsx(o0,{value:oe(Y.customFieldId)||[],options:Y.options||[],onChange:ee=>ue(Y.customFieldId,ee),isDark:G,maxSelectable:Y.maxSelectable});case "person":{let ee=oe(Y.customFieldId)||[];return jsxRuntime.jsx(Rl,{value:ee.map(Ne=>({name:Ne.name,avatar:Ne.avatar,initials:Ne.initials||(Ne.name||"?").slice(0,2).toUpperCase(),color:Ne.color||"#00E5CC"})),availableUsers:i,onChange:Ne=>ue(Y.customFieldId,Ne),isDark:G,locale:f})}case "file":return jsxRuntime.jsx(l0,{value:oe(Y.customFieldId),isDark:G,onOpen:ee=>{ee.url&&window.open(ee.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let ee=k.status==="completed"||k.progress===100;return jsxRuntime.jsx(zr,{value:k.estimatedTime,onChange:Ne=>Q({estimatedTime:Ne}),isDark:G,locale:f,disabled:ee,lens:$,hourlyRate:Ve(k)})}case "quotedTime":{let ee=k.status==="completed"||k.progress===100,Ne=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(zr,{value:k.quotedTime,onChange:Fe=>Q({quotedTime:Fe}),isDark:G,locale:f,disabled:ee,isBlurred:Ne,lens:$,hourlyRate:Ve(k)})}case "elapsedTime":{let ee=k.status==="completed"||k.progress===100,Ne=k.executedDollarsCanonical;return jsxRuntime.jsx(zr,{value:k.elapsedTime,onChange:Fe=>Q({elapsedTime:Fe}),isDark:G,locale:f,disabled:ee,lens:$,hourlyRate:Ve(k),financialOverride:Ne})}case "effortMinutes":{if(Ae&&k.subtasks&&k.subtasks.length>0){let{allocated:Ht}=Ls(k);if($==="financial"){let it=ne(k),ot=Math.round(it.dollarAllocated),ea=Math.round(it.dollarQuoted),nt=ea-ot;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[ot>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",ot.toLocaleString("es-CO")]}):null,nt!==0&&ot>0&&ea>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",nt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[nt>0?"+":"",Math.abs(nt)>=1e3?`$${(nt/1e3).toFixed(1)}K`:`$${nt}`]})]})}return jsxRuntime.jsx(zr,{value:Ht>0?Ht:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:J})}let ee=k.status==="completed"||k.progress===100,Ne=k.effortMinutes||0,Fe=k.soldEffortMinutes||0,je=Ve(k);if($==="financial"&&je&&Ne>0&&Fe>0){let Ht=Math.round(Ne/60*je),ot=Math.round(Fe/60*je)-Ht;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(zr,{value:Ne,onChange:ea=>Q({effortMinutes:ea}),isDark:G,locale:f,disabled:ee,lens:$,hourlyRate:Ve(k)}),ot!==0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ot>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ot>0?"+":"",Math.abs(ot)>=1e3?`$${(ot/1e3).toFixed(1)}K`:`$${ot}`]})]})}return jsxRuntime.jsx(zr,{value:Ne,onChange:Ht=>Q({effortMinutes:Ht}),isDark:G,locale:f,disabled:ee,lens:$,hourlyRate:Ve(k)})}case "timeLoggedMinutes":{let ee=k.executedDollarsCanonical;if(Ae&&k.subtasks&&k.subtasks.length>0){let{spent:Fe}=Ls(k);return jsxRuntime.jsx(zr,{value:Fe>0?Fe:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k),financialOverride:ee})}let Ne=k.status==="completed"||k.progress===100;return jsxRuntime.jsx(zr,{value:k.timeLoggedMinutes,onChange:a.onLogTime?Fe=>{a.onLogTime?.(k,Fe);}:void 0,isDark:G,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Ne,lens:$,hourlyRate:Ve(k),financialOverride:ee})}case "soldEffortMinutes":{if(Ae&&k.subtasks&&k.subtasks.length>0){let{quoted:Fe}=Ls(k),je=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(zr,{value:Fe>0?Fe:void 0,isDark:G,locale:f,disabled:true,isBlurred:je,lens:$,hourlyRate:Ve(k)})}let ee=k.status==="completed"||k.progress===100,Ne=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(zr,{value:k.soldEffortMinutes,onChange:Fe=>Q({soldEffortMinutes:Fe}),isDark:G,locale:f,disabled:ee,isBlurred:Ne,lens:$,hourlyRate:Ve(k)})}case "scheduleVariance":{let ee=k.effortMinutes||0,Ne=k.soldEffortMinutes||0,Fe=k.timeLoggedMinutes||0,je=ee>0||Ne>0||Fe>0;return jsxRuntime.jsx(f0,{startDate:k.startDate,endDate:k.endDate,scheduleVariance:k.scheduleVariance,isDark:G,locale:f,hasTimeAllocated:je})}case "hoursBar":{if(Ae&&k.hasChildren){let{spent:ee,allocated:Ne,quoted:Fe}=Ls(k),je=ee>Ne&&Ne>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",G?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",je?"text-[#FF453A]":G?"text-white/80":"text-gray-800"),children:Fs(ee)}),Ne>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:G?"text-white/60":"text-gray-600",children:Fs(Ne)})]}),Fe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:G?"text-amber-400/70":"text-amber-600",children:Fs(Fe)})]})]})}return jsxRuntime.jsx(h0,{task:k,isDark:G,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:$,hourlyRate:Ve(k)})}case "teamLoad":return k.hasChildren||k.subtasks&&k.subtasks.length>0?jsxRuntime.jsx(x0,{task:k,isDark:G,locale:f}):jsxRuntime.jsx(Rl,{value:k.assignees||[],availableUsers:i,onChange:Ne=>{a.onTaskUpdate?.({...k,assignees:Ne});},isDark:G,locale:f});case "blockers":return jsxRuntime.jsx(w0,{blockers:k.blockers,isDark:G,locale:f});case "weight":{let ee=Be.get(k.id);if(ee!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",ee>0?G?"text-white/50":"text-gray-400":G?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ee>0?`${Number(ee.toFixed(2))}%`:"\u2014"});let Ne=k.weight||0;return jsxRuntime.jsx(bC,{value:Ne,onChange:Fe=>Q({weight:Fe}),isDark:G})}default:return jsxRuntime.jsx("span",{className:g("text-sm",G?"text-white/60":"text-gray-500"),children:"-"})}},[a,G,f,i,xe,Ae,Be]),Ws=react.useCallback(k=>{let Q={name:xe.columns.name,status:xe.columns.status,priority:xe.columns.priority,assignees:xe.columns.assignees,startDate:xe.columns.startDate,endDate:xe.columns.endDate,progress:xe.columns.progress,tags:xe.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:xe.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:xe.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:xe.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:xe.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:xe.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:xe.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:xe.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:xe.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:xe.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:xe.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:xe.columns.weight||(f==="es"?"Peso":"Weight")}[k.type]||k.label;return typeof Q=="string"?Q:String(Q||k.type)},[xe,f]),Hn=react.useMemo(()=>{let Q=Qt.reduce((ue,He)=>ue+He.width,0)+(C?48:0),oe={};for(let ue of Qt)oe[ue.id]=`${ue.width/Q*100}%`;return oe},[Qt,C]);return r?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",G?"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",G?"text-white/60":"text-gray-600"),children:[xe.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",G?"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",G?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",G?"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",G?"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",G?"text-white":"text-gray-900"),children:xe.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",G?"text-white/60":"text-gray-600"),children:xe.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:st,className:g(G?"bg-[#0D0D0D]":"bg-white",te&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let k=!!t.toolbarContainer,Y=jsxRuntime.jsx("div",{className:k?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",G?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:k?"flex items-center gap-2":"flex items-center gap-4",children:[jsxRuntime.jsx("div",{className:g("text-sm whitespace-nowrap",G?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let Q=vr.filter(He=>(He.subtasks?.length??0)>0).length,oe=vr.length-Q,ue=f==="es";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[oe," ",xe.pagination.tasks,Q>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" \xB7 ",Q," ",ue?Q===1?"tarea padre":"tareas padre":Q===1?"parent task":"parent tasks"]})]})})()}),b&&!k&&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",G?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:mt,onChange:Q=>gt(Q.target.value),placeholder:xe.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",G?"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")})]}),!k&&jsxRuntime.jsx("div",{className:"flex-1"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),h&&B>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:he,onClick:()=>_(!bt),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",G?bt?"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]":bt?"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"}),ie==="all"?f==="es"?"Todos":"All":`L${ie}`]}),bt&&jsxRuntime.jsx("div",{ref:se,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",G?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(B,5)},(Q,oe)=>({value:oe+1,label:`L${oe+1}`}))].map(Q=>jsxRuntime.jsxs("button",{onClick:()=>{ge(Q.value),_(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",G?ie===Q.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":ie===Q.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:Q.label}),ie===Q.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(Q.value)))})]}),t.showStatusFilter!==false&&jsxRuntime.jsx(_0,{value:De,hideCompleted:Ct,onChange:ft,onHideCompletedChange:_e,isDark:G,locale:f}),Le?.enabled&&Le.data&&!Pe&&jsxRuntime.jsx("button",{onClick:()=>Oe(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",G?"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,N&&S&&!k&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:S,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:xe.toolbar.newTask})]})]})});return k?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",G?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[sn&&jsxRuntime.jsx("div",{className:"w-6 flex-shrink-0"}),at&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(k=>{let Y=k.id!=="name",Q=yt===k.id&&fe!==k.id;return jsxRuntime.jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",G?"text-white/60":"text-gray-500",Y&&"cursor-grab",k.type!=="name"&&"justify-center",fe===k.id&&"opacity-50",Q&&(G?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Hn[k.id],minWidth:k.minWidth},draggable:Y,onDragStart:Y?oe=>Zn(oe,k.id):void 0,onDragEnd:Y?Pi:void 0,onDragOver:Y?oe=>Zo(oe,k.id):void 0,onDragLeave:Y?Fi:void 0,onDrop:Y?oe=>Xa(oe,k.id):void 0,onContextMenu:oe=>Bn(oe,void 0,k.id),children:[Y&&jsxRuntime.jsx(lucideReact.GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",G?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),p?jsxRuntime.jsxs("button",{draggable:false,onClick:oe=>{let ue=oe.currentTarget.getBoundingClientRect();p(k.id,ue);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ws(k),u?.includes(k.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),ze===k.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):k.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>yr(k.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ws(k),u?.includes(k.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",ze===k.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ws(k),u?.includes(k.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),P&&k.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:oe=>Qn(oe,k.id),children:jsxRuntime.jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",te===k.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},k.id)}),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),Ce(Y=>!Y);},className:g("p-0.5 rounded transition-colors",G?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",q&&(G?"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(O0,{isOpen:q,onClose:()=>Ce(false),columns:ut,customFields:c,mostrarColumnasDensas:w,onColumnsChange:Sr,onCreateCustomField:()=>{Ce(false),K(true);},isDark:G,locale:f})]})]}),jsxRuntime.jsxs(framerMotion.AnimatePresence,{mode:"popLayout",children:[Br.map((k,Y)=>Us(Y,(()=>{let Q=Xt.has(k.id),oe=Math.min(Y*.01,.2),ue=k.hasChildren&&k.level===0,He=k.subtasks?.length||0;if(ue){let{spent:it,allocated:ot,quoted:ea}=Ls(k),nt=fC(k);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:oe},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",G?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",dt===k.id&&(G?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(k),children:[sn&&sa(k.id),at&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(ta=>jsxRuntime.jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",ta.type!=="name"&&"justify-center"),style:{width:Hn[ta.id],minWidth:ta.minWidth},children:ta.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:vt=>{vt.stopPropagation(),cr(k.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",G?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Q?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",G?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",G?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:vt=>{vt.stopPropagation(),cr(k.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Q?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:G?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:G?"#FFD60A":"#B45309"}})}),k.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:G?"#FFD60A":"#B45309"},children:k.wbsCode}),jsxRuntime.jsxs("div",{className:g("flex min-w-0",R?"flex-row items-baseline gap-2":"flex-col"),children:[jsxRuntime.jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",R&&"truncate",G?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:k.name}),jsxRuntime.jsxs("span",{className:g(R?"text-[12px] flex-shrink-0":"text-[10px] font-mono",G?"text-white/30":"text-gray-500"),children:["(",He," ",f==="es"?He===1?"Tarea":"Tareas":He===1?"Item":"Items",")"]}),nt!==null&&x&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",nt>=1?"text-[#32D74B] bg-[#32D74B]/10":nt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",nt.toFixed(2)]})]})]}):ta.type==="timeLoggedMinutes"?$==="financial"?(()=>{let vt=k.executedDollarsCanonical,It=vt!=null?Math.round(vt):Math.round(ne(k).dollarSpent);return It>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",It.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(zr,{value:it>0?it:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ta.type==="soldEffortMinutes"?$==="financial"?(()=>{let vt=ne(k),It=Math.round(vt.dollarQuoted);return It>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",It.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(zr,{value:ea>0?ea:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ta.type==="effortMinutes"?$==="financial"?(()=>{let vt=ne(k),It=Math.round(vt.dollarAllocated),lt=Math.round(vt.dollarQuoted),Rt=lt-It;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[It>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",It.toLocaleString("es-CO")]}):null,Rt!==0&&It>0&&lt>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Rt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`]})]})})():jsxRuntime.jsx(zr,{value:ot>0?ot:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ts(k,ta)},ta.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},k.id)}let ee=pe===k.id,Ne=wt===k.id,Fe=Ne&&Tt==="above",je=Ne&&Tt==="below",Ht=Ne&&Tt==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":k.id,"data-listview-row":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:oe},className:g("flex items-center border-b transition-colors relative group",G?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",dt===k.id&&(G?"!bg-[#FFD60A]/15":"!bg-yellow-100"),sn&&On.has(k.id)&&(G?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":sn&&On.has(k.id)?"true":void 0,style:{opacity:ee?.4:1,backgroundColor:Ht?G?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Ht?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(k),onDoubleClick:()=>a.onTaskDoubleClick?.(k),onContextMenu:it=>Bn(it,k),onMouseEnter:()=>Ft(k.id),onMouseLeave:()=>Ft(it=>it===k.id?null:it),children:[Fe&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),je&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),sn&&sa(k.id),at&&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:it=>et(k.id,it),style:{color:G?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Qt.map(it=>{let ot=!!(k.subtasks&&k.subtasks.length>0),ea=ra(it),ta=!!ea&&!ot&&Nt===k.id&&!kt,vt=!!kt&&!!ea&&ir(kt.column,ea)&&Rr(k.id);return jsxRuntime.jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",it.type!=="name"&&"justify-center"),style:{width:Hn[it.id],minWidth:it.minWidth,position:"relative",backgroundColor:vt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:vt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:it.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&k.level>0&&jsxRuntime.jsx("div",{style:{width:`${k.level*24}px`},className:"flex-shrink-0"}),h&&k.hasChildren&&jsxRuntime.jsx("button",{onClick:It=>{It.stopPropagation(),cr(k.id);},className:g("p-0.5 rounded flex-shrink-0",G?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Q?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",G?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",G?"text-white/60":"text-gray-400")})}),h&&!k.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:g("flex min-w-0 flex-1",R?"flex-row items-center gap-2":"flex-col"),children:[(k.wbsCode||k.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[k.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",G?"text-[#00E5CC]":"text-[#00C4AE]"),children:k.wbsCode}),k.taskCode&&jsxRuntime.jsx("span",{"data-codigo-tarea":true,className:g(R?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",G?"text-white/40":"text-gray-400"),style:R&&!G?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:k.taskCode})]}),jsxRuntime.jsxs("span",{className:g("truncate",k.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",k.progress===100?t.completedStyle==="dim"?G?"text-white/45":"text-gray-400":G?"line-through text-white/50":"line-through text-gray-400":k.hasChildren?G?"text-white":"text-gray-900":G?"text-[#D1D5DB]":"text-gray-600"),children:[k.__padre&&jsxRuntime.jsxs("span",{"data-prefijo-padre":true,className:G?"text-white/35":"text-gray-400",children:[k.__padre," \u203A "]}),k.name]}),k.tags?.[0]&&jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",R&&"flex-shrink-0"),style:{backgroundColor:`${k.tags[0].color}20`,color:k.tags[0].color},children:k.tags[0].name})]})]}):ta&&ea?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[ts(k,it),jsxRuntime.jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:It=>Na(It,k.id,ea,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}})]}):ts(k,it)},it.id)}),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},k.__claveFila??k.id)})())),Us(Br.length,null)]}),U&&Br.length>0&&(()=>{let{spent:k,allocated:Y,quoted:Q}=ce,oe=Y-k,ue=oe<0,He=ue?`+${Fs(Math.abs(oe))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Fs(oe)} ${f==="es"?"AHORRADO":"SAVED"}`,ee=$==="financial"&&J>0,Ne=we?.breakdown,Fe=!!Ne&&((Ne.equipment??0)>0||(Ne.travel??0)>0),je=Ne?.laborSpent!=null?Ne.laborSpent:we?.spent!=null?we.spent:ce.dollarSpent,Ht=Ne?.laborAllocated!=null?Ne.laborAllocated:we?.allocated!=null?we.allocated:ce.dollarAllocated,it=we?.quoted!=null?we.quoted:ce.dollarQuoted,ot=(vt,It)=>{if(ee){let lt=It??vt/60*J;return `$${Math.round(lt).toLocaleString("es-CO")}`}return Fs(vt)},ea=ee?Math.abs(Ht-je):0,nt=ee?`+$${ea.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ue?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:He,ta=ee&&Fe?f==="es"?"solo mano de obra":"labor only":void 0;return jsxRuntime.jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",G?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:G?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[sn&&jsxRuntime.jsx("div",{className:"w-6 flex-shrink-0"}),at&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(vt=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",vt.type!=="name"&&"justify-center"),style:{width:Hn[vt.id],minWidth:vt.minWidth},children:vt.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),ta&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",G?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),ta]})]}):vt.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",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ot(k,ee?je:void 0)}),jsxRuntime.jsx("span",{className:g("text-[11px]",G?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:g("text-[11px]",G?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ot(Y,ee?Ht:void 0)})]}),Y>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ue?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ee?nt:He})]}):vt.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?ot(Q,ee?it:void 0):"\u2013"}):vt.type==="effortMinutes"?(()=>{if(ee&&Q>0&&Y>0){let It=Math.round(it),lt=Math.round(Ht),Rt=It-lt,$a=It>0?Math.round(Rt/It*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ot(Y,Ht)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Rt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>=0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",$a,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y>0?ot(Y,ee?Ht:void 0):"\u2013"})})():vt.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:k>0?ot(k,ee?je:void 0):"\u2013"}):vt.type==="progress"?(()=>{let It=Q0(uu(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",G?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[It,"%"]})})():vt.type==="weight"?(()=>{let It=e||[],lt=[],Rt=dr=>{for(let ja of dr)lt.push(ja),ja.subtasks?.length&&Rt(ja.subtasks);};Rt(It);let wr=lt.filter(dr=>!dr.subtasks?.length||dr.subtasks.length===0).reduce((dr,ja)=>dr+(ja.weight||0),0),Er=Math.abs(wr-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Er?G?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(wr.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",G?"text-white/30":"text-gray-300"),children:"\u2013"})},vt.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Br.length===0&&mt&&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",G?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(G?"text-white/60":"text-gray-600"),children:xe.empty.noResults})]})})]})}),Le?.enabled&&Le.data&&Pe&&jsxRuntime.jsx(K0,{data:Le.data,isDark:G,locale:f,onClose:()=>Oe(false),lens:t?.lens,onUnassignedTaskClick:k=>{let Y=document.querySelector(`[data-task-id="${k}"]`);Y&&(Y.scrollIntoView({behavior:"smooth",block:"center"}),Z(k),setTimeout(()=>Z(null),2e3));}})]}),jsxRuntime.jsx(E0,{state:ve,onClose:qr,isDark:G,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ua,onColumnSort:Qo,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),ht&&_t&&pe&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:_t.x+12,top:_t.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=Se.flattenTasks(e).find(Q=>Q.id===pe);return Y?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:G?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${G?"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:G?"#e6edf3":"#111827"},children:Y.name})]}):null})()}),document.body),jsxRuntime.jsx(W0,{isOpen:I,onClose:()=>K(false),onSave:Bs,isDark:G,locale:f})]})}var tf=[{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}],af=[{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"}],rf=[{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 pu={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"},mu={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"},gu={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"},Kl={dark:pu,light:mu,neutral:gu};function nf(e){return Kl[e]||Kl.dark}function ql(e,t,a,r,n=5){let s=[],o=[],i=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of i){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),b=0;for(;(s[b]||[]).some(([h,y])=>!(v<h||f>y));)b++;(s[b]=s[b]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:b,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let l=[],p=[],u={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(u[m.serial]=u[m.serial]||[]).push(m);}),Object.keys(u).forEach(m=>{let f=+m,v=u[f],b=[];for(let h=0;h<n;h++)c[f].has(h)||b.push(h);if(v.length<=b.length)v.forEach((h,y)=>l.push({it:h,day:f,lane:b[y]}));else {let h=Math.max(b.length-1,0);v.slice(0,h).forEach((y,x)=>l.push({it:y,day:f,lane:b[x]})),p.push({day:f,lane:b[h]!=null?b[h]:n-1,count:v.length-h,items:v.slice(h)});}});let d=s.length;return l.forEach(m=>{d=Math.max(d,m.lane+1);}),p.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:l,more:p,laneCount:Math.max(d,1)}}var hC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],yC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function of(e){return e==="es"?hC:yC}function sf(e){return (e.getDay()+6)%7}function lf(e,t){let a=new Date(e,t,1),r=sf(a),n=new Date(e,t,1-r),s=[];for(let u=0;u<6;u++)s.push({ws:u*7+1,we:u*7+7});let o=u=>{let d=new Date(n);return d.setDate(n.getDate()+(u-1)),d},i=u=>{let d=u.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=i(a),l=new Date(e,t+1,0),p=i(l);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:i,monthStartSerial:c,monthEndSerial:p}}function wi(e,t){return sf(e.serialToDate(t))>=5}function cf(e,t,a,r,n){let s=[],o=[],i=[],c=Math.max(1,n),l=0;for(let p=a;p<=r;p++){let u=e.filter(b=>!b.container&&b.endSerial===p).sort((b,h)=>+!!b.done-+!!h.done||b.name.localeCompare(h.name)),d=t.filter(b=>b.serial===p),m=u.length+d.length;if(m===0)continue;let f=Math.min(m,c),v=0;for(let b of u.slice(0,f))s.push({t:b,s:p,e:p,lane:v++,contL:false,contR:false});for(let b of d.slice(0,Math.max(0,f-Math.min(u.length,f))))o.push({it:b,day:p,lane:v++});if(m>f){let b=d.slice(Math.max(0,f-Math.min(u.length,f)));i.push({day:p,lane:-1,count:m-f,items:b});}l=Math.max(l,v);}return {bars:s,chips:o,more:i,laneCount:Math.max(l,1)}}function xC(e){let t=[],a=(r,n,s)=>{for(let o of r){let i=n||o.id,c=s||o.name;t.push({t:o,phaseId:i,phaseName:c}),o.subtasks?.length&&a(o.subtasks,i,c);}};return a(e,"",""),t}function df(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function uf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Yl(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=xC(t),i=42,c=[];for(let{t:p,phaseId:u,phaseName:d}of o){let m=df(p.startDate),f=df(p.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),b=a.dateToSerial(f);if(b<1||v>i)continue;let h=p.effortMinutes??0,y=Math.round(h/60*10)/10,x=p.costAtCompletion,w=x!=null?uf(x):uf(y*n),C=p.assignees?.[0],P=C?.initials||(C?.name?kC(C.name):void 0),O=p.displayId||p.wbsCode||"",N=wC(O||p.id)?"":O||p.id;c.push({uid:p.id,id:N,name:p.name,projectId:s,color:p.color,startSerial:Math.max(v,1),endSerial:Math.min(b,i),hrs:y,cost:w,critical:!!p.isCriticalPath,who:P,realStart:m,realEnd:f,phaseId:u,phaseName:d,done:p.progress===100||p.status==="completed",overdue:!(p.progress===100||p.status==="completed")&&(()=>{let S=new Date;S.setHours(0,0,0,0);let M=new Date(f);return M.setHours(0,0,0,0),M<S})(),milestone:!!p.isMilestone,container:!!(p.subtasks&&p.subtasks.length>0)});}let l=[];return {calTasks:c,dayItems:l,isEmpty:c.length===0&&l.length===0}}var vC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function wC(e){return vC.test(e)||/^task-\d+/.test(e)}function kC(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 CC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],TC=["January","February","March","April","May","June","July","August","September","October","November","December"];function pf(e,t,a){return `${(a==="es"?CC:TC)[t]} ${e}`}var fu=26,NC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Xl({locale:e}){let t=of(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsxRuntime.jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function Jl({bar:e,ws:t,money:a,projColor:r,slotH:n=fu,due:s=false,showValues:o=true}){let{t:i}=e,c=e.s-t,l=e.e-e.s+1,p="cal-bar"+(i.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":"")+(s?" due":"")+(s&&i.done?" done":"")+(s&&i.overdue?" overdue":"")+(s&&i.milestone?" hito":""),u=a==="$"?i.cost:`${i.hrs}h`,d=o&&(a==="$"||i.hrs>0),m={"--proj":e.color??i.color??r,left:`calc(${c}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:p,style:m,children:[i.critical&&l>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s&&i.done?jsxRuntime.jsx("span",{className:"ico","aria-hidden":true,children:"\u2713"}):null,s&&i.overdue?jsxRuntime.jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 12 12","aria-hidden":true,children:[jsxRuntime.jsx("circle",{cx:"6",cy:"6",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"6",y1:"3.4",x2:"6",y2:"6.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"8.6",r:"0.8",fill:"currentColor"})]}):null,s&&i.milestone?jsxRuntime.jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":true,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}):null,i.id?jsxRuntime.jsx("span",{className:"tk",children:i.id}):null,jsxRuntime.jsx("span",{className:"nom",children:i.name}),l>=3&&d?jsxRuntime.jsx("span",{className:"val",children:u}):null,s&&i.overdue?jsxRuntime.jsx("span",{className:"sr-only",children:"Overdue"}):null]})}function Ql({chip:e,ws:t,slotH:a=fu}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:NC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Zl({more:e,ws:t,slotH:a=fu,onClick:r,enCabecera:n=false,locale:s="es"}){let o=e.day-t,i=n?{left:`calc(${o+1}/7*100% - 4px)`,top:"-25px",transform:"translateX(-100%)"}:{left:`calc(${o}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxRuntime.jsxs("div",{className:n?"cal-more en-cabecera":"cal-more",style:i,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," ",s==="en"?"more":"m\xE1s"]})}function mf({projects:e,locale:t="es"}){let a=t==="en";return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var MC=[{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 bu({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:i=false,hiddenViews:c=[]}){let l=o==="en",p=MC.filter(u=>!c.includes(u.id));return i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"cal-seg",children:p.map(u=>jsxRuntime.jsx("button",{type:"button",className:e===u.id?"on":"",onClick:()=>t(u.id),title:`${l?u.en:u.es} (${u.key})`,children:l?u.en:u.es},u.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),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:p.map(u=>jsxRuntime.jsxs("button",{type:"button",className:e===u.id?"on":"",onClick:()=>t(u.id),children:[l?u.en:u.es,jsxRuntime.jsx("span",{className:"key",children:u.key})]},u.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function gf({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:i,phaseFilter:c="all",onPhaseChange:l,locale:p="es",children:u}){let d=o?o.length:0,[m,f]=react.useState(false),v=react.useRef(null),b=p==="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 h=c==="all"?b?"Todas":"All":i?.find(y=>y.id===c)?.name??(b?"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:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:b?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),i&&i.length>0&&l?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:b?"Fase":"Phase"})," ",h," \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:()=>{l("all"),f(false);},children:jsxRuntime.jsx("span",{className:"nm",children:b?"Todas las fases":"All phases"})}),i.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:()=>{l(y.id),f(false);},children:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,u,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",b?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var PC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function ff({off:e,onToggle:t}){let a=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:PC.map(r=>{let n=a.includes(r.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:r.nm}),jsxRuntime.jsx("div",{className:"sub",children:r.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var IC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},RC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function hf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let i=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 l=a.length+t.length,u=r||(d=>{switch(d.type){case "hito":return i?"Milestone":"Hito";case "desembolso":return i?"Disb.":"Desemb.";case "deadline":return i?"Due":"Vence";case "aus":return i?"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 ${l} ${i?"items":"elementos"}`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",i?l===1?"item":"items":l===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[a.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:RC[d.type]},children:IC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:u(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var bf={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 yf({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r,irAPrimera:n}){let s=bf[a]||bf.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:s.title}),jsxRuntime.jsxs("p",{children:[s.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),n?jsxRuntime.jsx("button",{type:"button","data-ir-a-primera":true,className:"cal-empty-crear",onClick:n.onClick,children:a==="en"?`Go to the first (${n.mes}) \u2192`:`Ir a la primera (${n.mes}) \u2192`}):null,r?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:s.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:s.upcoming}),t.map((o,i)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(o.type==="deadline"?"rd":"cy"),children:o.type==="deadline"?"\u2691":"\u25C6"}),o.label,jsxRuntime.jsx("span",{className:"d",children:o.date})]},i))]}):null]})}function vf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function OC(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 xf=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function HC(e){return xf[e%xf.length]}function UC(e){return e>1?"over":e>=.9?"warn":"ok"}var hu="\xA0";function jo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function wf(e,t,a){let r=new Map,n=new Set;for(let i of t)i.isWeekend||i.isHoliday||n.add(vf(i.date));if(n.size===0)return r;let s=new Map;e.forEach((i,c)=>{s.set(i.userId,{color:HC(c),initials:OC(i.name)});});let o=new Map;for(let i of e)for(let c of i.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let l=o.get(c.date);l.set(i.userId,(l.get(i.userId)??0)+(c.hours||0));}for(let i of n){let c=o.get(i)??new Map,l=e.map(u=>{let d=s.get(u.userId);return {name:u.name,initials:d.initials,color:d.color,hours:Math.round((c.get(u.userId)??0)*100)/100,capacity:a}}),p=l.reduce((u,d)=>u+d.hours,0);r.set(i,{assigned:Math.round(p*100)/100,capacity:a*e.length,perPerson:l});}return r}function kf({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=vf(n.date),o=n.isWeekend||n.isHoliday,i=o?void 0:t.get(s),c=!!i&&i.capacity>0,l=c?i.assigned/i.capacity:0,u="cal-cap-cell "+(o?"off":UC(l))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:u,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${hu}/${hu}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[jo(i.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",hu,jo(i.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:c?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(l*100,100)+"%"}}):null})]},n.serial)})})}function Cf({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=react.useRef(null);react.useEffect(()=>{let l=u=>{u.key==="Escape"&&a();},p=u=>{n.current&&!n.current.contains(u.target)&&a();};return document.addEventListener("keydown",l),document.addEventListener("mousedown",p),()=>{document.removeEventListener("keydown",l),document.removeEventListener("mousedown",p);}},[a]);let s=t.reduce((l,p)=>l+p.hours,0),o=t.reduce((l,p)=>l+p.capacity,0),i=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,...r},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:i?{color:"var(--red)"}:void 0,children:[jo(s),"h asignadas / ",jo(o),"h"]}),i?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",jo(c),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(l=>{let p=l.capacity>0&&l.hours>l.capacity,u=l.capacity>0?l.capacity:1;return jsxRuntime.jsxs("div",{className:p?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:l.color},children:l.initials}),jsxRuntime.jsx("span",{className:"nm",title:l.name,children:l.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(l.hours/u*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[jo(l.hours),"h / ",jo(l.capacity),"h"]})]},l.name)})})]})}var yu=28,zC=182;function Nf({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:i,capRows:c,teamSize:l,onTaskOpen:p,onMore:u,onCapDay:d}){let m=i==="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(GC,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:p,onMore:u}),c&&c[v]?jsxRuntime.jsx(kf,{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",l!=null?` \xB7 ${l} ${m?l===1?"persona":"personas":l===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 GC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,onTaskOpen:c,onMore:l}){let p=react.useMemo(()=>ql(r,n,t,a),[r,n,t,a]),u=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=a;f++)d.push(f);let m={height:`${zC}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),b=f>=e.monthStartSerial&&f<=e.monthEndSerial,h="cal-day";return wi(e,f)&&(h+=" wknd"),b||(h+=" out"),f===i&&(h+=" today"),u.has(f)&&(h+=" deadline-day"),jsxRuntime.jsx("div",{className:h,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[p.bars.map((f,v)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Jl,{bar:f,ws:t,money:s,projColor:o,slotH:yu})},`b${v}`)),p.chips.map((f,v)=>jsxRuntime.jsx(Ql,{chip:f,ws:t,slotH:yu},`c${v}`)),p.more.map((f,v)=>jsxRuntime.jsx(Zl,{more:f,ws:t,slotH:yu,onClick:()=>l(f.day,f.items,r.filter(b=>b.startSerial<=f.day&&b.endSerial>=f.day))},`m${v}`))]})]})}var VC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function _C(e){return VC.test(e)||/^task-\d+/.test(e)}function jC(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 Df(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function KC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Sf(e,t){let a=KC(e),r=[];for(let n of a){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,i=n.costAtCompletion,c=i!=null?Df(i):Df(o*t),l=n.assignees?.[0],p=l?.initials||(l?.name?jC(l.name):void 0),u=n.displayId||n.wbsCode||"",d=_C(u||n.id)?"":u||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:p,projColor:n.color});}return r}function Ef({items:e,onItemClick:t,onCollapse:a,money:r,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:a,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(i=>{let c=r==="$"?i.cost:`${i.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(i.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[i.id?jsxRuntime.jsx("span",{className:"tk",children:i.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:i.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:i.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[i.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:c}),i.who?jsxRuntime.jsx("span",{className:"cal-ava",children:i.who}):null]})]},i.taskId)})]})}function Mf({onExpand:e,locale:t="es"}){let a=t==="en";return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"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 ",a?"Status":"Estado"]})]})}function Is(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Pf({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:i}){let c=react.useRef(null),l=n==="es";react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let p=a.wasCritical,u=a.projectEndDeltaDays,d=u>0?`+${u} ${l?u===1?"d\xEDa":"d\xEDas":u===1?"day":"days"} \xB7 ${Is(a.oldProjectEnd,n)} \u2192 ${Is(a.newProjectEnd,n)}`:`+0 ${l?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${l?"holgura":"slack"} ${a.slackDays}d`:""}`,m=u>0?l?`Confirmar +${u} ${u===1?"d\xEDa":"d\xEDas"}`:`Confirm +${u} ${u===1?"day":"days"}`:l?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...i},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:l?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Is(a.oldStart,n)," \u2013 ",Is(a.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Is(a.newStart,n)," \u2013 ",Is(a.newEnd,n)]})]})]}),p?jsxRuntime.jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",l?"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:l?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.jsx("span",{className:"v",children:a.movedSuccessors.length===0?l?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:l?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:u>0?"v bad":"v good",children:d})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:l?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.jsx("span",{className:"v",children:a.stillCritical?l?"Sigue en CPM":"Stays critical":a.wasCritical?l?"Sale de CPM":"Leaves critical":l?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:l?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:p||u>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?l?"Guardando\u2026":"Saving\u2026":m})]})]})}var JC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Ff({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:i}){let c=o==="es",l=react.useMemo(()=>{let u=new Map,d=m=>(u.has(m)||u.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),u.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...u.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(l.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 p=u=>u.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:l.map(u=>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:u.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[p(u.date),u.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),u.tasks.map(d=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>i?.(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:r==="$"?d.cost:`${d.hrs}h`})]},d.uid)),u.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:JC[d.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},u.serial))})}function QC(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function ec(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function xu(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function Lf(e,t){let a=new Map(e.map(l=>[l.id,l])),r=new Map;for(let l of e)for(let p of ec(l))r.has(p)||r.set(p,[]),r.get(p).push(l.id);let n=new Map,s=new Map,o=new Set,i=l=>{if(s.has(l))return s.get(l);if(o.has(l))return s.get(l)??0;o.add(l);let p=a.get(l);if(!p)return o.delete(l),0;let u=ec(p).filter(f=>a.has(f)),d=t.has(l)?t.get(l):p.startDate?new Date(p.startDate).getTime():0;for(let f of u){let v=i(f);v>d&&(d=v);}let m=xu(p)*864e5;return n.set(l,d),s.set(l,d+m),o.delete(l),s.get(l)};for(let l of e)i(l.id);let c=0;return s.forEach(l=>{l>c&&(c=l);}),{finish:s,start:n,projectEnd:c}}function Af(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let l of ec(c))n.has(l)||n.set(l,[]),n.get(l).push(c.id);let s=new Map,o=[...e].sort((c,l)=>(t.get(l.id)??0)-(t.get(c.id)??0));for(let c of o){let l=n.get(c.id)??[];if(l.length===0)s.set(c.id,a);else {let p=1/0;for(let u of l){let d=s.get(u),m=r.get(u);d!=null&&m&&(p=Math.min(p,d-xu(m)*864e5));}s.set(c.id,p===1/0?a:p);}}let i=new Set;for(let c of e){let l=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(l)<864e5/2&&ec(c).length+(n.get(c.id)?.length??0)>0&&i.add(c.id);}return i}function tc(e,t,a,r){let n=QC(e),s=n.find(h=>h.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),i=new Date(s.endDate),c=Lf(n,new Map),l=Af(n,c.finish,c.projectEnd),p=n.map(h=>h.id===t?{...h,startDate:a,endDate:r}:h),u=Lf(p,new Map([[t,a.getTime()]])),d=Af(p,u.finish,u.projectEnd),m=new Map(p.map(h=>[h.id,h])),f=[];for(let h of n){if(h.id===t)continue;let y=c.start.get(h.id),x=u.start.get(h.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=xu(m.get(h.id))*864e5;f.push({id:h.id,name:h.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((u.projectEnd-c.projectEnd)/864e5),b=l.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:i,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(u.projectEnd),wasCritical:l.has(t),stillCritical:d.has(t),slackDays:b}}function Rf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var $f=132,ac=26,wu=20,e2="#5B7FD4";function Of({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:i,onMoneyChange:c,onTaskOpen:l,toolbarContainer:p,hiddenViews:u,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:b,members:h=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w,monthMode:C="span",showValues:P=true,openOnToday:O=false}){let N=react.useRef(null),[S,M]=react.useState(0);react.useEffect(()=>{if(C!=="due")return;let be=N.current;if(!be||typeof ResizeObserver>"u")return;let Ee=new ResizeObserver(()=>M(be.clientHeight));return Ee.observe(be),M(be.clientHeight),()=>Ee.disconnect()});let[T,z]=react.useState("mes"),[$,J]=react.useState(()=>{let be=new Date,Ee={y:be.getFullYear(),m:be.getMonth()};if(O)return Ee;let Qe=(e??[]).map(Ft=>Ft.startDate?new Date(Ft.startDate):null).filter(Ft=>!!Ft&&!isNaN(Ft.getTime()));if(Qe.length===0||(e??[]).some(Ft=>{let kt=Ft.startDate?new Date(Ft.startDate):null,Ia=Ft.endDate?new Date(Ft.endDate):kt;if(!kt||isNaN(kt.getTime()))return false;let ra=new Date(Ee.y,Ee.m,1),ir=new Date(Ee.y,Ee.m+1,0,23,59,59);return kt<=ir&&(Ia??kt)>=ra}))return Ee;let Nt=Qe.reduce((Ft,kt)=>Ft<kt?Ft:kt);return {y:Nt.getFullYear(),m:Nt.getMonth()}}),[L,Ae]=react.useState(false),[U,we]=react.useState([]),[R,xe]=react.useState("all"),[G,Ve]=react.useState(null),[ne,Re]=react.useState(null),[ce,Be]=react.useState(false),[Le,Pe]=react.useState(null),[Oe,dt]=react.useState(false),Z=react.useMemo(()=>lf($.y,$.m),[$.y,$.m]),ze=r||e2,Xe=react.useMemo(()=>{let be=new Set;for(let Ee of y){let Qe=new Date(`${Ee}T12:00:00`),at=Z.dateToSerial(Qe);at>=1&&at<=42&&be.add(at);}return be},[y,Z]);react.useEffect(()=>{w?.({start:Rf(Z.serialToDate(1)),end:Rf(Z.serialToDate(42))});},[$.y,$.m]);let $e=h.length,St=react.useMemo(()=>{let be=x?.hoursPerDay;if(!be)return 8;let Ee=[be.monday,be.tuesday,be.wednesday,be.thursday,be.friday].map(Qe=>Qe||0).filter(Qe=>Qe>0);return Ee.length?Math.round(Ee.reduce((Qe,at)=>Qe+at,0)/Ee.length*10)/10:8},[x]),mt=react.useMemo(()=>Yl({tasks:e,grid:Z,projectColor:()=>ze,hourlyRate:o,projectId:a}),[e,Z,ze,o,a]),gt=react.useMemo(()=>{if(d===false)return [];let be=new Map;for(let Ee of mt.calTasks)Ee.phaseId&&Ee.phaseName&&be.set(Ee.phaseId,Ee.phaseName);return [...be.entries()].map(([Ee,Qe])=>({id:Ee,name:Qe})).sort((Ee,Qe)=>Ee.name.localeCompare(Qe.name))},[mt.calTasks,d]),De=!U.includes("tareas"),ft=!U.includes("cpm"),Ct=react.useMemo(()=>{let be=De?mt.calTasks:[];return R!=="all"&&(be=be.filter(Ee=>Ee.phaseId===R)),ft||(be=be.map(Ee=>Ee.critical?{...Ee,critical:false}:Ee)),be},[mt.calTasks,De,ft,R]),_e=react.useMemo(()=>{let be=new Set;return U.includes("hitos")&&(be.add("hito"),be.add("desembolso")),U.includes("ext")&&be.add("ext"),U.includes("aus")&&be.add("aus"),mt.dayItems.filter(Ee=>!be.has(Ee.type))},[mt.dayItems,U]),ut=!U.includes("festivos"),A=new Date,q=Z.dateToSerial(new Date(A.getFullYear(),A.getMonth(),A.getDate())),Ce=be=>we(Ee=>Ee.includes(be)?Ee.filter(Qe=>Qe!==be):[...Ee,be]),I=()=>J(be=>{let Ee=new Date(be.y,be.m-1,1);return {y:Ee.getFullYear(),m:Ee.getMonth()}}),K=()=>J(be=>{let Ee=new Date(be.y,be.m+1,1);return {y:Ee.getFullYear(),m:Ee.getMonth()}}),ve=()=>{let be=new Date;J({y:be.getFullYear(),m:be.getMonth()});},Ue=react.useMemo(()=>{let be=(e??[]).flatMap(Ee=>[Ee.startDate,Ee.endDate]).map(Ee=>Ee?new Date(Ee):null).filter(Ee=>!!Ee&&!isNaN(Ee.getTime()));return be.length?be.reduce((Ee,Qe)=>Ee<Qe?Ee:Qe):null},[e]),pe=(be,Ee,Qe)=>{if(!v||Ee===0)return;let at=mt.calTasks.find(ra=>ra.uid===be);if(!at)return;let Nt=Ee*864e5,Ft=new Date(at.realStart.getTime()+Nt),kt=new Date(at.realEnd.getTime()+Nt),Ia=tc(e,be,Ft,kt);Ia&&Pe({uid:be,taskId:at.id,taskName:at.name,sim:Ia,anchor:Qe});},tt=async()=>{if(!Le||!b)return;dt(true);let be=[{id:Le.uid,startDate:Le.sim.newStart,endDate:Le.sim.newEnd},...Le.sim.movedSuccessors.map(Qe=>({id:Qe.id,startDate:Qe.newStart,endDate:Qe.newEnd}))],Ee=await b(be);dt(false),Ee&&Pe(null);},ht=pf($.y,$.m,n),qe=[{id:"",name:t,color:ze}],wt=react.useMemo(()=>Sf(e,o),[e,o]),qt=react.useMemo(()=>{if(T==="lookahead"){let be=Z.weeks.find(Qe=>q>=Qe.ws&&q<=Qe.we)??Z.weeks[0],Ee=Z.weeks.indexOf(be);return Z.weeks.slice(Ee,Ee+2)}return T==="semana"?[Z.weeks.find(Ee=>q>=Ee.ws&&q<=Ee.we)??Z.weeks[0]]:[]},[T,Z.weeks,q]),Tt=react.useMemo(()=>{let be={};return qt.forEach((Ee,Qe)=>{let at=[];for(let Ft=Ee.ws;Ft<=Ee.we;Ft++)at.push({serial:Ft,date:Z.serialToDate(Ft),isWeekend:wi(Z,Ft),isHoliday:Xe.has(Ft)});let Nt=wf(h,at,St);be[Qe]={days:at,capByDay:Nt};}),be},[qt,Z,Xe,h,St]),Pt=T==="semana"||T==="lookahead",_t=T==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[p?reactDom.createPortal(jsxRuntime.jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsxRuntime.jsx(bu,{enCabecera:true,hiddenViews:u,view:T,onViewChange:z,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:be=>c(be==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),p):jsxRuntime.jsx(bu,{view:T,onViewChange:z,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:be=>c(be==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:u}),jsxRuntime.jsx(gf,{monthLabel:ht,onPrev:I,onNext:K,onToday:ve,layersOpen:L,onToggleLayers:()=>Ae(be=>!be),layersOff:U,phases:gt,phaseFilter:R,onPhaseChange:xe,locale:n,children:L?jsxRuntime.jsx(ff,{off:U,onToggle:Ce}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:_t?"hidden":void 0},children:[_t?jsxRuntime.jsx(Ff,{grid:Z,tasks:Ct,items:_e,money:i,projColor:ze,todaySerial:q,locale:n,onTaskOpen:l}):Pt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xl,{locale:n}),jsxRuntime.jsx(Nf,{grid:Z,weeks:qt,tasks:Ct,items:_e,money:i,projColor:ze,todaySerial:q,locale:n,capRows:Tt,teamSize:$e,onTaskOpen:l,onMore:(be,Ee,Qe)=>Ve({day:be,items:Ee,tasks:Qe}),onCapDay:(be,Ee,Qe)=>{for(let at of Object.keys(Tt)){let Nt=Tt[+at].capByDay.get(be);if(Nt){Re({dayLabel:Ee,perPerson:Nt.perPerson,anchor:Qe.getBoundingClientRect()});break}}}})]}):mt.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Z.weeks.map(be=>jsxRuntime.jsx("div",{className:"cal-week",style:{minHeight:C==="due"?0:`${$f}px`},children:jsxRuntime.jsx(Hf,{grid:Z,ws:be.ws,we:be.we,todaySerial:q,showFestivos:ut,holidaySerials:Xe,locale:n,deadlineDays:new Set})},be.ws))}),jsxRuntime.jsx(yf,{monthLabel:ht,locale:n,onCreateTask:f,irAPrimera:Ue?{mes:Ue.toLocaleDateString(n==="en"?"en":"es",{month:"long",year:Ue.getFullYear()!==new Date().getFullYear()?"numeric":void 0}),onClick:()=>J({y:Ue.getFullYear(),m:Ue.getMonth()})}:void 0})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",ref:N,style:C==="due"?{minHeight:0,overflow:"hidden"}:void 0,children:Z.weeks.map(be=>jsxRuntime.jsx(t2,{due:C==="due",slots:S>0?Math.max(1,Math.floor((S/Z.weeks.length-26)/wu)):2,showValues:P,grid:Z,ws:be.ws,we:be.we,tasks:Ct,items:_e,money:i,projColor:ze,todaySerial:q,showFestivos:ut,holidaySerials:Xe,locale:n,onTaskOpen:l,onMore:(Ee,Qe,at)=>Ve({day:Ee,items:Qe,tasks:at}),canReschedule:v,onDragReschedule:pe,pendingGhost:Le?{uid:Le.uid,days:Math.round((Le.sim.newStart.getTime()-Le.sim.oldStart.getTime())/864e5)}:null},be.ws))})]}),G?jsxRuntime.jsx(hf,{dayLabel:`${Z.serialToDate(G.day).getDate()}`,items:G.items,tasks:G.tasks.map(be=>({swatch:ze,taskId:be.id,label:be.name,critical:be.critical,value:i==="$"?be.cost:`${be.hrs}h`})),onClose:()=>Ve(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,ne?jsxRuntime.jsx(Cf,{dayLabel:ne.dayLabel,perPerson:ne.perPerson,onClose:()=>Re(null),style:{position:"fixed",top:`${ne.anchor.top-8}px`,left:`${ne.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Le?jsxRuntime.jsx(Pf,{taskName:Le.taskName,taskId:Le.sim.taskId,sim:Le.sim,busy:Oe,locale:n,onConfirm:tt,onCancel:()=>Pe(null),style:{position:"fixed",top:`${Le.anchor.top+12}px`,left:`${Math.min(Le.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),ce?jsxRuntime.jsx(Ef,{items:wt,money:i,projColor:ze,onItemClick:be=>l?.(be),onCollapse:()=>Be(false),locale:n==="en"?"en":"es"}):jsxRuntime.jsx(Mf,{onExpand:()=>Be(true),locale:n==="en"?"en":"es"})]}),jsxRuntime.jsx(mf,{projects:qe,locale:n==="en"?"en":"es"})]})}function Hf({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let i=[];for(let c=t;c<=a;c++)i.push(c);return jsxRuntime.jsx("div",{className:"cal-week-bg",children:i.map(c=>{let l=e.serialToDate(c),p=c>=e.monthStartSerial&&c<=e.monthEndSerial,u=n&&s.has(c),d="cal-day";return wi(e,c)&&(d+=" wknd"),u&&(d+=" festivo"),p||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxRuntime.jsxs("div",{className:d,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:l.getDate()}),u?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function t2({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,showFestivos:c,holidaySerials:l,locale:p,onTaskOpen:u,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v,due:b=false,slots:h=2,showValues:y=true}){let x=react.useMemo(()=>b?cf(r,n,t,a,h):ql(r,n,t,a),[r,n,t,a,b,h]),w=react.useMemo(()=>new Set(n.filter(M=>M.type==="deadline").map(M=>M.serial)),[n]),C=b?0:Math.max($f,x.laneCount*ac+36),P=react.useRef(null),[O,N]=react.useState(null),S=(M,T)=>{if(!m||!f){u?.(T);return}M.preventDefault();let z=P.current;if(!z)return;let $=z.getBoundingClientRect().width/7,J=M.clientX,L=0,Ae=we=>{let R=Math.round((we.clientX-J)/$);L=R,N({id:T,days:R});},U=we=>{if(window.removeEventListener("pointermove",Ae),window.removeEventListener("pointerup",U),N(null),L===0){u?.(T);return}let R=new DOMRect(we.clientX,we.clientY,0,0);f(T,L,R);};window.addEventListener("pointermove",Ae),window.addEventListener("pointerup",U);};return jsxRuntime.jsxs("div",{ref:P,className:"cal-week",style:{minHeight:`${C}px`},children:[jsxRuntime.jsx(Hf,{grid:e,ws:t,we:a,todaySerial:i,showFestivos:c,holidaySerials:l,locale:p,deadlineDays:w}),jsxRuntime.jsxs("div",{className:"cal-items",children:[x.bars.map((M,T)=>{let z=O?.id===M.t.uid?O.days:null,$=v?.uid===M.t.uid?v.days:null,J=z??$??0,L=z==null&&$!=null,Ae=J!==0?{...M,s:M.s+J,e:M.e+J}:M;return jsxRuntime.jsx("div",{onPointerDown:U=>S(U,M.t.uid),style:{cursor:m?"grab":u?"pointer":"default",display:"contents",opacity:L?.6:1},children:jsxRuntime.jsx(Jl,{bar:Ae,ws:t,money:s,projColor:o,slotH:b?wu:ac,due:b,showValues:y})},`b${T}`)}),x.chips.map((M,T)=>jsxRuntime.jsx(Ql,{chip:M,ws:t,slotH:ac},`c${T}`)),x.more.map((M,T)=>jsxRuntime.jsx(Zl,{more:M,ws:t,slotH:b?wu:ac,enCabecera:b,locale:p,onClick:()=>d(M.day,M.items,b?r.filter(z=>!z.container&&z.endSerial===M.day):r.filter(z=>z.startSerial<=M.day&&z.endSerial>=M.day))},`m${T}`))]})]})}function r2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:i}){let[c,l]=react.useState(false),p=react.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),u=react.useMemo(()=>{let m=p.length,f=new Set(p.flatMap(h=>h.assignedUserIds||[])).size,v=p.map(h=>h.priority).filter(Boolean),b=new Set(p.flatMap(h=>h.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:b}},[p]),d=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(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:u.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:[u.uniqueAssignees," assignees"]})]}),u.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:[u.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(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 Wf={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 Ti(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 zf(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 Gf({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:i}){let c=react.useMemo(()=>({...Wf,...o}),[o]),[l,p]=react.useState(new Set),u=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],C=y.get(w);C?C.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((C,P)=>P.timestamp.getTime()-C.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=>{p(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},b=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),O=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:O<7?`${O}d ago`:y.toLocaleDateString()},h=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&&u.current){let y=u.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",i),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",i),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;a({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[Ti(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;a({...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=>a({...t,searchTerm:y.target.value})})]}),h>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:u,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 C=l.has(x.id),P=s===x.id,O=zf(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:O},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ti(x.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:O}})]}),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?b(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:N=>{N.stopPropagation(),v(x.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([N,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[N,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},N)),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(([N,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[N,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},N))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function _f({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],u=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",l),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",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:u&&Ti(u.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:u&&Ci(u)}),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:u&&u.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=>i(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:()=>i(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:p.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:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:u&&u.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",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ku(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 Cu(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 jf(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 Kf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function c2(e,t,a,r,n,s=100){let o=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;o.forEach(p=>{let u=a/2,d=r/2;p.vx+=(u-p.x)*n.centerForce*l,p.vy+=(d-p.y)*n.centerForce*l,o.forEach(m=>{if(p.id===m.id)return;let f=p.x-m.x,v=p.y-m.y,b=Math.sqrt(f*f+v*v)||1,h=n.chargeStrength*l/(b*b);p.vx+=f/b*h,p.vy+=v/b*h;});}),t.forEach(p=>{let u=i.get(typeof p.source=="string"?p.source:p.source.id),d=i.get(typeof p.target=="string"?p.target:p.target.id);if(!u||!d)return;let m=d.x-u.x,f=d.y-u.y,v=Math.sqrt(m*m+f*f)||1,b=(v-n.linkDistance)/v*n.forceStrength*l;u.vx+=m*b,u.vy+=f*b,d.vx-=m*b,d.vy-=f*b;}),o.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,p.x)),p.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return o}function qf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:i,className:c}){let l=react.useRef(null),[p,u]=react.useState([]),[d,m]=react.useState(null),[f,v]=react.useState(null),[b,h]=react.useState(null),[y,x]=react.useState(1),[w,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=c2(e,t,a.width,a.height,a,150);u($);},[e,t,a]);let P=react.useCallback(($,J)=>{a.enableDragging&&(J.stopPropagation(),m($));},[a.enableDragging]),O=react.useCallback($=>{if(!d||!l.current)return;let L=l.current.getBoundingClientRect(),Ae=($.clientX-L.left-w.x)/y,U=($.clientY-L.top-w.y)/y;u(we=>we.map(R=>R.id===d?{...R,x:Ae,y:U,fx:Ae,fy:U}:R));},[d,y,w]),N=react.useCallback(()=>{m(null);},[]),S=react.useCallback(($,J)=>{J.stopPropagation(),i?.({type:"node-click",node:$,position:{x:J.clientX,y:J.clientY}});},[i]),M=react.useCallback(($,J)=>{J.stopPropagation(),i?.({type:"edge-click",edge:$,position:{x:J.clientX,y:J.clientY}});},[i]),T=react.useCallback($=>{let J=p.find(L=>L.id===$);return J?{x:J.x,y:J.y}:{x:0,y:0}},[p]),z=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let J=$.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.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"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:ku($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[jf($)," ",Cu($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:O,onMouseUp:N,onMouseLeave:N,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let J=T(typeof $.source=="string"?$.source:$.source.id),L=T(typeof $.target=="string"?$.target:$.target.id),Ae=Kf($.type),U=b===$.id,we=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",U&&"hovered",we&&"critical"),onMouseEnter:()=>h($.id),onMouseLeave:()=>h(null),onClick:R=>M($,R),children:[jsxRuntime.jsx("line",{x1:J.x,y1:J.y,x2:L.x,y2:L.y,stroke:ku($.type),strokeWidth:we?a.edgeWidth*2:a.edgeWidth,strokeOpacity:U?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),a.showEdgeLabels&&U&&jsxRuntime.jsx("text",{x:(J.x+L.x)/2,y:(J.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Cu($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let J=f===$.id,L=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",J&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Ae=>P($.id,Ae),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:Ae=>S($,Ae),children:[jsxRuntime.jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:z($),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:J?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Jf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=react.useState(""),[i,c]=react.useState(false),[l,p]=react.useState(null),[u,d]=react.useState(null),m=react.useRef(null),f=i||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(""),p(null),d(null),t());},b=async()=>{if(!(!s.trim()||f)){c(true),p(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{u&&(a(u),v());};return e?jsxRuntime.jsxs(ba,{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:u?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!"})]}),u.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:u.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",u.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:u.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 (",u.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[u.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)),u.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",u.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."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),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"}),u?jsxRuntime.jsx("button",{onClick:h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:b,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 Tu={"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 u2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},p2={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 m2(e,t,a){let r=Tu[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function Ni(e){return `$${e.toFixed(4)}`}var Nu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=m2(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(u=>u.timestamp>=t.start&&u.timestamp<=t.end));let r=a.length,n=a.reduce((u,d)=>u+d.cost,0),s=a.reduce((u,d)=>u+d.inputTokens,0),o=a.reduce((u,d)=>u+d.outputTokens,0),i=a.filter(u=>u.success),c=a.reduce((u,d)=>u+d.duration,0),l={},p={};return a.forEach(u=>{l[u.feature]=(l[u.feature]||0)+1,p[u.feature]=(p[u.feature]||0)+u.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let i=this.operations.filter(p=>p.timestamp>=o).length,c=Math.max(0,n-i),l=i/n*100;return {used:i,limit:n,remaining:c,percentUsed:l,isExceeded:i>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},qo=new Nu;function eb({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=react.useState(qo.getStats()),[s,o]=react.useState(qo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(qo.getStats()),o(qo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=qo.getRecentOperations(5);return jsxRuntime.jsxs(ba,{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 (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ni(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,u=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${u}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.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:Ni(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 rb({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,i]=react.useState(""),[c,l]=react.useState(""),[p,u]=react.useState(""),[d,m]=react.useState(false),[f,v]=react.useState(null),[b,h]=react.useState(null),[y,x]=react.useState(null),w=react.useRef(null),C=d||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let M=T=>{T.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,C]);let P=()=>{C||(i(""),l(""),u(""),v(null),h(null),x(null),t());},O=async()=>{if(!(!o.trim()||C)){m(true),v(null),h(null),x(null);try{let M=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});h(M.tasks.tasks),x({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){v(M instanceof Error?M.message:"Failed to generate tasks");}finally{m(false);}}},N=()=>{b&&(a(b),P());};if(!e)return null;let S=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ba,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:P}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:P,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:b?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 (",S,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[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:[b.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((M,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:M.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"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:M.priority})]})},M.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:M=>i(M.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:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:M=>l(M.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:C})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:M=>u(M.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:C})]})]}),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((M,T)=>jsxRuntime.jsx("button",{onClick:()=>i(M),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},T))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#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:P,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),b?jsxRuntime.jsx("button",{onClick:N,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:O,disabled:!o.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function oc({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),n=react.useCallback(b=>{t&&Hi(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),s=react.useCallback(async(b,h,y)=>{r(x=>{let w=x.cards.find(M=>M.id===b);if(!w)return x;let C=w.columnId,P={...w,columnId:h,position:y},O=x.cards.map(M=>M.id===b?P:M),N=x.columns.map(M=>{if(M.id===C)return {...M,cardIds:M.cardIds.filter(T=>T!==b)};if(M.id===h){let T=O.filter(z=>z.columnId===h).sort((z,$)=>z.position-$.position);return {...M,cardIds:T.map(z=>z.id)}}return M}),S={...x,cards:O,columns:N};return n(S),S});},[n]),o=react.useCallback(async(b,h)=>{r(y=>{let x=y.cards.map(C=>C.id===b?{...C,...h}:C),w={...y,cards:x};return n(w),w});},[n]),i=react.useCallback(async b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h},w=y.columns.map(P=>P.id===b.columnId?{...P,cardIds:[...P.cardIds,h]}:P),C={...y,cards:[...y.cards,x],columns:w};return n(C),C});},[n]),c=react.useCallback(async b=>{r(h=>{let y=h.cards.find(P=>P.id===b);if(!y)return h;let x=h.cards.filter(P=>P.id!==b),w=h.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter(O=>O!==b)}:P),C={...h,cards:x,columns:w};return n(C),C});},[n]),l=react.useCallback(async b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),p=react.useCallback(async(b,h)=>{r(y=>{let x=y.columns.map(C=>C.id===b?{...C,...h}:C),w={...y,columns:x};return n(w),w});},[n]),u=react.useCallback(async b=>{r(h=>{let y=h.cards.filter(C=>C.columnId!==b),x=h.columns.filter(C=>C.id!==b),w={...h,cards:y,columns:x};return n(w),w});},[n]),d=react.useCallback(b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(b),h},[i]),m=react.useCallback(b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),h},[l]),f=react.useCallback(()=>{r(b=>{let h={...b,cards:[],columns:[]};return n(h),h});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:u},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:u,clearBoard:f}}}function ob({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=oc({initialBoard:e,onPersist:a}),o=react.useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(u=>u.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(u=>u.position)):0;s.addColumn({title:c,position:l??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var Di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ib={by:"none",order:"asc"};function lb({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=react.useState({...Di,...e}),[s,o]=react.useState({...ib,...t}),i=react.useCallback(v=>{n(b=>({...b,...v}));},[]),c=react.useCallback(v=>{o(b=>({...b,...v}));},[]),l=react.useCallback(()=>{n(Di),o(ib);},[]),p=react.useCallback(()=>{a&&n({...Di,assignees:[a]});},[a]),u=react.useCallback(()=>{n({...Di,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{n({...Di,priorities:["HIGH","URGENT"]});},[]),m=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),f=react.useCallback(v=>{let b=[...v];if(r.search){let h=r.search.toLowerCase();b=b.filter(y=>y.title.toLowerCase().includes(h)||y.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,y=h.getFullYear(),x=String(h.getMonth()+1).padStart(2,"0"),w=String(h.getDate()).padStart(2,"0"),C=`${y}-${x}-${w}`;b=b.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let O=P.endDate||P.dueDate;if(!O)return false;let N;if(typeof O=="string")N=O.split("T")[0]||O;else {let S=O.getUTCFullYear(),M=String(O.getUTCMonth()+1).padStart(2,"0"),T=String(O.getUTCDate()).padStart(2,"0");N=`${S}-${M}-${T}`;}switch(r.dateFilter){case "overdue":return N<C;case "today":return N===C;case "this-week":let S=new Date(C+"T00:00:00"),M=new Date(N+"T00:00:00"),T=new Date(S);return T.setDate(T.getDate()+7),M>=S&&M<=T;case "custom":if(r.dateRange){let z=typeof O=="string"?new Date(O):O;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(b=b.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(b=b.filter(h=>h.labels&&h.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(b=b.filter(h=>r.columns.includes(h.columnId))),s.by!=="none"&&b.sort((h,y)=>{let x=0;switch(s.by){case "created":let w=h.createdAt?new Date(h.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;x=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},O=P[h.priority||"LOW"],N=P[y.priority||"LOW"];x=O-N;break;case "dueDate":let S=h.endDate||h.dueDate,M=y.endDate||y.dueDate;if(!S)return 1;if(!M)return -1;let T=typeof S=="string"?new Date(S).getTime():S.getTime(),z=typeof M=="string"?new Date(M).getTime():M.getTime();x=T-z;break;case "title":x=h.title.localeCompare(y.title);break;case "estimate":let $=h.estimatedTime||0,J=y.estimatedTime||0;x=$-J;break;default:x=0;}return s.order==="asc"?x:-x}),b},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:u,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var db,ub;if(typeof window<"u")try{let e=Bi("ai");db=e.generateObject,ub=e.generateText;}catch{}function pb(e={}){let[t,a]=react.useState(false),[r,n]=react.useState(null),s=!!(db&&ub&&e.apiKey),o=react.useCallback(async u=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",u),{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: ${u}`,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{a(false);}},[s]),i=react.useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",u.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{a(false);}},[s]),c=react.useCallback(async u=>{if(!s)throw new Error("AI features not available");a(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{a(false);}},[s]),l=react.useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",u.title),[{title:`Subtask 1 for: ${u.title}`,position:u.position+.1,columnId:u.columnId},{title:`Subtask 2 for: ${u.title}`,position:u.position+.2,columnId:u.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{a(false);}},[s]),p=react.useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",u.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Su(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function mb(e){let{cards:t}=e,[a,r]=Su(),n=react.useCallback(u=>a.selectedCardIds.includes(u),[a.selectedCardIds]),s=react.useCallback((u,d)=>{if(!d){r({selectedCardIds:[u],lastSelectedCardId:u});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(u)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==u),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,u],lastSelectedCardId:u});else if(f&&a.lastSelectedCardId){let v=t.find(h=>h.id===u),b=t.find(h=>h.id===a.lastSelectedCardId);if(v&&b&&v.columnId===b.columnId){let h=t.filter(N=>N.columnId===v.columnId).sort((N,S)=>N.position-S.position),y=h.findIndex(N=>N.id===a.lastSelectedCardId),x=h.findIndex(N=>N.id===u),[w,C]=y<x?[y,x]:[x,y],P=h.slice(w,C+1).map(N=>N.id),O=Array.from(new Set([...a.selectedCardIds,...P]));r({selectedCardIds:O,lastSelectedCardId:u});}else r({selectedCardIds:[u],lastSelectedCardId:u});}else r({selectedCardIds:[u],lastSelectedCardId:u});},[t,a,r]),o=react.useCallback(u=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==u),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(u=>u.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(u=>{a.selectedCardIds.includes(u)?o(u):r({selectedCardIds:[...a.selectedCardIds,u],lastSelectedCardId:u});},[a,o,r]),p=react.useCallback(()=>t.filter(u=>a.selectedCardIds.includes(u.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var gb={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function fb(e){let{cards:t,config:a,aiService:r}=e,n=react.useMemo(()=>({...gb,...a}),[a]),[s,o]=react.useState([]),i=react.useCallback((v,b,h,y,x)=>{if(b.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:b,columnId:h,strategy:y,color:x,isExpanded:true,position:s.filter(C=>C.columnId===h).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),c=react.useCallback(v=>{o(b=>b.filter(h=>h.id!==v));},[]),l=react.useCallback(v=>{o(b=>b.map(h=>h.id===v?{...h,isExpanded:!h.isExpanded}:h));},[]),p=react.useCallback((v,b)=>{o(h=>h.map(y=>y.id===v&&!y.cardIds.includes(b)?{...y,cardIds:[...y.cardIds,b]}:y));},[]),u=react.useCallback((v,b)=>{o(h=>h.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==b);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=react.useCallback(v=>s.filter(b=>b.columnId===v).sort((b,h)=>b.position-h.position),[s]),m=react.useCallback(async v=>{let b=t.filter(C=>C.columnId===v);if(b.length<n.minCardsPerStack*2)return [];let h=[],y=new Map;b.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(P=>{y.has(P)||y.set(P,[]),y.get(P).push(C);});}),y.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map(O=>O.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let x=new Map;b.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{x.has(P)||x.set(P,[]),x.get(P).push(C);});}),x.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map(O=>O.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(b.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,P)=>{if(C.length>=n.minCardsPerStack){let O={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";h.push({stack:{title:`${O} ${P} Priority`,cardIds:C.map(N=>N.id),columnId:v,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let C of b){let O=(await r.findSimilar(C,b)).filter(N=>N.similarity>=n.autoStackConfidenceThreshold);if(O.length>=n.minCardsPerStack-1){let N=[C.id,...O.map(M=>M.card.id)],S=O.reduce((M,T)=>M+T.similarity,0)/O.length;h.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:N,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${O.length+1} similar tasks`,confidence:S});}}return h.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,r]),f=react.useCallback(v=>{i(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[i]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let h=await m(b),y=h[0];h.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:u,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var bb=react.createContext(null);function hb({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:l}=Bi("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Bi("@libxai/core");o.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Bi("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:o});}let n=r.current;return react.useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsxRuntime.jsx(bb.Provider,{value:{store:n},children:e})}function sc(){let e=react.useContext(bb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ei(){let e=sc(),[t,a]=react.useState(e.getBoard()),[r,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let i=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),l=react.useCallback((y,x)=>{e.updateColumn(y,x);},[e]),p=react.useCallback(y=>{e.deleteColumn(y);},[e]),u=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]),b=react.useCallback(y=>e.getCard(y),[e]),h=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:u,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:b,getCardsByColumn:h}}function xb(e){let{cards:t}=Ei();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function vb(e="position",t="asc"){let{cards:a}=Ei();return react.useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?i[n.priority]:0,l=s.priority?i[s.priority]:0;o=c-l;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}),[a,e,t])}var ic=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=np.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let i=await Promise.resolve(o.apply(s,a));i!==void 0&&(n=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},P2=new ic;function kb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:i}),u=p.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:d,className:n,children:jsxRuntime.jsx("div",{style:m,children:u.map(f=>{let v=e[f.index];if(!v)return null;let b=c?c(v,f.index):f.index,h={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:h,"data-index":f.index,children:r(v,f.index)},b)})})})}function Cb(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 Nb({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=react.useRef(null),u=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:o,gap:i}),d=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${u.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:m,className:s,children:jsxRuntime.jsx("div",{style:f,children:d.map(v=>{let b=e[v.index];if(!b)return null;let h=c?c(b,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(b,v.index)},h)})})})}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 Sb(e,t=10){return e>t}var Fu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Au={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Iu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ru={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Bu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$u={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ou={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)"},Hu={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)"},Uu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wu={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}},zu={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}},lc={spacing:Fu,borderRadius:Lu,fontSize:Au,fontWeight:Iu,lineHeight:Ru,zIndex:Bu,duration:$u,easing:Ou,shadows:Hu,opacity:Uu,kanban:Wu,gantt:zu};function Eb(e,t,a){return e[t]??a}function Gu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Gu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function A2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vu(e="asakaa"){let t=Gu(lc),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=A2(n);a.push(` ${s}: ${o};`);}return `:root {
415
415
  ${a.join(`
416
416
  `)}
417
417
  }`}function Mi(e,t="asakaa"){let a=[],r=Gu(e);for(let[n,s]of Object.entries(r)){let o=`--${t}-color-${n}`;a.push(` ${o}: ${s};`);}return `:root {
418
418
  ${a.join(`
419
419
  `)}
420
- }`}var cc={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"}},ju={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"}},_u={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function Ku(e=cc,t="asakaa"){let a=Vu(t),r=Mi(e,t);return `${a}
420
+ }`}var cc={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"}},_u={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"}},ju={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function Ku(e=cc,t="asakaa"){let a=Vu(t),r=Mi(e,t);return `${a}
421
421
 
422
422
  ${r}`}function Mb(){return `/**
423
423
  * ASAKAA Design Tokens
@@ -429,17 +429,17 @@ ${Ku(cc)}
429
429
 
430
430
  /* Light theme */
431
431
  [data-theme="light"] {
432
- ${Mi(ju,"asakaa").split(`
432
+ ${Mi(_u,"asakaa").split(`
433
433
  `).slice(1,-1).join(`
434
434
  `)}
435
435
  }
436
436
 
437
437
  /* Neutral theme */
438
438
  [data-theme="neutral"] {
439
- ${Mi(_u,"asakaa").split(`
439
+ ${Mi(ju,"asakaa").split(`
440
440
  `).slice(1,-1).join(`
441
441
  `)}
442
442
  }
443
443
  `}var I2=({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:a=""}){let{theme:r,setTheme:n,themes:s}=bs();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,i])=>{let c=o,l=c===r;return jsxRuntime.jsxs("button",{onClick:()=>n(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(I2,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:i.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=eb;exports.AI_FEATURES=p2;exports.AI_MODELS=Tu;exports.AddCardButton=jc;exports.AddColumnButton=Uc;exports.AttachmentUploader=ms;exports.BoardProvider=hb;exports.BulkOperationsToolbar=cl;exports.BurnDownChart=Zc;exports.CUSTOM_FIELD_TYPES=rf;exports.CalendarBoard=Of;exports.Card=Un;exports.CardHistoryReplay=jf;exports.CardHistoryTimeline=Gf;exports.CardRelationshipsGraph=qf;exports.CardStack=r2;exports.CardTemplateSelector=sd;exports.CircuitBreaker=xc;exports.Column=ls;exports.ColumnManager=fl;exports.CommandPalette=qc;exports.ConfigMenu=dd;exports.ContextMenu=xs;exports.DEFAULT_SHORTCUTS=ni;exports.DEFAULT_TABLE_COLUMNS=tf;exports.DEFAULT_TEMPLATES=od;exports.DateRangePicker=Vs;exports.DependenciesSelector=_s;exports.DependencyLine=ui;exports.DistributionCharts=ed;exports.EditableColumnTitle=Sc;exports.ErrorBoundary=ps;exports.ExportDropdown=qm;exports.ExportImportModal=ld;exports.FilterBar=cd;exports.GANTT_AI_SYSTEM_PROMPT=Mg;exports.GanttAIAssistant=Sl;exports.GanttBoard=Ng;exports.GanttI18nContext=ys;exports.GanttMilestone=Cl;exports.GanttToolbar=gl;exports.GenerateGanttTasksDialog=rb;exports.GeneratePlanModal=Jf;exports.GroupBySelector=rd;exports.HealthBar=Ac;exports.KanbanBoard=lo;exports.KanbanToolbar=Oc;exports.KanbanViewAdapter=ai;exports.KeyboardShortcutsHelp=nd;exports.ListView=ef;exports.MenuIcons=ca;exports.PluginManager=ic;exports.PrioritySelector=Mo;exports.ProfitabilityReport=Ic;exports.QuickTaskCreate=ei;exports.RATE_LIMITS=u2;exports.STANDARD_FIELDS=af;exports.SwimlaneBoardView=td;exports.TagBadge=Mc;exports.TagList=Wp;exports.TagPicker=cs;exports.TaskBar=yl;exports.TaskDetailModal=Io;exports.TaskFormModal=Eg;exports.TaskGrid=hl;exports.ThemeModal=gd;exports.ThemeProvider=$m;exports.ThemeSwitcher=Pb;exports.TimeInputPopover=En;exports.TimePill=Pc;exports.TimePopover=Fc;exports.Timeline=Tl;exports.UserAssignmentSelector=Fo;exports.VelocityChart=Qc;exports.VirtualGrid=Nb;exports.VirtualList=kb;exports.aiUsageTracker=qo;exports.borderRadius=Lu;exports.buildCalendar=Yl;exports.calculatePosition=Oi;exports.cardToGanttTask=Pl;exports.cardsToGanttTasks=Bg;exports.cn=g;exports.createKanbanView=hm;exports.createRetryWrapper=Kb;exports.darkTheme=ud;exports.darkTokenTheme=cc;exports.defaultTheme=ul;exports.designTokens=lc;exports.duration=$u;exports.easing=Ou;exports.exportTokensToCSS=Mb;exports.findTaskByName=_n;exports.fontSize=Au;exports.fontWeight=Iu;exports.formatCost=Ni;exports.ganttEnTranslations=ml;exports.ganttEsTranslations=Hm;exports.ganttTaskToCardUpdate=Rg;exports.ganttThemes=dt;exports.ganttTokens=zu;exports.ganttTranslations=fd;exports.ganttUtils=Me;exports.generateCSSVariables=Vu;exports.generateCompleteCSS=Ku;exports.generateInitialPositions=Gb;exports.generateTasksContext=Pg;exports.generateThemeVariables=Mi;exports.getListViewTheme=nf;exports.getListViewTranslations=Wd;exports.getToken=Eb;exports.getTranslations=Um;exports.kanbanTokens=Wu;exports.lightTheme=pd;exports.lightTokenTheme=ju;exports.lineHeight=Ru;exports.listViewDarkTheme=pu;exports.listViewEnTranslations=Hd;exports.listViewEsTranslations=Ud;exports.listViewLightTheme=mu;exports.listViewNeutralTheme=gu;exports.listViewThemes=Kl;exports.listViewTranslations=Fl;exports.mergeListViewTranslations=Ll;exports.mergeTranslations=bd;exports.neutralTheme=md;exports.neutralTokenTheme=_u;exports.opacity=Uu;exports.parseLocalCommand=Ag;exports.parseNaturalDate=Bd;exports.parseNaturalDuration=$d;exports.parseProgress=Od;exports.parseStatus=Lg;exports.pluginManager=P2;exports.retrySyncOperation=_b;exports.retryWithBackoff=Hi;exports.shadows=Hu;exports.shouldVirtualizeGrid=Sb;exports.simulateReschedule=tc;exports.spacing=Fu;exports.themes=Bo;exports.useAI=pb;exports.useBoard=ob;exports.useBoardCore=Ei;exports.useBoardStore=sc;exports.useCardStacking=fb;exports.useDragState=Bc;exports.useFilteredCards=xb;exports.useFilters=lb;exports.useGanttI18n=Xr;exports.useKanbanState=oc;exports.useKeyboardShortcuts=Im;exports.useMultiSelect=mb;exports.useSelectionState=Su;exports.useSortedCards=vb;exports.useTheme=bs;exports.useVirtualGrid=Db;exports.useVirtualList=Cb;exports.validateAIResponse=Ig;exports.withErrorBoundary=_c;exports.wouldCreateCircularDependency=zi;exports.zIndex=Bu;//# sourceMappingURL=index.cjs.map
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=eb;exports.AI_FEATURES=p2;exports.AI_MODELS=Tu;exports.AddCardButton=_c;exports.AddColumnButton=Uc;exports.AttachmentUploader=ms;exports.BoardProvider=hb;exports.BulkOperationsToolbar=cl;exports.BurnDownChart=Zc;exports.CUSTOM_FIELD_TYPES=rf;exports.CalendarBoard=Of;exports.Card=Un;exports.CardHistoryReplay=_f;exports.CardHistoryTimeline=Gf;exports.CardRelationshipsGraph=qf;exports.CardStack=r2;exports.CardTemplateSelector=sd;exports.CircuitBreaker=xc;exports.Column=ls;exports.ColumnManager=fl;exports.CommandPalette=qc;exports.ConfigMenu=dd;exports.ContextMenu=xs;exports.DEFAULT_SHORTCUTS=ni;exports.DEFAULT_TABLE_COLUMNS=tf;exports.DEFAULT_TEMPLATES=od;exports.DateRangePicker=Vs;exports.DependenciesSelector=js;exports.DependencyLine=ui;exports.DistributionCharts=ed;exports.EditableColumnTitle=Sc;exports.ErrorBoundary=ps;exports.ExportDropdown=qm;exports.ExportImportModal=ld;exports.FilterBar=cd;exports.GANTT_AI_SYSTEM_PROMPT=Mg;exports.GanttAIAssistant=Sl;exports.GanttBoard=Ng;exports.GanttI18nContext=ys;exports.GanttMilestone=Cl;exports.GanttToolbar=gl;exports.GenerateGanttTasksDialog=rb;exports.GeneratePlanModal=Jf;exports.GroupBySelector=rd;exports.HealthBar=Ac;exports.KanbanBoard=lo;exports.KanbanToolbar=Oc;exports.KanbanViewAdapter=ai;exports.KeyboardShortcutsHelp=nd;exports.ListView=ef;exports.MenuIcons=ma;exports.PluginManager=ic;exports.PrioritySelector=Mo;exports.ProfitabilityReport=Ic;exports.QuickTaskCreate=ei;exports.RATE_LIMITS=u2;exports.STANDARD_FIELDS=af;exports.SwimlaneBoardView=td;exports.TagBadge=Mc;exports.TagList=Wp;exports.TagPicker=cs;exports.TaskBar=yl;exports.TaskDetailModal=Io;exports.TaskFormModal=Eg;exports.TaskGrid=hl;exports.ThemeModal=gd;exports.ThemeProvider=$m;exports.ThemeSwitcher=Pb;exports.TimeInputPopover=En;exports.TimePill=Pc;exports.TimePopover=Fc;exports.Timeline=Tl;exports.UserAssignmentSelector=Fo;exports.VelocityChart=Qc;exports.VirtualGrid=Nb;exports.VirtualList=kb;exports.aiUsageTracker=qo;exports.borderRadius=Lu;exports.buildCalendar=Yl;exports.calculatePosition=Oi;exports.cardToGanttTask=Pl;exports.cardsToGanttTasks=Bg;exports.cn=g;exports.createKanbanView=hm;exports.createRetryWrapper=Kb;exports.darkTheme=ud;exports.darkTokenTheme=cc;exports.defaultTheme=ul;exports.designTokens=lc;exports.duration=$u;exports.easing=Ou;exports.exportTokensToCSS=Mb;exports.findTaskByName=jn;exports.fontSize=Au;exports.fontWeight=Iu;exports.formatCost=Ni;exports.ganttEnTranslations=ml;exports.ganttEsTranslations=Hm;exports.ganttTaskToCardUpdate=Rg;exports.ganttThemes=pt;exports.ganttTokens=zu;exports.ganttTranslations=fd;exports.ganttUtils=Se;exports.generateCSSVariables=Vu;exports.generateCompleteCSS=Ku;exports.generateInitialPositions=Gb;exports.generateTasksContext=Pg;exports.generateThemeVariables=Mi;exports.getListViewTheme=nf;exports.getListViewTranslations=Wd;exports.getToken=Eb;exports.getTranslations=Um;exports.kanbanTokens=Wu;exports.lightTheme=pd;exports.lightTokenTheme=_u;exports.lineHeight=Ru;exports.listViewDarkTheme=pu;exports.listViewEnTranslations=Hd;exports.listViewEsTranslations=Ud;exports.listViewLightTheme=mu;exports.listViewNeutralTheme=gu;exports.listViewThemes=Kl;exports.listViewTranslations=Fl;exports.mergeListViewTranslations=Ll;exports.mergeTranslations=bd;exports.neutralTheme=md;exports.neutralTokenTheme=ju;exports.opacity=Uu;exports.parseLocalCommand=Ag;exports.parseNaturalDate=Bd;exports.parseNaturalDuration=$d;exports.parseProgress=Od;exports.parseStatus=Lg;exports.pluginManager=P2;exports.retrySyncOperation=jb;exports.retryWithBackoff=Hi;exports.shadows=Hu;exports.shouldVirtualizeGrid=Sb;exports.simulateReschedule=tc;exports.spacing=Fu;exports.themes=Bo;exports.useAI=pb;exports.useBoard=ob;exports.useBoardCore=Ei;exports.useBoardStore=sc;exports.useCardStacking=fb;exports.useDragState=Bc;exports.useFilteredCards=xb;exports.useFilters=lb;exports.useGanttI18n=Hr;exports.useKanbanState=oc;exports.useKeyboardShortcuts=Im;exports.useMultiSelect=mb;exports.useSelectionState=Su;exports.useSortedCards=vb;exports.useTheme=bs;exports.useVirtualGrid=Db;exports.useVirtualList=Cb;exports.validateAIResponse=Ig;exports.withErrorBoundary=jc;exports.wouldCreateCircularDependency=zi;exports.zIndex=Bu;//# sourceMappingURL=index.cjs.map
445
445
  //# sourceMappingURL=index.cjs.map