@libxai/board 1.5.84 → 1.5.85

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'),$f=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),oy=require('react-markdown'),ny=require('remark-gfm'),sy=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var $f__default=/*#__PURE__*/_interopDefault($f);var oy__default=/*#__PURE__*/_interopDefault(oy);var ny__default=/*#__PURE__*/_interopDefault(ny);var sy__default=/*#__PURE__*/_interopDefault(sy);var Ws=(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 Vs=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 [Vs.Translate.toString(e),Vs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Gs(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 Lf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function yl(e,t){return e.length===0?1e3:t===0?Gs(null,e[0].position):t>=e.length?Gs(e[e.length-1].position,null):Gs(e[t-1].position,e[t].position)}function nu(e,t=100){return e>t}var If=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 Bf(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function js(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=If,onRetry:l}=t,c,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:i,success:false};let g=Bf(p,r,o,s);if(l)try{l(c,p,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Rf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Of(e,t={}){return async(...a)=>js(()=>e(...a),t)}var xl=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 su=(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))(su||{}),_o=class _o{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,o,c?n:""),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",..._o.globalOptions};}static configure(t){_o.globalOptions={..._o.globalOptions,...t};}child(t){return new _o({...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 _s((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new _s(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:su[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};_o.globalOptions={};var vl=_o,_s=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}},iu=new vl;function Hf(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 zf(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 n=e.columns.find(l=>l.id===s.columnId);return [s.id,wl(s.title),wl(s.description||""),wl(n?.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 Uf(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await $f__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,p=n.width/n.height,d=c-20,m=d/p;m>i-20&&(m=i-20,d=m*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(l,"PNG",y,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function wl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function du(e,t,a,r){switch(t){case "json":return Hf(e,r);case "csv":return zf(e);case "pdf":return await Uf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function cu(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]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Wf(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 Vf(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=uu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=uu(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function uu(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function pu(e,t){switch(t){case "json":return Wf(e);case "csv":return Vf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function mu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var kl=react.createContext(null);function gu(){return react.useContext(kl)}var fu=react.createContext(null);function bu({children:e,themeName:t}){return jsxRuntime.jsx(fu.Provider,{value:{themeName:t},children:e})}function yn(){return react.useContext(fu)}function Jt({children:e,container:t}){let[a,r]=react.useState(false),o=gu(),s=yn();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var wu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Jf="#BDC3C7",Qf=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Ko({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,v=g.right-h;v<10&&(v=g.left),v+h>x-10&&(v=x-h-10);let C=y-g.bottom,N=g.top,T;C>=f+b?T=g.bottom+b:N>=f+b?T=g.top-f-b:T=C>=N?g.bottom+b:Math.max(10,g.top-f-b),n({top:T,left:v}),o(true);};react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?wu[e]:null,m=d?.color||Jf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(wu).map(([g,y])=>jsxRuntime.jsxs("button",{onClick:()=>p(g),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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Qf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Zf=[{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 Xn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(yn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,T=320,k=380,w=4,F=v.left;F+T>N-10&&(F=N-T-10),F<10&&(F=10);let I=C-v.bottom,S=v.top,X;I>=k+w?X=v.bottom+w:S>=k+w?X=v.top-k-w:X=I>=S?v.bottom+w:Math.max(10,v.top-k-w),l({top:X,left:F}),s(true);};react.useEffect(()=>{let v=C=>{c.current&&!c.current.contains(C.target)&&!i.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let y=v=>{let C=new Date,N=F=>{let I=F.getFullYear(),S=String(F.getMonth()+1).padStart(2,"0"),X=String(F.getDate()).padStart(2,"0");return `${I}-${S}-${X}`},T=N(C),k=new Date(C);k.setDate(k.getDate()+v);let w=N(k);a(T,w),s(false);},x=()=>{if(!e||!t)return "Set date";let v=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(X=>isNaN(X)))return null;let F=w[0],I=w[1],S=w[2];return F===void 0||I===void 0||S===void 0?null:new Date(F,I-1,S)},C=v(e),N=v(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[C.getMonth()]} ${C.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),v<C})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"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:m?"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:m?"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:Zf.map(v=>jsxRuntime.jsx("button",{onClick:()=>y(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>a(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>a(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Yo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,N=300,T=380,k=4,w=b.right-N;w<10&&(w=b.left),w+N>C-10&&(w=C-N-10);let F=v-b.bottom,I=b.top,S;F>=T+k?S=b.bottom+k:I>=T+k?S=b.top-T-k:S=F>=I?b.bottom+k:Math.max(10,b.top-T-k),p({top:S,left:w}),n(true);};react.useEffect(()=>{let b=v=>{d.current&&!d.current.contains(v.target)&&!m.current?.contains(v.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=v=>{v.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let v=e.some(C=>C.id===b.id);a(v?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(Jt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:b=>c(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(b=>{let v=e.some(C=>C.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(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 Ks(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let p of i){if(!s.has(p)&&l(p))return true;if(n.has(p))return true}}return n.delete(c),false};return l(a)}function Qn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[x,h]=react.useState(null),f=react.useRef(null),b=react.useRef(null),v=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),F=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=w.right-S;$<10&&($=w.left),$+S>I-10&&($=I-S-10);let A=F-w.bottom,q=w.top,Z;A>=X+O?Z=w.bottom+O:q>=X+O?Z=w.top-X-O:Z=A>=q?w.bottom+O:Math.max(10,w.top-X-O),y({top:Z,left:$}),c(true);};react.useEffect(()=>{if(!l||!b.current)return;let w=b.current.getBoundingClientRect(),F=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=w.right-S;$<10&&($=w.left),$+S>I-10&&($=I-S-10);let A=F-w.bottom,q=w.top,Z;A>=X+O?Z=w.bottom+O:q>=X+O?Z=w.top-X-O:Z=A>=q?w.bottom+O:Math.max(10,w.top-X-O),y({top:Z,left:$});},[d,l]),react.useEffect(()=>{let w=F=>{f.current&&!f.current.contains(F.target)&&!b.current?.contains(F.target)&&(c(false),p(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{let w=F=>{F.key==="Escape"&&(c(false),p(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let C=w=>{let F=t.includes(w),I=a.find(S=>S.id===w);if(h(null),F){let S=t.filter(X=>X!==w);r(S),S.length===0&&m(false);}else {if(s&&Ks(a,w,e)){let X=`Cannot add "${I?.title||w}" as dependency - would create circular reference`;h(X),n?.(w,I?.title||w),setTimeout(()=>h(null),3e3);return}r([...t,w]),m(true);}},N=()=>{let w=!d;m(w),w||r([]);},T=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>l?c(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),l&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&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"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>p(w.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:T.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"}):T.map(w=>{let F=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>C(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.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:F?"#3b82f6":"transparent",borderColor:F?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:F&&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:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),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 go=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Vs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:x,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=l.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:v,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:C=>{C.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:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[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:C=>{C.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),N===3&&b.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:["+",b.length-4]})})]},C.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:C=>C.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ko,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Xn,{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:(C,N)=>n?.(e.id,{startDate:C,endDate:N})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Yo,{assignedUsers:h,availableUsers:l,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Qn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsxRuntime.jsx("span",{className:"asakaa-label",children:C},C))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(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)));go.displayName="Card";var qs={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"}},Pu=({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 Au({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=[...Object.entries(qs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(qs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=qs[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...qs.todo,id:"todo"}},m=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,v=180,C=280,N=4,T=h.right-v;T<10&&(T=h.left),T+v>b-10&&(T=b-v-10);let k=f-h.bottom,w=h.top,F;k>=C+N?F=h.bottom+N:w>=C+N?F=h.top-C-N:F=k>=w?h.bottom+N:Math.max(10,h.top-C-N),l({top:F,left:T}),s(true);};react.useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsxRuntime.jsx(Pu,{icon:y.icon,color:x})}),o&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Pu,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Lu={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 Iu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Lu[s]||Lu.en,[l,c]=react.useState(false),[i,p]=react.useState(false),[d,m]=react.useState(e),[g,y]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),react.useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),p(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),react.useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),p(false),m(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let b=()=>{p(true),m(e);},v=()=>{let N=d.trim();N&&N!==e&&t(N),p(false),c(false),m(e);},C=N=>{N.key==="Enter"?v():N.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:N=>m(N.target.value),onKeyDown:C,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:b,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:n.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:n.delete})]})]})]})})})]})}var wn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:v})=>{let{setNodeRef:C,isOver:N}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),k=p??nu(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:k});if(a)return jsxRuntime.jsx("div",{ref:C,className:f,children:a(e,t)});let I=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),S=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",S&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(X()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&I.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${I.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[I.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"})]}),I.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"})]}),I.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"})}),I.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||x)&&jsxRuntime.jsx(Iu,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:v}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!m&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(O=>O.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"})}):k?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(O=>{let $=t[O.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsxRuntime.jsx(go,{card:$,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},$.id):null})}):t.map(O=>jsxRuntime.jsx(go,{card:O,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},O.id))})})]})});wn.displayName="Column";function Sl({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function xb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function zu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(i===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function vb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var kb=["\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 Uu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=react.useState(false),[v,C]=react.useState([]),[N,T]=react.useState(0),[k,w]=react.useState(null),[F,I]=react.useState(false),S=react.useRef(null),X=react.useRef(null),O=react.useRef(null),$=react.useRef(null),A=react.useCallback((z,re)=>{let J=xb(z,re);if(w(J),J){let Le=r.filter(we=>we.name.toLowerCase().includes(J.query)||we.email&&we.email.toLowerCase().includes(J.query)).slice(0,5);C(Le),b(Le.length>0),T(0);}else b(false),C([]);},[r]),q=z=>{let re=z.target.value;if(t(re),A(re,z.target.selectionStart||0),S.current){S.current.style.height="24px";let J=S.current.scrollHeight,Le=280,we=Math.min(J,Le);S.current.style.height=`${we}px`,S.current.style.overflowY=J>Le?"auto":"hidden";}},Z=()=>{S.current&&A(e,S.current.selectionStart||0);},Ee=react.useCallback(z=>{if(!k||!S.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Le=`@${z.name.replace(/\s+/g,"")} `,we=re+Le+J;t(we),b(false),w(null),setTimeout(()=>{if(S.current){let Oe=k.start+Le.length;S.current.selectionStart=Oe,S.current.selectionEnd=Oe,S.current.focus();}},0);},[k,e,t]),B=z=>{if(f&&v.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),T(re=>re<v.length-1?re+1:0);break;case "ArrowUp":z.preventDefault(),T(re=>re>0?re-1:v.length-1);break;case "Enter":{z.preventDefault();let re=v[N];re&&Ee(re);break}case "Tab":{z.preventDefault();let re=v[N];re&&Ee(re);break}case "Escape":z.preventDefault(),b(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};react.useEffect(()=>{let z=re=>{X.current&&!X.current.contains(re.target)&&S.current&&!S.current.contains(re.target)&&b(false),$.current&&!$.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let _=react.useCallback(z=>{if(!S.current)return;let re=S.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(S.current){let Le=re+z.length;S.current.selectionStart=Le,S.current.selectionEnd=Le,S.current.focus();}},0);},[e,t]),he=react.useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Le=re.filter(we=>we.size>J?(console.warn(`File ${we.name} exceeds max size of ${x}MB`),false):true);Le.length>0&&g(Le),z.target.value="";},[g,x]),Ye=react.useCallback(z=>z.type.startsWith("image/")?lucideReact.Image:z.type.includes("pdf")||z.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&X.current){let z=X.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(z=>{let re=Ye(z.file),J=z.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsxRuntime.jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(re,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:z.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:wb(z.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(z.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},z.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I(!F),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsx(framerMotion.motion.div,{ref:$,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:kb.map(z=>jsxRuntime.jsx("button",{type:"button",onClick:()=>_(z),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"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:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:S,value:e,onChange:q,onSelect:Z,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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:f&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:X,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((z,re)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ee(z),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===N?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:z.color||"#8B5CF6"},children:vb(z.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:z.name}),z.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function Wu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[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((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var Zs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function So({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(false),[g,y]=react.useState(Zs[10]||"#2E94FF"),[x,h]=react.useState({top:0,left:0}),f=react.useRef(null),b=react.useRef(null),v=react.useRef(null),C=react.useRef(null),N=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),T=t.some(S=>S.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&b.current){let S=b.current.getBoundingClientRect();h({top:S.bottom+6,left:S.left});}},[l]),react.useEffect(()=>{let S=X=>{let O=X.target,$=f.current?.contains(O),A=v.current?.contains(O);!$&&!A&&(c(false),p(""),m(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),react.useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let k=S=>{let X=e.some(O=>O.id===S.id);a(X?e.filter(O=>O.id!==S.id):[...e,S]);},w=async()=>{if(!(!r||!i.trim())){m(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),p(""),y(Zs[Math.floor(Math.random()*Zs.length)]||"#2E94FF"));}finally{m(false);}}},F=(S,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==S));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(S=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:S=>p(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&i.trim()&&!T&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>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:`${S.color}20`,color:S.color},onClick:X=>F(S.id,X),children:[S.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},S.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(S=>{let X=e.some(O=>O.id===S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{X||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{X||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.name}),X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!T&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Zs.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:g===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Ml({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:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Gu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(Ml,{tag:s,size:a},s.id)),o>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:["+",o]})]})}var Jo=[{name:"Azul",value:"#2E94FF",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:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function ju(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 Pb(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 Ab({className:e}){return jsxRuntime.jsxs("svg",{className:u("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 Fl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Pb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=ju(e.loggedMinutes),i=e.estimateMinutes?ju(e.estimateMinutes):null,p=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(Ab,{className:l[t]}),jsxRuntime.jsx("span",{children:p})]})}function Lb(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 ti(e){let t=Lb(e);return t!==null?String(t):e}function Ku(e){let a=ti(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ai(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 Rb(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 Ob({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function $b({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 qu({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 Hb({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 Pl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:p,className:d}){let[m,g]=react.useState(""),[y,x]=react.useState(t.estimateMinutes?ai(t.estimateMinutes):""),[h,f]=react.useState(""),[b,v]=react.useState(false),[C,N]=react.useState(false),T=react.useRef(null);react.useEffect(()=>{T.current?.focus();},[]);let k=async()=>{let I=Ku(m);if(!(I<=0||!s)){v(true);try{await s({durationMinutes:I,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{v(false);}}},w=async()=>{if(!n)return;let I=y.trim()?Ku(y):null;await n(I),N(false);},F=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("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",d),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(qu,{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:Rb(o)})]}),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($b,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(qu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:u("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(Ob,{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(Hb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:T,type:"text",value:m,onChange:I=>g(I.target.value),onKeyDown:F,placeholder:"8 (=8h), 2h 30m",className:u("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-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:k,disabled:b||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:F,placeholder:"Note (optional)",className:u("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-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ai(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),C?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&w(),I.key==="Escape"&&N(false);},onBlur:w,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?ai(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("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:u("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(I=>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:I.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:ai(I.durationMinutes)})]},I.id))})]})]})}function Gb(e){let a=ti(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function jb(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 ro({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(jb(r)),[i,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{m(true);let v=Gb(l);await o(v&&v>0?v:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(false);},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y()),v.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),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:v=>v.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":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[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:g,type:"text",value:l,onChange:v=>c(v.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border: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:i,onChange:v=>p(v.target.value),onKeyDown:h,placeholder:b?"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:y,disabled:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:d,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:b?"Quitar":"Clear"})]})]})}function _b(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 Kb(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 Ll({summary:e,showLabel:t=false,size:a="md",className:r}){let o=_b(e.health),s=Kb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function kn(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 Yb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Xb(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-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";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 Jb(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 Qb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=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",n=a?"border-white/5":"border-gray-200",l=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:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",kn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("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:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:kn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:kn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Zb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?kn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:kn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,kn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Xb(e.status,a),Yb(e.status,a)),children:Jb(e.status,t)})})]})}function Il({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Qb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",i),children:g.map(y=>jsxRuntime.jsx(Zb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),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 Cn(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 mh(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 op(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==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(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.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 gh(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 bo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:v=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:T=false,timerElapsedSeconds:k=0,onTimeLog:w,onEstimateUpdate:F,onSoldEffortUpdate:I,onTimerStart:S,onTimerStop:X,onTimerDiscard:O,blurFinancials:$=false}){let A=s==="dark",q={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)"},Z=e&&"title"in e&&!("name"in e),Ee=e,[B,_]=react.useState(e?op(e,l):null),[he,Ye]=react.useState(false),[z,re]=react.useState(false),[J,Le]=react.useState(false),[we,Oe]=react.useState(null),[Be,lt]=react.useState(new Date),[ee,ct]=react.useState(false),[pe,et]=react.useState(false),[nt,Ut]=react.useState(""),[Ce,mt]=react.useState(false),[Dt,Xe]=react.useState(false),[H,ne]=react.useState(false),[D,K]=react.useState(false),[ue,Te]=react.useState(""),V=react.useRef(null),te=react.useRef(null),[$e,Ne]=react.useState(""),He=react.useRef(null),[Fe,Ge]=react.useState(""),[ht,dt]=react.useState(false),[gt,ot]=react.useState([]),[jt,Et]=react.useState(""),[Nt,Tt]=react.useState(false),yt=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 E=op(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:E?.id,taskName:E?.name,soldEffortMinutes:E?.soldEffortMinutes,quotedMinutes:E?.quotedMinutes,effortMinutes:E?.effortMinutes,timeLoggedMinutes:E?.timeLoggedMinutes}),_(E),Te(E.description||""),Ne(E.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!ue)return;let E=setTimeout(()=>{let fe=te.current;fe&&(fe.style.height="auto",fe.style.height=`${Math.max(100,fe.scrollHeight)}px`);},50);return ()=>clearTimeout(E)},[t,ue]),react.useEffect(()=>()=>{V.current&&clearTimeout(V.current),He.current&&clearTimeout(He.current);},[]),react.useEffect(()=>{t&&yt.current&&y.length>0&&setTimeout(()=>{yt.current&&(yt.current.scrollTop=yt.current.scrollHeight);},100);},[t,y.length]);let Ot=react.useCallback(E=>{_(E),Z&&o&&Ee?o(gh(E,Ee)):r&&r(E);},[Z,Ee,o,r]),We=react.useCallback(()=>{Ye(false),re(false),Le(false),Oe(null),et(false),Ut(""),mt(false);},[]),Re=react.useCallback((E,fe)=>{if(!B)return;let je={...B,[E]:fe};Ot(je);},[B,Ot]),at=react.useCallback(()=>{let E=te.current;E&&(E.style.height="auto",E.style.height=`${Math.max(100,E.scrollHeight)}px`);},[]),ie=react.useCallback(E=>{Te(E),setTimeout(at,0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(B){let fe={...B,description:E};Ot(fe);}},800);},[B,Ot,at]),me=react.useCallback(E=>{Ne(E),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(B&&E.trim()){let fe={...B,name:E.trim()};Ot(fe);}},800);},[B,Ot]),L=react.useCallback(E=>{let fe=E.map(je=>{let tt={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:je};return je.type.startsWith("image/")&&(tt.preview=URL.createObjectURL(je)),tt});ot(je=>[...je,...fe]);},[]),j=react.useCallback(E=>{ot(fe=>{let je=fe.find(tt=>tt.id===E);return je?.preview&&URL.revokeObjectURL(je.preview),fe.filter(tt=>tt.id!==E)});},[]),Y=react.useCallback(async()=>{if(!(!B||!Fe.trim()&&gt.length===0||!x)){dt(true);try{let E=zu(Fe,f),fe=[];if(gt.length>0&&b){let je=gt.map(tt=>tt.file);fe=await b(je);}await x(B.id,Fe.trim(),E.length>0?E:void 0,fe.length>0?fe:void 0),Ge(""),gt.forEach(je=>{je.preview&&URL.revokeObjectURL(je.preview);}),ot([]);}finally{dt(false);}}},[B,Fe,gt,x,f,b]),ge=react.useCallback(()=>{if(!B||!jt.trim())return;let E=B.subtasks||[],fe={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:E.length},je=[...E,fe],tt={...B,subtasks:je};Ot(tt),Et(""),Tt(false);},[B,jt,Ot]),De=react.useCallback(E=>{if(!B?.subtasks)return;let fe=B.subtasks.map(tt=>tt.id===E?{...tt,progress:tt.progress===100?0:100}:tt),je={...B,subtasks:fe};Ot(je);},[B,Ot]),Je=react.useCallback(E=>{if(!B?.subtasks)return;let fe=B.subtasks.filter(tt=>tt.id!==E),je={...B,subtasks:fe};Ot(je);},[B,Ot]),_e=react.useCallback(E=>{let fe=typeof E=="string"?new Date(E):E,tt=new Date().getTime()-fe.getTime(),ra=Math.floor(tt/6e4),Vt=Math.floor(tt/36e5),Ua=Math.floor(tt/864e5);return ra<1?n==="es"?"Ahora":"Just now":ra<60?n==="es"?`Hace ${ra} min`:`${ra}m ago`:Vt<24?n==="es"?`Hace ${Vt}h`:`${Vt}h ago`:Ua<7?n==="es"?`Hace ${Ua}d`:`${Ua}d ago`:fe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),ze=react.useCallback(E=>{if(!B)return;let fe=B.progress||0;E==="completed"?fe=100:E==="in-progress"&&fe===0?fe=10:E==="todo"&&(fe=0);let je={...B,status:E,progress:fe};Ot(je),Ye(false);},[B,Ot]),vt=react.useCallback((E,fe)=>{if(!B)return;let je={...B,startDate:E,endDate:fe};Ot(je);},[B,Ot]),ut=react.useCallback(()=>{let E=Be.getFullYear(),fe=Be.getMonth(),je=new Date(E,fe,1),ra=new Date(E,fe+1,0).getDate(),Vt=je.getDay(),Ua=[],lr=new Date(E,fe,0).getDate();for(let ya=Vt-1;ya>=0;ya--)Ua.push({date:new Date(E,fe-1,lr-ya),isCurrentMonth:false});for(let ya=1;ya<=ra;ya++)Ua.push({date:new Date(E,fe,ya),isCurrentMonth:true});let fa=42-Ua.length;for(let ya=1;ya<=fa;ya++)Ua.push({date:new Date(E,fe+1,ya),isCurrentMonth:false});return Ua},[Be]),Wt=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),ne(false),!B||!d)return;let fe=Array.from(E.dataTransfer.files);if(fe.length!==0){K(true);try{await d(B.id,fe);}finally{K(false);}}},[B,d]),ha=react.useCallback(async E=>{if(!B||!d||!E.target.files)return;let fe=Array.from(E.target.files);if(fe.length!==0){K(true);try{await d(B.id,fe);}finally{K(false);}E.target.value="";}},[B,d]),ta=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),ne(true);},[]),U=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),ne(false);},[]),Ze=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),ye=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick: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:u("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:u("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:u("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",A?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=B.progress===100?0:100,je={...B,progress:E,status:E===100?"completed":"todo"};Ot(je);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:$e,onChange:E=>me(E.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":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:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{We(),Ye(!he);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ye(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>ze(E.id),className:u("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",B.status===E.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),Le(!J);},className:u("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:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((E,fe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},fe)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:l.length>0?l.map(E=>{let fe=B.assignees?.some(je=>je.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let je=B.assignees||[],tt;fe?tt=je.filter(ra=>ra.name!==E.name):tt=[...je,E],Re("assignees",tt);},className:u("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",fe&&(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:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",A?"text-white":"text-gray-900"),children:E.name}),fe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Oe(we?null:"start"),lt(B.startDate||new Date);},className:u("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:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Oe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("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:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,fe=new Date(E);fe.setDate(E.getDate()+1);let je=new Date(E);je.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let tt=new Date(E);tt.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let ra=new Date(E);ra.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Vt=new Date(E);Vt.setDate(E.getDate()+14);let Ua=new Date(E);return Ua.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:fe,display:fe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:je,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:tt,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ra,display:ra.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Vt,display:Vt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ua,display:Ua.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((fa,ya)=>jsxRuntime.jsxs("button",{className:u("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(we==="start"){let Hr=B.endDate&&fa.date>B.endDate?fa.date:B.endDate;vt(fa.date,Hr),Oe("end");}else {let Hr=B.startDate&&fa.date<B.startDate?fa.date:B.startDate;vt(Hr,fa.date),Oe(null);}},children:[jsxRuntime.jsx("span",{children:fa.label}),jsxRuntime.jsx("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:fa.display})]},ya))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{vt(void 0,void 0),Oe(null);},className:u("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:n==="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:u("text-xs mb-3 px-2 py-1 rounded",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:we==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="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:u("font-medium",A?"text-white":"text-gray-900"),children:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>lt(new Date),className:u("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>lt(new Date(Be.getFullYear(),Be.getMonth()-1)),className:u("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:()=>lt(new Date(Be.getFullYear(),Be.getMonth()+1)),className:u("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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ut().map((E,fe)=>{let je=E.date.toDateString()===new Date().toDateString(),tt=B.startDate?.toDateString()===E.date.toDateString(),ra=B.endDate?.toDateString()===E.date.toDateString(),Vt=tt||ra,Ua=B.startDate&&B.endDate&&E.date>=B.startDate&&E.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let lr=new Date(E.date);if(we==="start"){let fa=B.endDate&&lr>B.endDate?lr:B.endDate;vt(lr,fa),Oe("end");}else {let fa=B.startDate&&lr<B.startDate?lr:B.startDate;vt(fa,lr),Oe(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(A?"text-white":"text-gray-900"),je&&"ring-2 ring-[#2E94FF]",tt&&"bg-[#2E94FF] text-white",ra&&!tt&&"bg-[#7C3AED] text-white",Ua&&!Vt&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!Vt&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},fe)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{We(),re(!z);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&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:u("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:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{Re("priority",E.id),re(false);},className:u("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",B.priority===E.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",A?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:E=>{let fe=parseInt(E.target.value),je=B.status;fe===100?je="completed":fe>0?je="in-progress":je="todo";let tt={...B,progress:fe,status:je};Ot(tt);},onBlur:()=>ct(false),className:u("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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ct(true),className:u("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:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?Cn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Xe("estimate"),className:u("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Cn(C.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Xe("estimate"),className:u("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Dt==="estimate"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(ro,{mode:"estimate",locale:n,isDark:A,currentValue:C?.estimateMinutes||null,onSave:async E=>{await F?.(B.id,E),Xe(false);},onClose:()=>Xe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:$?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Cn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Xe("quoted"),className:u("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Cn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Xe("quoted"),className:u("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Dt==="quoted"&&!$&&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(ro,{mode:"quoted",locale:n,isDark:A,currentValue:B.quotedMinutes||null,onSave:async E=>{I?(await I(B.id,E),_(fe=>fe?{...fe,quotedMinutes:E}:null)):Re("quotedMinutes",E),Xe(false);},onClose:()=>Xe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("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:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):T?jsxRuntime.jsxs("button",{type:"button",onClick:()=>X?.(B.id),className:u("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"}),mh(k||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>S?.(B.id),className:u("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:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Xe("log"),className:u("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"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":A?"text-white":"text-gray-900"),children:[Cn(C.loggedMinutes),C.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",Cn(C.estimateMinutes)]})]}),C.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:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Dt==="log"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(ro,{mode:"log",locale:n,isDark:A,currentValue:null,onSave:async(E,fe)=>{E&&await w?.(B.id,{durationMinutes:E,note:fe,source:"manual"}),Xe(false);},onClose:()=>Xe(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(So,{selectedTags:B.tags||[],availableTags:c,onChange:E=>{Re("tags",E);},onCreateTag:i,theme:q})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(E=>{let fe=g.find(je=>je.id===E);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[fe?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let je=(B.dependencies||[]).filter(tt=>tt!==E);Re("dependencies",je);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{We(),et(!pe);},className:u("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:u("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{et(false),Ut("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:u("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:nt,onChange:E=>Ut(E.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("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:g.length>0?g.filter(E=>E.id!==B.id).filter(E=>nt===""||E.name.toLowerCase().includes(nt.toLowerCase())).map(E=>{let fe=B.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let je=B.dependencies||[],tt;fe?tt=je.filter(ra=>ra!==E.id):tt=[...je,E.id],Re("dependencies",tt);},className:u("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",fe&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",fe?"bg-blue-500 border-blue-500":A?"border-white/30":"border-gray-300"),children:fe&&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:u("block truncate",A?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),mt(!Ce);},className:u("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:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",A?"text-white":"text-gray-900"),children:Jo.find(E=>E.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("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:()=>mt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:Jo.map(E=>{let fe=B.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{Re("color",E.value),mt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",fe&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:fe?E.value:void 0},title:E.name,children:fe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:E=>Re("isMilestone",E.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.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:u("text-sm",A?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("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:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",A?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:te,value:ue,onChange:E=>ie(E.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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:u("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:u("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(E=>E.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((E,fe)=>(E.position??0)-(fe.position??0)).map(E=>jsxRuntime.jsxs("div",{className:u("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:()=>De(E.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",E.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:E.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",E.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("button",{onClick:()=>Je(E.id),className:u("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"})})]},E.id))}),Nt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:jt,onChange:E=>Et(E.target.value),onKeyDown:E=>{E.key==="Enter"&&jt.trim()?ge():E.key==="Escape"&&(Tt(false),Et(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("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-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:ge,disabled:!jt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",jt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":A?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{Tt(false),Et("");},className:u("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:()=>Tt(true),className:u("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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(E=>{let fe=ye(E.type),je=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("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:[je&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(fe,{className:u("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Ze(E.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(E.id),className:u("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:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:ta,onDragLeave:U,onDrop:Wt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?A?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ha,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="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"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("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:u("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:u("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("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'),$f=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),oy=require('react-markdown'),ny=require('remark-gfm'),sy=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var $f__default=/*#__PURE__*/_interopDefault($f);var oy__default=/*#__PURE__*/_interopDefault(oy);var ny__default=/*#__PURE__*/_interopDefault(ny);var sy__default=/*#__PURE__*/_interopDefault(sy);var js=(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 _s=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 [_s.Translate.toString(e),_s.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ks(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 Lf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function vl(e,t){return e.length===0?1e3:t===0?Ks(null,e[0].position):t>=e.length?Ks(e[e.length-1].position,null):Ks(e[t-1].position,e[t].position)}function su(e,t=100){return e>t}var If=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 Bf(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function qs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=If,onRetry:l}=t,c,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:i,success:false};let g=Bf(p,r,o,s);if(l)try{l(c,p,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Rf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Of(e,t={}){return async(...a)=>qs(()=>e(...a),t)}var wl=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 iu=(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))(iu||{}),qo=class qo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,o,c?n:""),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",...qo.globalOptions};}static configure(t){qo.globalOptions={...qo.globalOptions,...t};}child(t){return new qo({...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 Ys((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ys(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:iu[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};qo.globalOptions={};var kl=qo,Ys=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}},lu=new kl;function Hf(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 zf(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 n=e.columns.find(l=>l.id===s.columnId);return [s.id,Cl(s.title),Cl(s.description||""),Cl(n?.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 Uf(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await $f__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,p=n.width/n.height,d=c-20,m=d/p;m>i-20&&(m=i-20,d=m*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(l,"PNG",y,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Cl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function cu(e,t,a,r){switch(t){case "json":return Hf(e,r);case "csv":return zf(e);case "pdf":return await Uf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function uu(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]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Wf(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 Vf(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=pu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=pu(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.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 pu(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function mu(e,t){switch(t){case "json":return Wf(e);case "csv":return Vf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function gu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Tl=react.createContext(null);function fu(){return react.useContext(Tl)}var bu=react.createContext(null);function hu({children:e,themeName:t}){return jsxRuntime.jsx(bu.Provider,{value:{themeName:t},children:e})}function vn(){return react.useContext(bu)}function Jt({children:e,container:t}){let[a,r]=react.useState(false),o=fu(),s=vn();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var ku={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Jf="#BDC3C7",Qf=({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 Yo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,v=g.right-h;v<10&&(v=g.left),v+h>x-10&&(v=x-h-10);let T=y-g.bottom,D=g.top,N;T>=f+b?N=g.bottom+b:D>=f+b?N=g.top-f-b:N=T>=D?g.bottom+b:Math.max(10,g.top-f-b),n({top:N,left:v}),o(true);};react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?ku[e]:null,m=d?.color||Jf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(ku).map(([g,y])=>jsxRuntime.jsxs("button",{onClick:()=>p(g),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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Qf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Zf=[{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 Zn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(vn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),T=window.innerHeight,D=window.innerWidth,N=320,k=380,w=4,F=v.left;F+N>D-10&&(F=D-N-10),F<10&&(F=10);let I=T-v.bottom,S=v.top,Y;I>=k+w?Y=v.bottom+w:S>=k+w?Y=v.top-k-w:Y=I>=S?v.bottom+w:Math.max(10,v.top-k-w),l({top:Y,left:F}),s(true);};react.useEffect(()=>{let v=T=>{c.current&&!c.current.contains(T.target)&&!i.current?.contains(T.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=T=>{T.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let y=v=>{let T=new Date,D=F=>{let I=F.getFullYear(),S=String(F.getMonth()+1).padStart(2,"0"),Y=String(F.getDate()).padStart(2,"0");return `${I}-${S}-${Y}`},N=D(T),k=new Date(T);k.setDate(k.getDate()+v);let w=D(k);a(N,w),s(false);},x=()=>{if(!e||!t)return "Set date";let v=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(Y=>isNaN(Y)))return null;let F=w[0],I=w[1],S=w[2];return F===void 0||I===void 0||S===void 0?null:new Date(F,I-1,S)},T=v(e),D=v(t);if(!T||!D||isNaN(T.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[T.getMonth()]} ${T.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),v<T})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"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:m?"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:m?"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:Zf.map(v=>jsxRuntime.jsx("button",{onClick:()=>y(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>a(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>a(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Jo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),v=window.innerHeight,T=window.innerWidth,D=300,N=380,k=4,w=b.right-D;w<10&&(w=b.left),w+D>T-10&&(w=T-D-10);let F=v-b.bottom,I=b.top,S;F>=N+k?S=b.bottom+k:I>=N+k?S=b.top-N-k:S=F>=I?b.bottom+k:Math.max(10,b.top-N-k),p({top:S,left:w}),n(true);};react.useEffect(()=>{let b=v=>{d.current&&!d.current.contains(v.target)&&!m.current?.contains(v.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=v=>{v.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let v=e.some(T=>T.id===b.id);a(v?e.filter(T=>T.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(Jt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:b=>c(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(b=>{let v=e.some(T=>T.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(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 Xs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let p of i){if(!s.has(p)&&l(p))return true;if(n.has(p))return true}}return n.delete(c),false};return l(a)}function ts({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[x,h]=react.useState(null),f=react.useRef(null),b=react.useRef(null),v=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),F=window.innerHeight,I=window.innerWidth,S=300,Y=d?380:120,$=4,X=w.right-S;X<10&&(X=w.left),X+S>I-10&&(X=I-S-10);let C=F-w.bottom,G=w.top,Z;C>=Y+$?Z=w.bottom+$:G>=Y+$?Z=w.top-Y-$:Z=C>=G?w.bottom+$:Math.max(10,w.top-Y-$),y({top:Z,left:X}),c(true);};react.useEffect(()=>{if(!l||!b.current)return;let w=b.current.getBoundingClientRect(),F=window.innerHeight,I=window.innerWidth,S=300,Y=d?380:120,$=4,X=w.right-S;X<10&&(X=w.left),X+S>I-10&&(X=I-S-10);let C=F-w.bottom,G=w.top,Z;C>=Y+$?Z=w.bottom+$:G>=Y+$?Z=w.top-Y-$:Z=C>=G?w.bottom+$:Math.max(10,w.top-Y-$),y({top:Z,left:X});},[d,l]),react.useEffect(()=>{let w=F=>{f.current&&!f.current.contains(F.target)&&!b.current?.contains(F.target)&&(c(false),p(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{let w=F=>{F.key==="Escape"&&(c(false),p(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let T=w=>{let F=t.includes(w),I=a.find(S=>S.id===w);if(h(null),F){let S=t.filter(Y=>Y!==w);r(S),S.length===0&&m(false);}else {if(s&&Xs(a,w,e)){let Y=`Cannot add "${I?.title||w}" as dependency - would create circular reference`;h(Y),n?.(w,I?.title||w),setTimeout(()=>h(null),3e3);return}r([...t,w]),m(true);}},D=()=>{let w=!d;m(w),w||r([]);},N=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>l?c(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),l&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&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"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>p(w.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:N.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"}):N.map(w=>{let F=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>T(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.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:F?"#3b82f6":"transparent",borderColor:F?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:F&&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:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),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 go=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:_s.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:x,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=l.filter(T=>e.assignedUserIds?.includes(T.id)),f=e.progress===100,b=(e.attachments||[]).filter(T=>T.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:v,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:T=>{T.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:T=>{T.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[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:T=>{T.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((T,D)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:T.url,alt:T.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&b.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:["+",b.length-4]})})]},T.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:T=>T.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Yo,{priority:e.priority,onChange:T=>n?.(e.id,{priority:T})})}),jsxRuntime.jsx("div",{onClick:T=>T.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Zn,{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:(T,D)=>n?.(e.id,{startDate:T,endDate:D})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:T=>T.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Jo,{assignedUsers:h,availableUsers:l,onChange:T=>n?.(e.id,{assignedUserIds:T.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:T=>T.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(ts,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(T=>typeof T=="string"?T:T.taskId):[],availableTasks:c,onChange:T=>n?.(e.id,{dependencies:T})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(T=>jsxRuntime.jsx("span",{className:"asakaa-label",children:T},T))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(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)));go.displayName="Card";var Js={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"}},Au=({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 Lu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=[...Object.entries(Js).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Js).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Js[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Js.todo,id:"todo"}},m=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,v=180,T=280,D=4,N=h.right-v;N<10&&(N=h.left),N+v>b-10&&(N=b-v-10);let k=f-h.bottom,w=h.top,F;k>=T+D?F=h.bottom+D:w>=T+D?F=h.top-T-D:F=k>=w?h.bottom+D:Math.max(10,h.top-T-D),l({top:F,left:N}),s(true);};react.useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsxRuntime.jsx(Au,{icon:y.icon,color:x})}),o&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Au,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Iu={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 Bu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Iu[s]||Iu.en,[l,c]=react.useState(false),[i,p]=react.useState(false),[d,m]=react.useState(e),[g,y]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(l&&h.current){let D=h.current.getBoundingClientRect();y({top:D.bottom+window.scrollY+8,left:D.left+window.scrollX});}},[l]),react.useEffect(()=>{let D=N=>{x.current&&!x.current.contains(N.target)&&!h.current?.contains(N.target)&&(c(false),p(false));};if(l)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),react.useEffect(()=>{let D=N=>{N.key==="Escape"&&(c(false),p(false),m(e));};if(l)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[l,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let b=()=>{p(true),m(e);},v=()=>{let D=d.trim();D&&D!==e&&t(D),p(false),c(false),m(e);},T=D=>{D.key==="Enter"?v():D.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:D=>m(D.target.value),onKeyDown:T,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:b,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:n.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:n.delete})]})]})]})})})]})}var Cn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:v})=>{let{setNodeRef:T,isOver:D}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),N=react.useRef(null),k=p??su(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>N.current,estimateSize:()=>d,enabled:k});if(a)return jsxRuntime.jsx("div",{ref:T,className:f,children:a(e,t)});let I=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),S=I.state==="exceeded",Y=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:T,className:u("asakaa-column",D&&"ring-2 ring-asakaa-accent-blue",S&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(Y()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&I.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${I.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[I.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"})]}),I.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"})]}),I.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"})}),I.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||x)&&jsxRuntime.jsx(Bu,{columnTitle:e.title,onRename:$=>y?.(e.id,$),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:v}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!m&&jsxRuntime.jsx("div",{ref:N,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map($=>$.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):k?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map($=>{let X=t[$.index];return X?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsxRuntime.jsx(go,{card:X,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},X.id):null})}):t.map($=>jsxRuntime.jsx(go,{card:$,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},$.id))})})]})});Cn.displayName="Column";function Ml({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function xb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Uu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(i===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function vb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var kb=["\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 Wu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=react.useState(false),[v,T]=react.useState([]),[D,N]=react.useState(0),[k,w]=react.useState(null),[F,I]=react.useState(false),S=react.useRef(null),Y=react.useRef(null),$=react.useRef(null),X=react.useRef(null),C=react.useCallback((H,re)=>{let Q=xb(H,re);if(w(Q),Q){let Ee=r.filter(Te=>Te.name.toLowerCase().includes(Q.query)||Te.email&&Te.email.toLowerCase().includes(Q.query)).slice(0,5);T(Ee),b(Ee.length>0),N(0);}else b(false),T([]);},[r]),G=H=>{let re=H.target.value;if(t(re),C(re,H.target.selectionStart||0),S.current){S.current.style.height="24px";let Q=S.current.scrollHeight,Ee=280,Te=Math.min(Q,Ee);S.current.style.height=`${Te}px`,S.current.style.overflowY=Q>Ee?"auto":"hidden";}},Z=()=>{S.current&&C(e,S.current.selectionStart||0);},$e=react.useCallback(H=>{if(!k||!S.current)return;let re=e.slice(0,k.start),Q=e.slice(k.end),Ee=`@${H.name.replace(/\s+/g,"")} `,Te=re+Ee+Q;t(Te),b(false),w(null),setTimeout(()=>{if(S.current){let Ie=k.start+Ee.length;S.current.selectionStart=Ie,S.current.selectionEnd=Ie,S.current.focus();}},0);},[k,e,t]),B=H=>{if(f&&v.length>0)switch(H.key){case "ArrowDown":H.preventDefault(),N(re=>re<v.length-1?re+1:0);break;case "ArrowUp":H.preventDefault(),N(re=>re>0?re-1:v.length-1);break;case "Enter":{H.preventDefault();let re=v[D];re&&$e(re);break}case "Tab":{H.preventDefault();let re=v[D];re&&$e(re);break}case "Escape":H.preventDefault(),b(false);break}else H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),a());};react.useEffect(()=>{let H=re=>{Y.current&&!Y.current.contains(re.target)&&S.current&&!S.current.contains(re.target)&&b(false),X.current&&!X.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]);let K=react.useCallback(H=>{if(!S.current)return;let re=S.current.selectionStart||e.length,Q=e.slice(0,re)+H+e.slice(re);t(Q),I(false),setTimeout(()=>{if(S.current){let Ee=re+H.length;S.current.selectionStart=Ee,S.current.selectionEnd=Ee,S.current.focus();}},0);},[e,t]),he=react.useCallback(H=>{if(!g||!H.target.files)return;let re=Array.from(H.target.files),Q=x*1024*1024,Ee=re.filter(Te=>Te.size>Q?(console.warn(`File ${Te.name} exceeds max size of ${x}MB`),false):true);Ee.length>0&&g(Ee),H.target.value="";},[g,x]),Xe=react.useCallback(H=>H.type.startsWith("image/")?lucideReact.Image:H.type.includes("pdf")||H.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&Y.current){let H=Y.current.children[D];H&&H.scrollIntoView({block:"nearest"});}},[D,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(H=>{let re=Xe(H.file),Q=H.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[Q&&H.preview?jsxRuntime.jsx("img",{src:H.preview,alt:H.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(re,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:H.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:wb(H.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(H.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},H.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I(!F),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsx(framerMotion.motion.div,{ref:X,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:kb.map(H=>jsxRuntime.jsx("button",{type:"button",onClick:()=>K(H),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:H},H))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"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:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:S,value:e,onChange:G,onSelect:Z,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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:f&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((H,re)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>$e(H),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===D?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:H.color||"#8B5CF6"},children:vb(H.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:H.name}),H.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:H.email})]})]},H.id))})})]})]})]})}function Vu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[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((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var ai=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Fo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(false),[g,y]=react.useState(ai[10]||"#2E94FF"),[x,h]=react.useState({top:0,left:0}),f=react.useRef(null),b=react.useRef(null),v=react.useRef(null),T=react.useRef(null),D=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),N=t.some(S=>S.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&b.current){let S=b.current.getBoundingClientRect();h({top:S.bottom+6,left:S.left});}},[l]),react.useEffect(()=>{let S=Y=>{let $=Y.target,X=f.current?.contains($),C=v.current?.contains($);!X&&!C&&(c(false),p(""),m(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),react.useEffect(()=>{l&&T.current&&T.current.focus();},[l]);let k=S=>{let Y=e.some($=>$.id===S.id);a(Y?e.filter($=>$.id!==S.id):[...e,S]);},w=async()=>{if(!(!r||!i.trim())){m(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),p(""),y(ai[Math.floor(Math.random()*ai.length)]||"#2E94FF"));}finally{m(false);}}},F=(S,Y)=>{Y.stopPropagation(),a(e.filter($=>$.id!==S));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(S=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:T,type:"text",value:i,onChange:S=>p(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&i.trim()&&!N&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>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:`${S.color}20`,color:S.color},onClick:Y=>F(S.id,Y),children:[S.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},S.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(S=>{let Y=e.some($=>$.id===S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:Y?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{Y||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{Y||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.name}),Y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:ai.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:g===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Pl({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:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function ju({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(Pl,{tag:s,size:a},s.id)),o>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:["+",o]})]})}var Zo=[{name:"Azul",value:"#2E94FF",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:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function _u(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 Pb(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 Ab({className:e}){return jsxRuntime.jsxs("svg",{className:u("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 Al({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Pb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=_u(e.loggedMinutes),i=e.estimateMinutes?_u(e.estimateMinutes):null,p=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(Ab,{className:l[t]}),jsxRuntime.jsx("span",{children:p})]})}function Lb(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 oi(e){let t=Lb(e);return t!==null?String(t):e}function qu(e){let a=oi(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ni(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 Rb(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 Ob({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function $b({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 Yu({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 Hb({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 Ll({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:p,className:d}){let[m,g]=react.useState(""),[y,x]=react.useState(t.estimateMinutes?ni(t.estimateMinutes):""),[h,f]=react.useState(""),[b,v]=react.useState(false),[T,D]=react.useState(false),N=react.useRef(null);react.useEffect(()=>{N.current?.focus();},[]);let k=async()=>{let I=qu(m);if(!(I<=0||!s)){v(true);try{await s({durationMinutes:I,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{v(false);}}},w=async()=>{if(!n)return;let I=y.trim()?qu(y):null;await n(I),D(false);},F=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("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",d),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(Yu,{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:Rb(o)})]}),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($b,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Yu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:u("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(Ob,{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(Hb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:N,type:"text",value:m,onChange:I=>g(I.target.value),onKeyDown:F,placeholder:"8 (=8h), 2h 30m",className:u("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-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:k,disabled:b||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:F,placeholder:"Note (optional)",className:u("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-blue-500 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:ni(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"}),T?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&w(),I.key==="Escape"&&D(false);},onBlur:w,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?ni(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:u("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:u("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(I=>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:I.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:ni(I.durationMinutes)})]},I.id))})]})]})}function Gb(e){let a=oi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function jb(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 oo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(jb(r)),[i,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{m(true);let v=Gb(l);await o(v&&v>0?v:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(false);},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y()),v.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),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:v=>v.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":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[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:g,type:"text",value:l,onChange:v=>c(v.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border: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:i,onChange:v=>p(v.target.value),onKeyDown:h,placeholder:b?"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:y,disabled:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:d,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:b?"Quitar":"Clear"})]})]})}function _b(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 Kb(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 Bl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=_b(e.health),s=Kb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Tn(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 Yb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Xb(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-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";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 Jb(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 Qb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=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",n=a?"border-white/5":"border-gray-200",l=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:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Tn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("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:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:Tn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:Tn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Zb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Tn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Tn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Tn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Xb(e.status,a),Yb(e.status,a)),children:Jb(e.status,t)})})]})}function Rl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Qb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",i),children:g.map(y=>jsxRuntime.jsx(Zb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),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 Nn(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 mh(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 np(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==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(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.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 gh(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 bo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:v=false,timeTrackingSummary:T,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:k=0,onTimeLog:w,onEstimateUpdate:F,onSoldEffortUpdate:I,onTimerStart:S,onTimerStop:Y,onTimerDiscard:$,blurFinancials:X=false}){let C=s==="dark",G={textTertiary:C?"#6B7280":"#9CA3AF",textSecondary:C?"#9CA3AF":"#6B7280",textPrimary:C?"#FFFFFF":"#111827",borderLight:C?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:C?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:C?"#1A1D25":"#FFFFFF",bgSecondary:C?"#0A0A0A":"#F9FAFB",hoverBg:C?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},Z=e&&"title"in e&&!("name"in e),$e=e,[B,K]=react.useState(e?np(e,l):null),[he,Xe]=react.useState(false),[H,re]=react.useState(false),[Q,Ee]=react.useState(false),[Te,Ie]=react.useState(null),[Be,ot]=react.useState(new Date),[ae,nt]=react.useState(false),[fe,Ze]=react.useState(false),[xt,St]=react.useState(""),[Ce,gt]=react.useState(false),[Tt,Qe]=react.useState(false),[O,ie]=react.useState(false),[M,V]=react.useState(false),[ce,Ne]=react.useState(""),W=react.useRef(null),ee=react.useRef(null),[je,ve]=react.useState(""),He=react.useRef(null),[Me,We]=react.useState(""),[Nt,ct]=react.useState(false),[it,lt]=react.useState([]),[Vt,zt]=react.useState(""),[pt,Et]=react.useState(false),mt=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 E=np(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:E?.id,taskName:E?.name,soldEffortMinutes:E?.soldEffortMinutes,quotedMinutes:E?.quotedMinutes,effortMinutes:E?.effortMinutes,timeLoggedMinutes:E?.timeLoggedMinutes}),K(E),Ne(E.description||""),ve(E.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!ce)return;let E=setTimeout(()=>{let me=ee.current;me&&(me.style.height="auto",me.style.height=`${Math.max(100,me.scrollHeight)}px`);},50);return ()=>clearTimeout(E)},[t,ce]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),He.current&&clearTimeout(He.current);},[]),react.useEffect(()=>{t&&mt.current&&y.length>0&&setTimeout(()=>{mt.current&&(mt.current.scrollTop=mt.current.scrollHeight);},100);},[t,y.length]);let It=react.useCallback(E=>{K(E),Z&&o&&$e?o(gh(E,$e)):r&&r(E);},[Z,$e,o,r]),Ue=react.useCallback(()=>{Xe(false),re(false),Ee(false),Ie(null),Ze(false),St(""),gt(false);},[]),Re=react.useCallback((E,me)=>{if(!B)return;let _e={...B,[E]:me};It(_e);},[B,It]),dt=react.useCallback(()=>{let E=ee.current;E&&(E.style.height="auto",E.style.height=`${Math.max(100,E.scrollHeight)}px`);},[]),se=react.useCallback(E=>{Ne(E),setTimeout(dt,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(B){let me={...B,description:E};It(me);}},800);},[B,It,dt]),ue=react.useCallback(E=>{ve(E),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(B&&E.trim()){let me={...B,name:E.trim()};It(me);}},800);},[B,It]),L=react.useCallback(E=>{let me=E.map(_e=>{let at={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:_e};return _e.type.startsWith("image/")&&(at.preview=URL.createObjectURL(_e)),at});lt(_e=>[..._e,...me]);},[]),_=react.useCallback(E=>{lt(me=>{let _e=me.find(at=>at.id===E);return _e?.preview&&URL.revokeObjectURL(_e.preview),me.filter(at=>at.id!==E)});},[]),q=react.useCallback(async()=>{if(!(!B||!Me.trim()&&it.length===0||!x)){ct(true);try{let E=Uu(Me,f),me=[];if(it.length>0&&b){let _e=it.map(at=>at.file);me=await b(_e);}await x(B.id,Me.trim(),E.length>0?E:void 0,me.length>0?me:void 0),We(""),it.forEach(_e=>{_e.preview&&URL.revokeObjectURL(_e.preview);}),lt([]);}finally{ct(false);}}},[B,Me,it,x,f,b]),pe=react.useCallback(()=>{if(!B||!Vt.trim())return;let E=B.subtasks||[],me={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Vt.trim(),progress:0,startDate:new Date,endDate:new Date,position:E.length},_e=[...E,me],at={...B,subtasks:_e};It(at),zt(""),Et(false);},[B,Vt,It]),Fe=react.useCallback(E=>{if(!B?.subtasks)return;let me=B.subtasks.map(at=>at.id===E?{...at,progress:at.progress===100?0:100}:at),_e={...B,subtasks:me};It(_e);},[B,It]),Ke=react.useCallback(E=>{if(!B?.subtasks)return;let me=B.subtasks.filter(at=>at.id!==E),_e={...B,subtasks:me};It(_e);},[B,It]),Ve=react.useCallback(E=>{let me=typeof E=="string"?new Date(E):E,at=new Date().getTime()-me.getTime(),oa=Math.floor(at/6e4),Ut=Math.floor(at/36e5),Ua=Math.floor(at/864e5);return oa<1?n==="es"?"Ahora":"Just now":oa<60?n==="es"?`Hace ${oa} min`:`${oa}m ago`:Ut<24?n==="es"?`Hace ${Ut}h`:`${Ut}h ago`:Ua<7?n==="es"?`Hace ${Ua}d`:`${Ua}d ago`:me.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),ze=react.useCallback(E=>{if(!B)return;let me=B.progress||0;E==="completed"?me=100:E==="in-progress"&&me===0?me=10:E==="todo"&&(me=0);let _e={...B,status:E,progress:me};It(_e),Xe(false);},[B,It]),ht=react.useCallback((E,me)=>{if(!B)return;let _e={...B,startDate:E,endDate:me};It(_e);},[B,It]),wt=react.useCallback(()=>{let E=Be.getFullYear(),me=Be.getMonth(),_e=new Date(E,me,1),oa=new Date(E,me+1,0).getDate(),Ut=_e.getDay(),Ua=[],ir=new Date(E,me,0).getDate();for(let Na=Ut-1;Na>=0;Na--)Ua.push({date:new Date(E,me-1,ir-Na),isCurrentMonth:false});for(let Na=1;Na<=oa;Na++)Ua.push({date:new Date(E,me,Na),isCurrentMonth:true});let Ta=42-Ua.length;for(let Na=1;Na<=Ta;Na++)Ua.push({date:new Date(E,me+1,Na),isCurrentMonth:false});return Ua},[Be]),Bt=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),ie(false),!B||!d)return;let me=Array.from(E.dataTransfer.files);if(me.length!==0){V(true);try{await d(B.id,me);}finally{V(false);}}},[B,d]),ga=react.useCallback(async E=>{if(!B||!d||!E.target.files)return;let me=Array.from(E.target.files);if(me.length!==0){V(true);try{await d(B.id,me);}finally{V(false);}E.target.value="";}},[B,d]),ua=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),ie(true);},[]),z=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),ie(false);},[]),et=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),ye=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick: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:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",C?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",C?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",C?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",C?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=B.progress===100?0:100,_e={...B,progress:E,status:E===100?"completed":"todo"};It(_e);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":C?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:je,onChange:E=>ue(E.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":C?"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:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ue(),Xe(!he);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":C?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Xe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",C?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>ze(E.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",C?"hover:bg-white/5":"hover:bg-gray-50",B.status===E.id&&(C?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:C?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ue(),Ee(!Q);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",C?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((E,me)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},me)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",C?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",C?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",C?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",C?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(E=>{let me=B.assignees?.some(_e=>_e.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let _e=B.assignees||[],at;me?at=_e.filter(oa=>oa.name!==E.name):at=[..._e,E],Re("assignees",at);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",C?"hover:bg-white/5":"hover:bg-gray-50",me&&(C?"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:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",C?"text-white":"text-gray-900"),children:E.name}),me&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",C?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(Te?null:"start"),ot(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",C?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",C?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",C?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",C?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,me=new Date(E);me.setDate(E.getDate()+1);let _e=new Date(E);_e.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let at=new Date(E);at.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let oa=new Date(E);oa.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Ut=new Date(E);Ut.setDate(E.getDate()+14);let Ua=new Date(E);return Ua.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:me,display:me.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:_e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:at,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:oa,display:oa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ut,display:Ut.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ua,display:Ua.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ta,Na)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",C?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Te==="start"){let Nr=B.endDate&&Ta.date>B.endDate?Ta.date:B.endDate;ht(Ta.date,Nr),Ie("end");}else {let Nr=B.startDate&&Ta.date<B.startDate?Ta.date:B.startDate;ht(Nr,Ta.date),Ie(null);}},children:[jsxRuntime.jsx("span",{children:Ta.label}),jsxRuntime.jsx("span",{className:u("text-xs",C?"text-[#6B7280]":"text-gray-400"),children:Ta.display})]},Na))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",C?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ht(void 0,void 0),Ie(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",C?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="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:u("text-xs mb-3 px-2 py-1 rounded",C?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Te==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="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:u("font-medium",C?"text-white":"text-gray-900"),children:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>ot(new Date),className:u("p-1 rounded text-sm transition-colors",C?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ot(new Date(Be.getFullYear(),Be.getMonth()-1)),className:u("p-1 rounded",C?"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:()=>ot(new Date(Be.getFullYear(),Be.getMonth()+1)),className:u("p-1 rounded",C?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",C?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:wt().map((E,me)=>{let _e=E.date.toDateString()===new Date().toDateString(),at=B.startDate?.toDateString()===E.date.toDateString(),oa=B.endDate?.toDateString()===E.date.toDateString(),Ut=at||oa,Ua=B.startDate&&B.endDate&&E.date>=B.startDate&&E.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let ir=new Date(E.date);if(Te==="start"){let Ta=B.endDate&&ir>B.endDate?ir:B.endDate;ht(ir,Ta),Ie("end");}else {let Ta=B.startDate&&ir<B.startDate?ir:B.startDate;ht(Ta,ir),Ie(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(C?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(C?"text-white":"text-gray-900"),_e&&"ring-2 ring-[#2E94FF]",at&&"bg-[#2E94FF] text-white",oa&&!at&&"bg-[#7C3AED] text-white",Ua&&!Ut&&(C?"bg-[#7C3AED]/20":"bg-purple-100"),!Ut&&(C?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},me)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ue(),re(!H);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":C?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",C?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{Re("priority",E.id),re(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",C?"hover:bg-white/5":"hover:bg-gray-50",B.priority===E.id&&(C?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:C?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",C?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",C?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ae?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:E=>{let me=parseInt(E.target.value),_e=B.status;me===100?_e="completed":me>0?_e="in-progress":_e="todo";let at={...B,progress:me,status:_e};It(at);},onBlur:()=>nt(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",C?"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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>nt(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",C?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",C?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",C?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:T?.estimateMinutes?Nn(T.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):T?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:u("text-sm px-2 py-0.5 rounded",C?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Nn(T.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:u("text-sm",C?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Tt==="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(oo,{mode:"estimate",locale:n,isDark:C,currentValue:T?.estimateMinutes||null,onSave:async E=>{await F?.(B.id,E),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:X?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",C?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",C?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Nn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:u("text-sm px-2 py-0.5 rounded",C?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Nn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:u("text-sm",C?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Tt==="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(oo,{mode:"quoted",locale:n,isDark:C,currentValue:B.quotedMinutes||null,onSave:async E=>{I?(await I(B.id,E),K(me=>me?{...me,quotedMinutes:E}:null)):Re("quotedMinutes",E),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",C?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxRuntime.jsxs("button",{type:"button",onClick:()=>Y?.(B.id),className:u("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"}),mh(k||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>S?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",C?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",C?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Qe("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",C?"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"}),n==="es"?"Agregar tiempo":"Add time"]}),T&&T.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",T.health==="over-budget"?"text-red-500":T.health==="at-risk"?"text-yellow-500":C?"text-white":"text-gray-900"),children:[Nn(T.loggedMinutes),T.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",C?"text-[#6B7280]":"text-gray-400"),children:[" / ",Nn(T.estimateMinutes)]})]}),T.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:u("h-full rounded-full transition-all",T.health==="over-budget"?"bg-red-500":T.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,T.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Tt==="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(oo,{mode:"log",locale:n,isDark:C,currentValue:null,onSave:async(E,me)=>{E&&await w?.(B.id,{durationMinutes:E,note:me,source:"manual"}),Qe(false);},onClose:()=>Qe(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Fo,{selectedTags:B.tags||[],availableTags:c,onChange:E=>{Re("tags",E);},onCreateTag:i,theme:G})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(E=>{let me=g.find(_e=>_e.id===E);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",C?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[me?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let _e=(B.dependencies||[]).filter(at=>at!==E);Re("dependencies",_e);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ue(),Ze(!fe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",C?"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:u("text-sm",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ze(false),St("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",C?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",C?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:xt,onChange:E=>St(E.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",C?"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:g.length>0?g.filter(E=>E.id!==B.id).filter(E=>xt===""||E.name.toLowerCase().includes(xt.toLowerCase())).map(E=>{let me=B.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let _e=B.dependencies||[],at;me?at=_e.filter(oa=>oa!==E.id):at=[..._e,E.id],Re("dependencies",at);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",C?"hover:bg-white/5":"hover:bg-gray-50",me&&(C?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",me?"bg-blue-500 border-blue-500":C?"border-white/30":"border-gray-300"),children:me&&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:u("block truncate",C?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:u("text-xs",C?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",C?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ue(),gt(!Ce);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",C?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",C?"text-white":"text-gray-900"),children:Zo.find(E=>E.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",C?"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:()=>gt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",C?"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:Zo.map(E=>{let me=B.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{Re("color",E.value),gt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",me&&"ring-2 ring-offset-2",C?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:me?E.value:void 0},title:E.name,children:me&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:E=>Re("isMilestone",E.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":C?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",C?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",C?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",C?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:ee,value:ce,onChange:E=>se(E.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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",C?"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:u("mt-6 pt-4 border-t",C?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",C?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",C?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(E=>E.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((E,me)=>(E.position??0)-(me.position??0)).map(E=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",C?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Fe(E.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",E.progress===100?"bg-green-500 border-green-500":C?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",E.progress===100?"line-through text-[#6B7280]":C?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("button",{onClick:()=>Ke(E.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",C?"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"})})]},E.id))}),pt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Vt,onChange:E=>zt(E.target.value),onKeyDown:E=>{E.key==="Enter"&&Vt.trim()?pe():E.key==="Escape"&&(Et(false),zt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",C?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:pe,disabled:!Vt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Vt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":C?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{Et(false),zt("");},className:u("p-2 rounded-lg transition-colors",C?"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:()=>Et(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",C?"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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",C?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",C?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",C?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(E=>{let me=ye(E.type),_e=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",C?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[_e&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",C?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(me,{className:u("w-5 h-5",C?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",C?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:u("text-xs",C?"text-[#6B7280]":"text-gray-400"),children:et(E.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(E.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",C?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:ua,onDragLeave:z,onDrop:Bt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",O?C?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":C?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",M&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ga,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||M}),M?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",C?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",O?"text-blue-500":C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",C?"text-[#9CA3AF]":"text-gray-500"),children:O?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="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"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",C?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",C?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",C?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",C?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",C?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",C?"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: ${C?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:yt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",A?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((E,fe)=>{let je=typeof E.createdAt=="string"?new Date(E.createdAt):E.createdAt,tt=typeof fe.createdAt=="string"?new Date(fe.createdAt):fe.createdAt;return je.getTime()-tt.getTime()}).map(E=>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:E.user?.color||"#8B5CF6"},children:E.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:u("text-sm font-medium",A?"text-white":"text-gray-900"),children:E.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:_e(E.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Wu,{content:E.content,theme:s})}),E.attachments&&E.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:E.attachments.map(fe=>{let je=fe.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:fe.url,target:"_blank",rel:"noopener noreferrer",className:u("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:[je?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",A?"text-white":"text-gray-900"),children:fe.name})]},fe.id)})})]})]},E.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",A?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Uu,{value:Fe,onChange:Ge,onSubmit:Y,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:ht,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:gt,onFilesSelect:L,onRemoveFile:j})})]})]})]})})}function Rl(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function Fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:w,timerState:F,onLogTime:I,onUpdateEstimate:S,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:$,onDiscardTimer:A,blurFinancials:q=false,sidePanel:Z,renderColumnMetrics:Ee,suppressDetailModal:B=false}){let[_,he]=Rl(),[Ye,z]=react.useState(null),[re,J]=react.useState(false),Le=react.useRef(null),we=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Oe=o?.theme||"dark",Be=Oe==="dark"||Oe==="neutral",lt=Be?"dark":"",ee=react.useCallback((D,K)=>{t.onCardUpdate?.(D,K);},[t]),ct=react.useCallback((D,K)=>{t.onColumnUpdate?.(D,{title:K});},[t]),pe=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),et=["todo","in-progress","completed"],nt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Ut=react.useMemo(()=>{let D=new Map;return e.columns.forEach(K=>{let ue=K.cardIds.map(Te=>e.cards.find(V=>V.id===Te)).filter(Te=>Te!==void 0).sort((Te,V)=>Te.position-V.position);D.set(K.id,ue);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=Le.current;if(!D)return;let K=te=>{let $e=te.target,Ne=te.button===1,He=$e===D||$e.classList.contains("asakaa-column")&&!$e.closest(".asakaa-card");(Ne||te.button===0&&He&&!_.isDragging)&&(te.preventDefault(),J(true),we.current={x:te.clientX,y:te.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ue=te=>{if(!re)return;let $e=te.clientX-we.current.x,Ne=te.clientY-we.current.y;D.scrollLeft=we.current.scrollLeft-$e,D.scrollTop=we.current.scrollTop-Ne;},Te=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");},V=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",K),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Te),D.addEventListener("mouseleave",V),()=>{D.removeEventListener("mousedown",K),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Te),D.removeEventListener("mouseleave",V);}},[re,_.isDragging]);let Ce=react.useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),mt=react.useCallback(D=>{let{active:K}=D,ue=e.cards.find(Te=>Te.id===K.id);ue&&he({isDragging:true,draggedCardId:ue.id,sourceColumnId:ue.columnId,targetColumnId:ue.columnId});},[e.cards,he]),Dt=react.useCallback(D=>{let{active:K,over:ue}=D;if(!ue||!e.cards.find(te=>te.id===K.id))return;let V=null;ue.data.current?.type==="column"?V=ue.id:ue.data.current?.type==="card"&&(V=e.cards.find($e=>$e.id===ue.id)?.columnId||null),V&&V!==_.targetColumnId&&he({..._,targetColumnId:V});},[e.cards,_,he]),Xe=react.useCallback(async D=>{let{active:K,over:ue}=D;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ue)return;let Te=e.cards.find(Ne=>Ne.id===K.id);if(!Te)return;let V,te;if(ue.data.current?.type==="column"){V=ue.id;let Ne=Ut.get(V)||[];te=yl(Ne,0);}else {let Ne=e.cards.find(Ge=>Ge.id===ue.id);if(!Ne)return;V=Ne.columnId;let He=Ut.get(V)||[],Fe=He.findIndex(Ge=>Ge.id===ue.id);te=yl(He,Fe);}let $e=e.columns.find(Ne=>Ne.id===V);if($e&&$e.wipLimit&&$e.wipLimitType==="hard"){let Ne=Ut.get(V)||[];if(Te.columnId!==V&&Ne.length>=$e.wipLimit){t.onWipLimitExceeded?.($e,Te);return}}(Te.columnId!==V||Te.position!==te)&&await t.onCardMove?.(Te.id,V,te);},[e.cards,e.columns,Ut,t,he]),H=react.useCallback(D=>{B||z(D),a?.(D),C?.(D.id);},[a,C,B]),ne=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),z(D);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",lt,n),style:l,children:jsxRuntime.jsx(Dh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:u("asakaa-board",lt,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(bu,{themeName:Oe,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:nt,collisionDetection:core$1.closestCorners,onDragStart:mt,onDragOver:Dt,onDragEnd:Xe,children:[jsxRuntime.jsxs("div",{ref:Le,className:u("asakaa-board",Z?"flex-1":"",lt,n),style:{...l,cursor:re?"grabbing":void 0},"data-theme":Oe,children:[e.columns.sort((D,K)=>D.position-K.position).map(D=>{let K=Ut.get(D.id)||[],ue=!et.includes(D.id),Te=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(wn,{column:D,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ee?(V,te)=>Ee(V,te):void 0,onCardClick:H,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?ct:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:ue,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},D.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:_.draggedCardId?jsxRuntime.jsx(go,{card:e.cards.find(D=>D.id===_.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!B&&jsxRuntime.jsx(bo,{task:Ye,isOpen:!!Ye,onClose:()=>z(null),onCardUpdate:ne,theme:Be?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:Ye?g?.get(Ye.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:w,isTimerRunning:F?.isRunning,timerElapsedSeconds:F?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:S,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:$,onTimerDiscard:A,blurFinancials:q})]})}function Dh({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 Ph={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, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Ah={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:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Lh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ih={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Bh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||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((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:i.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:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Rh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{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:o}].filter(g=>g.handler),m=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!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:d.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Oh({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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function $l({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:p,toolbarEndContent:d}){let m=r==="dark"?Ph:Ah,g={...o==="es"?Lh:Ih,...i},y=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.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:m.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Rh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),d,t&&(s?jsxRuntime.jsx(Bh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsxRuntime.jsx(Oh,{onClick:()=>t(),label:a||g.newTask}))]})})}function zl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),c(""),n(false));},[l,e]),p=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(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:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,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 Qo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(false),[b,v]=react.useState(false),[C,N]=react.useState(false),[T,k]=react.useState(s||new Date),w=react.useRef(null),F=o==="es",I=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{w.current?.focus();},[]);let S=react.useCallback(()=>{f(false),v(false),N(false);},[]),X=react.useCallback(()=>{i(""),d(void 0),g(null),x(null),S(),t();},[t,S]),O=react.useCallback(()=>{let q=c.trim();if(!q)return;let Z=a.find(B=>B.id===m),Ee=y||s;e({name:q,priority:p,assignee:Z||void 0,assigneeId:m,startDate:Ee,endDate:Ee}),i(""),d(void 0),g(null),x(null),S(),w.current?.focus();},[c,p,m,y,s,a,e,S]),$=react.useCallback(q=>{q.key==="Enter"&&c.trim()&&(q.preventDefault(),O()),q.key==="Escape"&&X();},[O,X,c]),A=y||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>S(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:w,type:"text",value:c,onChange:q=>i(q.target.value),placeholder:F?"Nombre de la tarea...":"Task name...",className:u("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:$})}),jsxRuntime.jsxs("div",{className:u("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:q=>{q.stopPropagation(),f(!h),v(false),N(false);},type:"button",className:u("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:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:F?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:F?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:F?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:F?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:F?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxRuntime.jsxs("button",{onClick:()=>{d(q.id),f(false);},type:"button",className:u("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===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",q.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:q=>{q.stopPropagation(),N(!C),f(false),v(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":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"}),A.toLocaleDateString(F?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,Z=new Date(q);Z.setDate(q.getDate()+1);let Ee=new Date(q);Ee.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let B=new Date(q);B.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let _=new Date(q);_.setDate(q.getDate()+14);let he=new Date(q);he.setDate(q.getDate()+28);let Ye=F?"es-ES":"en-US";return [{label:F?"Hoy":"Today",date:q,display:q.toLocaleDateString(Ye,{weekday:"short"}).slice(0,3)+"."},{label:F?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(Ye,{weekday:"short"}).slice(0,3)+"."},{label:F?"Este fin de semana":"This weekend",date:Ee,display:F?"s\xE1b.":"sat."},{label:F?"Pr\xF3xima semana":"Next week",date:B,display:F?"lun.":"mon."},{label:F?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(Ye,{day:"numeric",month:"short"})},{label:F?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(Ye,{day:"numeric",month:"short"})}].map((re,J)=>jsxRuntime.jsxs("button",{type:"button",className:u("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:()=>{x(re.date),N(false);},children:[jsxRuntime.jsx("span",{children:re.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},J))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(F?"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:()=>k(new Date),className:u("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:F?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()-1)),className:u("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:()=>k(new Date(T.getFullYear(),T.getMonth()+1)),className:u("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:(F?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=T.getFullYear(),Z=T.getMonth(),Ee=new Date(q,Z,1).getDay(),B=new Date(q,Z+1,0).getDate(),_=new Date(q,Z,0).getDate(),he=new Date().toDateString(),Ye=[];for(let re=Ee-1;re>=0;re--)Ye.push({dayNum:_-re,isCurrent:false,date:new Date(q,Z-1,_-re)});for(let re=1;re<=B;re++)Ye.push({dayNum:re,isCurrent:true,date:new Date(q,Z,re)});let z=42-Ye.length;for(let re=1;re<=z;re++)Ye.push({dayNum:re,isCurrent:false,date:new Date(q,Z+1,re)});return Ye.map((re,J)=>{let Le=re.date.toDateString()===he,we=(y||s)?.toDateString()===re.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Le&&"ring-1 ring-[#007FFF]",we&&"bg-[#007FFF] text-white",!we&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(re.date),N(false);},children:re.dayNum},J)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),v(!b),f(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?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(q=>q.id===m)?.color||"#007FFF"},children:a.find(q=>q.id===m)?.initials||a.find(q=>q.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),v(false);},className:u("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",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("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:F?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(q.id),v(false);},className:u("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",m===q.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:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:F?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("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:F?"Guardar":"Save"})]})]})}function jl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=react.useState(false),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[y,x]=react.useState(false),h=n==="dark",b={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let C=90,N=()=>{let T=p.current.getBoundingClientRect(),w=window.innerHeight-T.bottom<C+8;x(w),g({position:"fixed",...w?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),react.useEffect(()=>{if(!c)return;let C=N=>{let T=N.target;d.current&&!d.current.contains(T)&&p.current&&!p.current.contains(T)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let v=react.useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Qo,{onSubmit:v,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var is=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(Fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
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((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function vp(e={}){return new is(e)}var Tn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName: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}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=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:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function _l(e,t){let a=r=>jsxRuntime.jsx(Tn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ql({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:p=""}){let[d,m]=react.useState(false),[g,y]=react.useState(""),[x,h]=react.useState("home"),[f,b]=react.useState(""),[v,C]=react.useState("");react.useEffect(()=>{let w=F=>{(F.metaKey||F.ctrlKey)&&F.key===i&&(F.preventDefault(),m(I=>!I)),F.key==="Escape"&&(m(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let N=react.useCallback(()=>{m(false);},[]),T=react.useCallback(w=>{let[F,I]=w.split(":");switch(F){case "create-card":h("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),N()):h("navigate");break;case "search":r?.(g),N();break;case "priority":h("priority");break;case "set-priority":v&&I&&(o?.(v,I),N());break;case "assign":h("assign");break;case "assign-user":v&&I&&(s?.(v,I),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,v,t,a,r,o,s,n,l,c,N]),k=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:T,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:T,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:T,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:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:F},F))})]},w.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let F=e.columns.find(I=>I.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:T,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:F?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},w.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,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:T,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:T,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:T,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 Cp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
18
+ `}),jsxRuntime.jsx("div",{ref:mt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",C?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((E,me)=>{let _e=typeof E.createdAt=="string"?new Date(E.createdAt):E.createdAt,at=typeof me.createdAt=="string"?new Date(me.createdAt):me.createdAt;return _e.getTime()-at.getTime()}).map(E=>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:E.user?.color||"#8B5CF6"},children:E.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:u("text-sm font-medium",C?"text-white":"text-gray-900"),children:E.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",C?"text-[#6B7280]":"text-gray-400"),children:Ve(E.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Vu,{content:E.content,theme:s})}),E.attachments&&E.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:E.attachments.map(me=>{let _e=me.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:me.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",C?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[_e?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",C?"text-white":"text-gray-900"),children:me.name})]},me.id)})})]})]},E.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",C?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",C?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",C?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Wu,{value:Me,onChange:We,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:Nt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:it,onFilesSelect:L,onRemoveFile:_})})]})]})]})})}function $l(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function Lo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onTaskOpen:T,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:k,timeEntries:w,timerState:F,onLogTime:I,onUpdateEstimate:S,onUpdateSoldEffort:Y,onStartTimer:$,onStopTimer:X,onDiscardTimer:C,blurFinancials:G=false,sidePanel:Z,renderColumnMetrics:$e,suppressDetailModal:B=false}){let[K,he]=$l(),[Xe,H]=react.useState(null),[re,Q]=react.useState(false),Ee=react.useRef(null),Te=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=o?.theme||"dark",Be=Ie==="dark"||Ie==="neutral",ot=Be?"dark":"",ae=react.useCallback((M,V)=>{t.onCardUpdate?.(M,V);},[t]),nt=react.useCallback((M,V)=>{t.onColumnUpdate?.(M,{title:V});},[t]),fe=react.useCallback(M=>{t.onColumnDelete?.(M);},[t]),Ze=["todo","in-progress","completed"],xt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),St=react.useMemo(()=>{let M=new Map;return e.columns.forEach(V=>{let ce=V.cardIds.map(Ne=>e.cards.find(W=>W.id===Ne)).filter(Ne=>Ne!==void 0).sort((Ne,W)=>Ne.position-W.position);M.set(V.id,ce);}),M},[e.cards,e.columns]);react.useEffect(()=>{let M=Ee.current;if(!M)return;let V=ee=>{let je=ee.target,ve=ee.button===1,He=je===M||je.classList.contains("asakaa-column")&&!je.closest(".asakaa-card");(ve||ee.button===0&&He&&!K.isDragging)&&(ee.preventDefault(),Q(true),Te.current={x:ee.clientX,y:ee.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},M.style.cursor="grabbing",M.style.userSelect="none");},ce=ee=>{if(!re)return;let je=ee.clientX-Te.current.x,ve=ee.clientY-Te.current.y;M.scrollLeft=Te.current.scrollLeft-je,M.scrollTop=Te.current.scrollTop-ve;},Ne=()=>{re&&(Q(false),M.style.cursor="",M.style.userSelect="");},W=()=>{re&&(Q(false),M.style.cursor="",M.style.userSelect="");};return M.addEventListener("mousedown",V),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Ne),M.addEventListener("mouseleave",W),()=>{M.removeEventListener("mousedown",V),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Ne),M.removeEventListener("mouseleave",W);}},[re,K.isDragging]);let Ce=react.useMemo(()=>e.cards.map(M=>({id:M.id,name:M.title,startDate:M.startDate?new Date(M.startDate):void 0,endDate:M.endDate?new Date(M.endDate):void 0,progress:M.progress||0,status:M.columnId,priority:M.priority?.toLowerCase(),dependencies:Array.isArray(M.dependencies)?M.dependencies.map(V=>typeof V=="string"?V:V.taskId):[]})),[e.cards]),gt=react.useCallback(M=>{let{active:V}=M,ce=e.cards.find(Ne=>Ne.id===V.id);ce&&he({isDragging:true,draggedCardId:ce.id,sourceColumnId:ce.columnId,targetColumnId:ce.columnId});},[e.cards,he]),Tt=react.useCallback(M=>{let{active:V,over:ce}=M;if(!ce||!e.cards.find(ee=>ee.id===V.id))return;let W=null;ce.data.current?.type==="column"?W=ce.id:ce.data.current?.type==="card"&&(W=e.cards.find(je=>je.id===ce.id)?.columnId||null),W&&W!==K.targetColumnId&&he({...K,targetColumnId:W});},[e.cards,K,he]),Qe=react.useCallback(async M=>{let{active:V,over:ce}=M;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ce)return;let Ne=e.cards.find(ve=>ve.id===V.id);if(!Ne)return;let W,ee;if(ce.data.current?.type==="column"){W=ce.id;let ve=St.get(W)||[];ee=vl(ve,0);}else {let ve=e.cards.find(We=>We.id===ce.id);if(!ve)return;W=ve.columnId;let He=St.get(W)||[],Me=He.findIndex(We=>We.id===ce.id);ee=vl(He,Me);}let je=e.columns.find(ve=>ve.id===W);if(je&&je.wipLimit&&je.wipLimitType==="hard"){let ve=St.get(W)||[];if(Ne.columnId!==W&&ve.length>=je.wipLimit){t.onWipLimitExceeded?.(je,Ne);return}}(Ne.columnId!==W||Ne.position!==ee)&&await t.onCardMove?.(Ne.id,W,ee);},[e.cards,e.columns,St,t,he]),O=react.useCallback(M=>{B||H(M),a?.(M),T?.(M.id);},[a,T,B]),ie=react.useCallback(M=>{t.onCardUpdate?.(M.id,M),H(M);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",ot,n),style:l,children:jsxRuntime.jsx(Dh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:u("asakaa-board",ot,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(hu,{themeName:Ie,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:xt,collisionDetection:core$1.closestCorners,onDragStart:gt,onDragOver:Tt,onDragEnd:Qe,children:[jsxRuntime.jsxs("div",{ref:Ee,className:u("asakaa-board",Z?"flex-1":"",ot,n),style:{...l,cursor:re?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((M,V)=>M.position-V.position).map(M=>{let V=St.get(M.id)||[],ce=!Ze.includes(M.id),Ne=r?.renderColumnFooter?.(M);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Cn,{column:M,cards:V,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:$e?(W,ee)=>$e(W,ee):void 0,onCardClick:O,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?nt:void 0,onColumnDelete:t.onColumnDelete?fe:void 0,isDeletable:ce,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ne]},M.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:K.draggedCardId?jsxRuntime.jsx(go,{card:e.cards.find(M=>M.id===K.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!B&&jsxRuntime.jsx(bo,{task:Xe,isOpen:!!Xe,onClose:()=>H(null),onCardUpdate:ie,theme:Be?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:Xe?g?.get(Xe.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:k,timeEntries:w,isTimerRunning:F?.isRunning,timerElapsedSeconds:F?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:S,onSoldEffortUpdate:Y,onTimerStart:$,onTimerStop:X,onTimerDiscard:C,blurFinancials:G})]})}function Dh({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 Ph={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, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Ah={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:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Lh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ih={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Bh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||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((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:i.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:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Rh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{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:o}].filter(g=>g.handler),m=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!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:d.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Oh({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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function zl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:p,toolbarEndContent:d}){let m=r==="dark"?Ph:Ah,g={...o==="es"?Lh:Ih,...i},y=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.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:m.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Rh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),d,t&&(s?jsxRuntime.jsx(Bh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsxRuntime.jsx(Oh,{onClick:()=>t(),label:a||g.newTask}))]})})}function Wl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),c(""),n(false));},[l,e]),p=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(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:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,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 en({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(false),[b,v]=react.useState(false),[T,D]=react.useState(false),[N,k]=react.useState(s||new Date),w=react.useRef(null),F=o==="es",I=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{w.current?.focus();},[]);let S=react.useCallback(()=>{f(false),v(false),D(false);},[]),Y=react.useCallback(()=>{i(""),d(void 0),g(null),x(null),S(),t();},[t,S]),$=react.useCallback(()=>{let G=c.trim();if(!G)return;let Z=a.find(B=>B.id===m),$e=y||s;e({name:G,priority:p,assignee:Z||void 0,assigneeId:m,startDate:$e,endDate:$e}),i(""),d(void 0),g(null),x(null),S(),w.current?.focus();},[c,p,m,y,s,a,e,S]),X=react.useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),$()),G.key==="Escape"&&Y();},[$,Y,c]),C=y||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>S(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:w,type:"text",value:c,onChange:G=>i(G.target.value),placeholder:F?"Nombre de la tarea...":"Task name...",className:u("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:X})}),jsxRuntime.jsxs("div",{className:u("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(),f(!h),v(false),D(false);},type:"button",className:u("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:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[{id:"urgent",label:F?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:F?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:F?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:F?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:F?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(G=>jsxRuntime.jsxs("button",{onClick:()=>{d(G.id),f(false);},type:"button",className:u("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===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("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(),D(!T),f(false),v(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":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"}),C.toLocaleDateString(F?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,Z=new Date(G);Z.setDate(G.getDate()+1);let $e=new Date(G);$e.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let B=new Date(G);B.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let K=new Date(G);K.setDate(G.getDate()+14);let he=new Date(G);he.setDate(G.getDate()+28);let Xe=F?"es-ES":"en-US";return [{label:F?"Hoy":"Today",date:G,display:G.toLocaleDateString(Xe,{weekday:"short"}).slice(0,3)+"."},{label:F?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(Xe,{weekday:"short"}).slice(0,3)+"."},{label:F?"Este fin de semana":"This weekend",date:$e,display:F?"s\xE1b.":"sat."},{label:F?"Pr\xF3xima semana":"Next week",date:B,display:F?"lun.":"mon."},{label:F?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(Xe,{day:"numeric",month:"short"})},{label:F?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(Xe,{day:"numeric",month:"short"})}].map((re,Q)=>jsxRuntime.jsxs("button",{type:"button",className:u("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:()=>{x(re.date),D(false);},children:[jsxRuntime.jsx("span",{children:re.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},Q))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:N.toLocaleDateString(F?"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:()=>k(new Date),className:u("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:F?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date(N.getFullYear(),N.getMonth()-1)),className:u("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:()=>k(new Date(N.getFullYear(),N.getMonth()+1)),className:u("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:(F?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(G=>jsxRuntime.jsx("div",{className:u("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=N.getFullYear(),Z=N.getMonth(),$e=new Date(G,Z,1).getDay(),B=new Date(G,Z+1,0).getDate(),K=new Date(G,Z,0).getDate(),he=new Date().toDateString(),Xe=[];for(let re=$e-1;re>=0;re--)Xe.push({dayNum:K-re,isCurrent:false,date:new Date(G,Z-1,K-re)});for(let re=1;re<=B;re++)Xe.push({dayNum:re,isCurrent:true,date:new Date(G,Z,re)});let H=42-Xe.length;for(let re=1;re<=H;re++)Xe.push({dayNum:re,isCurrent:false,date:new Date(G,Z+1,re)});return Xe.map((re,Q)=>{let Ee=re.date.toDateString()===he,Te=(y||s)?.toDateString()===re.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",Te&&"bg-[#007FFF] text-white",!Te&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(re.date),D(false);},children:re.dayNum},Q)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),v(!b),f(false),D(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?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===m)?.color||"#007FFF"},children:a.find(G=>G.id===m)?.initials||a.find(G=>G.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),v(false);},className:u("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",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("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:F?"Sin asignar":"Unassigned"})]}),a.map(G=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(G.id),v(false);},className:u("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",m===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:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:F?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:$,disabled:!c.trim(),type:"button",className:u("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:F?"Guardar":"Save"})]})]})}function Kl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=react.useState(false),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[y,x]=react.useState(false),h=n==="dark",b={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let T=90,D=()=>{let N=p.current.getBoundingClientRect(),w=window.innerHeight-N.bottom<T+8;x(w),g({position:"fixed",...w?{bottom:window.innerHeight-N.top+4}:{top:N.bottom+4},left:N.left,width:N.width,zIndex:9999});};return D(),window.addEventListener("scroll",D,true),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,true),window.removeEventListener("resize",D);}},[c]),react.useEffect(()=>{if(!c)return;let T=D=>{let N=D.target;d.current&&!d.current.contains(N)&&p.current&&!p.current.contains(N)&&i(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]);let v=react.useCallback(T=>{t({name:T.name,columnId:e,assigneeIds:T.assigneeId?[T.assigneeId]:void 0,startDate:T.startDate,endDate:T.endDate,priority:T.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(en,{onSubmit:v,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var cs=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 o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
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((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function wp(e={}){return new cs(e)}var Dn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName: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}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=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:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ql(e,t){let a=r=>jsxRuntime.jsx(Dn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Xl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:p=""}){let[d,m]=react.useState(false),[g,y]=react.useState(""),[x,h]=react.useState("home"),[f,b]=react.useState(""),[v,T]=react.useState("");react.useEffect(()=>{let w=F=>{(F.metaKey||F.ctrlKey)&&F.key===i&&(F.preventDefault(),m(I=>!I)),F.key==="Escape"&&(m(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(h("home"),y(""),b(""),T(""));},[d]);let D=react.useCallback(()=>{m(false);},[]),N=react.useCallback(w=>{let[F,I]=w.split(":");switch(F){case "create-card":h("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),D()):h("navigate");break;case "search":r?.(g),D();break;case "priority":h("priority");break;case "set-priority":v&&I&&(o?.(v,I),D());break;case "assign":h("assign");break;case "assign-user":v&&I&&(s?.(v,I),D());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":c?.(),D();break;case "back":h("home");break;}},[g,v,t,a,r,o,s,n,l,c,D]),k=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),D());},[f,g,t,D]);return d?jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:N,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:N,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:N,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:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:F},F))})]},w.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let F=e.columns.find(I=>I.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:F?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},w.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 Tp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
20
20
  position: fixed !important;
21
21
  inset: 0 !important;
22
22
  z-index: 2147483647 !important;
@@ -82,7 +82,7 @@
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Qh(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 Zh(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 Xl(e){return e.startsWith("image/")}function so({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((w,F)=>{F.preventDefault(),F.stopPropagation();let I=g.current.filter(O=>Xl(O.type)),S=I.findIndex(O=>O.id===w.id),X=O=>{let $=g.current.filter(q=>Xl(q.type)),A=$[O];A&&Cp(A.url,A.name,$,O,X);};Cp(w.url,w.name,I,S,X);},[]),x=react.useCallback(w=>{let F=[],I=[];return e.length+w.length>s?(I.push(`Maximum ${s} files allowed`),{valid:F,errors:I}):(w.forEach(S=>{if(S.size/1048576>r){I.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>S.type.match(O))){I.push(`${S.name} has invalid file type`);return}F.push(S);}),{valid:F,errors:I})},[e.length,s,r,o]),h=react.useCallback(async w=>{let{valid:F,errors:I}=x(w);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(F.length!==0){i(true),d(null);try{await t?.(F);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),C=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let F=Array.from(w.dataTransfer.files);h(F);},[h]),N=react.useCallback(w=>{let F=w.target.files?Array.from(w.target.files):[];h(F),m.current&&(m.current.value="");},[h]),T=react.useCallback(()=>{m.current?.click();},[]),k=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:v,onDrop:C,onClick:T,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.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:n?"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(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Xl(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:F=>y(w,F),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.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:Zh(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Qh(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(w.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"})})})]},w.id))})]})}function Jl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,v]=react.useState("details"),[C,N]=react.useState(false),[T,k]=react.useState({}),[w,F]=react.useState(""),[I,S]=react.useState(false),[X,O]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{N(false),k({}),v("details"),F(""),O({}),a();},[a]),A=react.useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),k({}),N(false));},[e.id,T,r]),q=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),Z=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),F(""));},[e.id,w,p]),Ee=react.useCallback(async()=>{if(y){S(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{S(false);}}},[e,y]),B=react.useCallback(async()=>{if(x){S(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{S(false);}}},[e,x]),_=react.useCallback(async()=>{if(h){S(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{S(false);}}},[e,h]),he={...e,...T},Ye=s.filter(z=>he.assignedUserIds?.includes(z.id));return jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:T.title??he.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:A,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:q,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:$,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>v("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>v("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),C?jsxRuntime.jsx("textarea",{value:T.description??he.description??"",onChange:z=>k({...T,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:he.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsxRuntime.jsx("select",{multiple:true,value:T.assignedUserIds??he.assignedUserIds??[],onChange:z=>{let re=Array.from(z.target.selectedOptions,J=>J.value);k({...T,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsxRuntime.jsx("option",{value:z.id,children:z.name},z.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ye.length>0?Ye.map(z=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsxRuntime.jsx("span",{children:z.name})]},z.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxRuntime.jsxs("select",{value:T.priority??he.priority??"",onChange:z=>k({...T,priority:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:he.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.labels.map(z=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:z},z)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsxRuntime.jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:he.startDate?new Date(he.startDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.startDate?new Date(he.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsxRuntime.jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:he.endDate?new Date(he.endDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??he.estimatedTime??"",onChange:z=>k({...T,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:he.dependencies&&he.dependencies.length>0?he.dependencies.map(z=>{let re=typeof z=="string"?z:z.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:he.createdAt?new Date(he.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:z=>F(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Z,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(z=>{let re=s.find(J=>J.id===z.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[re&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(z.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:z.content})]},z.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let re=s.find(J=>J.id===z.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:re?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(so,{cardId:e.id,attachments:i,onUpload:m?z=>m(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ee,disabled:I||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:I||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:_,disabled:I||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),X.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),X.assignees.map((z,re)=>{let J=s.find(Le=>Le.id===z.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:z.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},re)})]}),X.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),X.subtasks.map((z,re)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},re))]}),X.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[X.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(X.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(z=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!X.assignees&&!X.subtasks&&!X.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function ds({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=m-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ft={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:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",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:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",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(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",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(37, 99, 235, 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)"}};var iy=["LOW","MEDIUM","HIGH","URGENT"],ly=["todo","in-progress","review","done"];function ed({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:v,theme:C,onSubtasksChange:N,attachments:T=[],onUploadAttachments:k,onDeleteAttachment:w}){let F=yn(),I=C||F?.themeName||"dark",[S,X]=react.useState(e),[O,$]=react.useState(false),[A,q]=react.useState(()=>[...e?.subtasks||[]].sort((j,Y)=>(j.position??0)-(Y.position??0))),[Z,Ee]=react.useState(false),[B,_]=react.useState(""),[he,Ye]=react.useState(""),[z,re]=react.useState("all"),[J,Le]=react.useState(false),[we,Oe]=react.useState(false),[Be,lt]=react.useState(false),[ee,ct]=react.useState(false),[pe,et]=react.useState(false),[nt,Ut]=react.useState(false),Ce=react.useRef(null),mt=react.useRef(null),Dt=react.useRef(null),Xe=react.useRef(null),H=react.useRef(null),ne=react.useRef(null),D=react.useRef(null),K=react.useRef(null),ue=react.useRef(null),Te=react.useRef(null),V=react.useRef(null),te=react.useRef(null);react.useEffect(()=>{if(e&&!S){X({...e});let L=[...e.subtasks||[]].sort((j,Y)=>(j.position??0)-(Y.position??0));q(L);}else if(e&&S&&e.id!==S.id){X({...e});let L=[...e.subtasks||[]].sort((j,Y)=>(j.position??0)-(Y.position??0));q(L);}},[e,S]),react.useEffect(()=>{let L=j=>{let Y=j.target;Xe.current&&!Xe.current.contains(Y)&&Le(false),H.current&&!H.current.contains(Y)&&Oe(false),ne.current&&!ne.current.contains(Y)&&lt(false),D.current&&!D.current.contains(Y)&&ct(false);};if(J||we||Be||ee)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,we,Be,ee]),react.useEffect(()=>{if(!t)return;let L=j=>{let Y=j.target,ge=Y.tagName==="INPUT"||Y.tagName==="TEXTAREA"||Y.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||we||Be||ee||pe||nt?(Le(false),Oe(false),lt(false),ct(false),et(false),Ut(false)):ge||a();return}if(ge&&j.key!=="Escape")return;let De=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),Le(true);break;case "a":j.preventDefault(),lt(true);break;case "p":j.preventDefault(),Oe(true);break;case "l":j.preventDefault(),ct(true);break;case "d":De||(j.preventDefault(),et(true),setTimeout(()=>K.current?.focus(),0));break;case "e":De||(j.preventDefault(),Ut(true));break;case "i":j.preventDefault(),$(true),setTimeout(()=>mt.current?.focus(),0);break;case "t":j.preventDefault(),Ee(true);break;case "c":j.preventDefault(),Dt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,we,Be,ee,pe,nt]);let $e=react.useCallback(L=>{let j=L.currentTarget.textContent?.trim()||"";if(S&&j!==S.title){let Y={...S,title:j};X(Y),r?.(S.id,{title:j});}},[S,r]),Ne=react.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=S?.title||"",L.currentTarget.blur());},[S]),He=react.useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),$(false);},[S,e,r]),Fe=react.useCallback(L=>{if(S){let j={...S,columnId:L};X(j),r?.(S.id,{columnId:L}),Le(false);}},[S,r]),Ge=react.useCallback(L=>{if(S){let j={...S,priority:L};X(j),r?.(S.id,{priority:L}),Oe(false);}},[S,r]),ht=react.useCallback(L=>{if(S){let j=S.assignedUserIds||[],Y=j.includes(L)?j.filter(De=>De!==L):[...j,L],ge={...S,assignedUserIds:Y};X(ge),r?.(S.id,{assignedUserIds:Y});}},[S,r]),dt=react.useCallback(L=>{if(S){let j=S.labels||[],Y=j.includes(L)?j.filter(De=>De!==L):[...j,L],ge={...S,labels:Y};X(ge),r?.(S.id,{labels:Y});}},[S,r]),gt=react.useCallback(L=>{if(S){let j={...S,tags:L};X(j),r?.(S.id,{tags:L});}},[S,r]),ot=react.useCallback(L=>{if(S){let j=L.target.value,Y={...S,endDate:j};X(Y),r?.(S.id,{endDate:j}),et(false);}},[S,r]),jt=react.useCallback(L=>{if(S){let j={...S,estimatedTime:parseFloat(L)||0};X(j),r?.(S.id,{estimatedTime:parseFloat(L)||0});}},[S,r]),Et=react.useCallback(()=>{if(B.trim()&&S){let L={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:A.length,createdAt:new Date},j=[...A,L];q(j),_(""),Ee(false),N?.(S.id,j);}},[B,A,S,N]),Nt=react.useCallback(L=>{let j=A.map(Y=>Y.id===L?{...Y,completed:!Y.completed,updatedAt:new Date}:Y);q(j),S&&N?.(S.id,j);},[A,S,N]),Tt=react.useCallback(L=>{let j=A.filter(Y=>Y.id!==L);q(j),S&&N?.(S.id,j);},[A,S,N]),yt=react.useCallback(()=>{he.trim()&&S&&c&&(c(S.id,he.trim()),Ye(""));},[he,S,c]),Ot=react.useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),yt());},[yt]),We=L=>jsxRuntime.jsx(oy__default.default,{remarkPlugins:[ny__default.default],rehypePlugins:[sy__default.default],components:{a:({node:j,...Y})=>jsxRuntime.jsx("a",{...Y,target:"_blank",rel:"noopener noreferrer"})},children:L}),Re=l.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let at=S||e,ie=s.filter(L=>at.assignedUserIds?.includes(L.id)),me=A.filter(L=>L.completed).length;return jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:$e,onKeyDown:Ne,children:at.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Xe,children:[jsxRuntime.jsxs("button",{ref:ue,className:"modal-v2-field",onClick:()=>Le(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:at.columnId||"No status"})]}),jsxRuntime.jsx(ds,{triggerRef:ue,isOpen:J,onClose:()=>Le(false),width:250,estimatedHeight:200,children:(y.length>0?y:ly.map(L=>({id:L,title:L}))).map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${at.columnId===L.id?"active":""}`,onClick:()=>Fe(L.id),children:L.title},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>lt(!Be),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ie.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ie.map(L=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ds,{triggerRef:Te,isOpen:Be,onClose:()=>lt(false),width:280,estimatedHeight:300,children:s.map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${at.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ht(L.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,at.assignedUserIds?.includes(L.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxRuntime.jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>Oe(!we),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:at.priority||"None"})]}),jsxRuntime.jsxs(ds,{triggerRef:V,isOpen:we,onClose:()=>Oe(false),width:180,estimatedHeight:220,children:[iy.map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${at.priority===L?"active":""}`,onClick:()=>Ge(L),children:L},L)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ge(""),children:"None"})]})]}),h.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(So,{selectedTags:at.tags||[],availableTags:h,onChange:gt,onCreateTag:f,theme:ft[I]||ft.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>ct(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:at.labels&&at.labels.length>0?jsxRuntime.jsx("span",{children:at.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ds,{triggerRef:te,isOpen:ee,onClose:()=>ct(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${at.labels?.includes(L)?"active":""}`,onClick:()=>dt(L),children:[L,at.labels?.includes(L)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},L))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{et(!pe),setTimeout(()=>K.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:at.endDate?new Date(at.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:K,type:"date",value:typeof at.endDate=="string"?at.endDate.split("T")[0]:at.endDate?(()=>{let L=new Date(at.endDate),j=L.getUTCFullYear(),Y=String(L.getUTCMonth()+1).padStart(2,"0"),ge=String(L.getUTCDate()).padStart(2,"0");return `${j}-${Y}-${ge}`})():"",onChange:ot,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ut(!nt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:at.estimatedTime?`${at.estimatedTime}h`:"Not set"})]}),nt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:at.estimatedTime||"",onChange:L=>jt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ut(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:at.description||"",onChange:L=>{if(S){let j={...S,description:L.target.value};X(j);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>$(true),children:at.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:We(at.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),A.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[me,"/",A.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ee(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[A.map(L=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Nt(L.id),children:L.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:L.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Tt(L.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},L.id)),Z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:L=>_(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Et(),L.key==="Escape"&&(Ee(false),_(""));},onBlur:Et,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||T.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),T.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:T.length})]}),jsxRuntime.jsx(so,{cardId:at.id,attachments:T,onUpload:k?L=>k(at.id,L):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Dt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:L=>Ye(L.target.value),onKeyDown:Ot,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:yt,disabled:!he.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Re.map(L=>{let j=s.find(ge=>ge.id===L.userId);if(L.type.includes("COMMENT")){let ge=n.find(De=>De.id===L.metadata?.commentId);return ge?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[j&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:j.color},children:j.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:j?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ge.content})]})]},L.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),Re.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function hy({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 ad({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height: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(hy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",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((n,l)=>n+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.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:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Dy({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 rd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Dy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var By={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Ap=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ry({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Lp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function od({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||By[c.name]||Ap[e.indexOf(c)%Ap.length]})),l=n.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?Ry:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Lp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(Lp,{})}),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:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var gi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),l(false);},h=C=>{r.onBulkMove?.(y,C),i(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let N=new Set;e.forEach(k=>{k.labels?.forEach(w=>N.add(w));});let T=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(y,{labels:T}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(C.id),children:C.title},C.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});gi.displayName="BulkOperationsToolbar";function Uy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function nd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Uy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Fo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let p=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Fo,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.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 sd=[{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 id({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=sd.find(i=>i.value===e)||sd[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:u("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:sd.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var cs=[{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 Gy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function $p(e={}){let{shortcuts:t=cs,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),l=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Gy(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function _y(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ky(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 qy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ky(e),r=t?_y(t):"";return a?`${a} + ${r}`:r}function Yy(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 ld({shortcuts:e=cs,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Yy(e);return jsxRuntime.jsxs("div",{className:u("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(n).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:qy(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var dd=[{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
+ `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Qh(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 Zh(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 Ql(e){return e.startsWith("image/")}function io({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((w,F)=>{F.preventDefault(),F.stopPropagation();let I=g.current.filter($=>Ql($.type)),S=I.findIndex($=>$.id===w.id),Y=$=>{let X=g.current.filter(G=>Ql(G.type)),C=X[$];C&&Tp(C.url,C.name,X,$,Y);};Tp(w.url,w.name,I,S,Y);},[]),x=react.useCallback(w=>{let F=[],I=[];return e.length+w.length>s?(I.push(`Maximum ${s} files allowed`),{valid:F,errors:I}):(w.forEach(S=>{if(S.size/1048576>r){I.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>S.type.match($))){I.push(`${S.name} has invalid file type`);return}F.push(S);}),{valid:F,errors:I})},[e.length,s,r,o]),h=react.useCallback(async w=>{let{valid:F,errors:I}=x(w);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(F.length!==0){i(true),d(null);try{await t?.(F);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),T=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let F=Array.from(w.dataTransfer.files);h(F);},[h]),D=react.useCallback(w=>{let F=w.target.files?Array.from(w.target.files):[];h(F),m.current&&(m.current.value="");},[h]),N=react.useCallback(()=>{m.current?.click();},[]),k=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:v,onDrop:T,onClick:N,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.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:n?"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(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ql(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:F=>y(w,F),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.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:Zh(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Qh(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(w.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"})})})]},w.id))})]})}function Zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,v]=react.useState("details"),[T,D]=react.useState(false),[N,k]=react.useState({}),[w,F]=react.useState(""),[I,S]=react.useState(false),[Y,$]=react.useState({});if(!t||!e)return null;let X=react.useCallback(()=>{D(false),k({}),v("details"),F(""),$({}),a();},[a]),C=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),k({}),D(false));},[e.id,N,r]),G=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),X());},[e.id,o,X]),Z=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),F(""));},[e.id,w,p]),$e=react.useCallback(async()=>{if(y){S(true);try{let H=await y(e);$(re=>({...re,assignees:H}));}catch(H){console.error("Failed to suggest assignee:",H);}finally{S(false);}}},[e,y]),B=react.useCallback(async()=>{if(x){S(true);try{let H=await x(e);$(re=>({...re,subtasks:H}));}catch(H){console.error("Failed to generate subtasks:",H);}finally{S(false);}}},[e,x]),K=react.useCallback(async()=>{if(h){S(true);try{let H=await h(e);$(re=>({...re,effort:H}));}catch(H){console.error("Failed to estimate effort:",H);}finally{S(false);}}},[e,h]),he={...e,...N},Xe=s.filter(H=>he.assignedUserIds?.includes(H.id));return jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:X,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:N.title??he.title,onChange:H=>k({...N,title:H.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:C,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:G,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:X,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>v("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>v("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),T?jsxRuntime.jsx("textarea",{value:N.description??he.description??"",onChange:H=>k({...N,description:H.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:he.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??he.assignedUserIds??[],onChange:H=>{let re=Array.from(H.target.selectedOptions,Q=>Q.value);k({...N,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(H=>jsxRuntime.jsx("option",{value:H.id,children:H.name},H.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Xe.length>0?Xe.map(H=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:H.color},children:H.initials}),jsxRuntime.jsx("span",{children:H.name})]},H.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),T?jsxRuntime.jsxs("select",{value:N.priority??he.priority??"",onChange:H=>k({...N,priority:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:he.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.labels.map(H=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:H},H)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),T?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:he.startDate?new Date(he.startDate).toISOString().split("T")[0]:"",onChange:H=>k({...N,startDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.startDate?new Date(he.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:he.endDate?new Date(he.endDate).toISOString().split("T")[0]:"",onChange:H=>k({...N,endDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??he.estimatedTime??"",onChange:H=>k({...N,estimatedTime:H.target.value?parseFloat(H.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:he.dependencies&&he.dependencies.length>0?he.dependencies.map(H=>{let re=typeof H=="string"?H:H.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:he.createdAt?new Date(he.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:H=>F(H.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Z,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(H=>{let re=s.find(Q=>Q.id===H.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[re&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(H.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(H.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:H.content})]},H.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(H=>{let re=s.find(Q=>Q.id===H.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("COMMENT")&&"\u{1F4AC}",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",H.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:re?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(io,{cardId:e.id,attachments:i,onUpload:m?H=>m(e.id,H):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:$e,disabled:I||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:I||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:K,disabled:I||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),Y.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),Y.assignees.map((H,re)=>{let Q=s.find(Ee=>Ee.id===H.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Q.color},children:Q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Q?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:H.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(H.confidence*100).toFixed(0),"%"]})]})]},re)})]}),Y.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),Y.subtasks.map((H,re)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:H.title}),H.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:H.description}),H.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",H.estimatedTime,"h"]})]},re))]}),Y.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[Y.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(Y.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(H=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${H.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:H.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:H.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:H.description}),H.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",H.suggestedAction]})]},H.id))]}),!Y.assignees&&!Y.subtasks&&!Y.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function ps({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=m-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ft={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:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",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:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",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(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",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(37, 99, 235, 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)"}};var iy=["LOW","MEDIUM","HIGH","URGENT"],ly=["todo","in-progress","review","done"];function ad({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:v,theme:T,onSubtasksChange:D,attachments:N=[],onUploadAttachments:k,onDeleteAttachment:w}){let F=vn(),I=T||F?.themeName||"dark",[S,Y]=react.useState(e),[$,X]=react.useState(false),[C,G]=react.useState(()=>[...e?.subtasks||[]].sort((_,q)=>(_.position??0)-(q.position??0))),[Z,$e]=react.useState(false),[B,K]=react.useState(""),[he,Xe]=react.useState(""),[H,re]=react.useState("all"),[Q,Ee]=react.useState(false),[Te,Ie]=react.useState(false),[Be,ot]=react.useState(false),[ae,nt]=react.useState(false),[fe,Ze]=react.useState(false),[xt,St]=react.useState(false),Ce=react.useRef(null),gt=react.useRef(null),Tt=react.useRef(null),Qe=react.useRef(null),O=react.useRef(null),ie=react.useRef(null),M=react.useRef(null),V=react.useRef(null),ce=react.useRef(null),Ne=react.useRef(null),W=react.useRef(null),ee=react.useRef(null);react.useEffect(()=>{if(e&&!S){Y({...e});let L=[...e.subtasks||[]].sort((_,q)=>(_.position??0)-(q.position??0));G(L);}else if(e&&S&&e.id!==S.id){Y({...e});let L=[...e.subtasks||[]].sort((_,q)=>(_.position??0)-(q.position??0));G(L);}},[e,S]),react.useEffect(()=>{let L=_=>{let q=_.target;Qe.current&&!Qe.current.contains(q)&&Ee(false),O.current&&!O.current.contains(q)&&Ie(false),ie.current&&!ie.current.contains(q)&&ot(false),M.current&&!M.current.contains(q)&&nt(false);};if(Q||Te||Be||ae)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[Q,Te,Be,ae]),react.useEffect(()=>{if(!t)return;let L=_=>{let q=_.target,pe=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(_.key==="Escape"){_.preventDefault(),Q||Te||Be||ae||fe||xt?(Ee(false),Ie(false),ot(false),nt(false),Ze(false),St(false)):pe||a();return}if(pe&&_.key!=="Escape")return;let Fe=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),Ee(true);break;case "a":_.preventDefault(),ot(true);break;case "p":_.preventDefault(),Ie(true);break;case "l":_.preventDefault(),nt(true);break;case "d":Fe||(_.preventDefault(),Ze(true),setTimeout(()=>V.current?.focus(),0));break;case "e":Fe||(_.preventDefault(),St(true));break;case "i":_.preventDefault(),X(true),setTimeout(()=>gt.current?.focus(),0);break;case "t":_.preventDefault(),$e(true);break;case "c":_.preventDefault(),Tt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,Q,Te,Be,ae,fe,xt]);let je=react.useCallback(L=>{let _=L.currentTarget.textContent?.trim()||"";if(S&&_!==S.title){let q={...S,title:_};Y(q),r?.(S.id,{title:_});}},[S,r]),ve=react.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=S?.title||"",L.currentTarget.blur());},[S]),He=react.useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),X(false);},[S,e,r]),Me=react.useCallback(L=>{if(S){let _={...S,columnId:L};Y(_),r?.(S.id,{columnId:L}),Ee(false);}},[S,r]),We=react.useCallback(L=>{if(S){let _={...S,priority:L};Y(_),r?.(S.id,{priority:L}),Ie(false);}},[S,r]),Nt=react.useCallback(L=>{if(S){let _=S.assignedUserIds||[],q=_.includes(L)?_.filter(Fe=>Fe!==L):[..._,L],pe={...S,assignedUserIds:q};Y(pe),r?.(S.id,{assignedUserIds:q});}},[S,r]),ct=react.useCallback(L=>{if(S){let _=S.labels||[],q=_.includes(L)?_.filter(Fe=>Fe!==L):[..._,L],pe={...S,labels:q};Y(pe),r?.(S.id,{labels:q});}},[S,r]),it=react.useCallback(L=>{if(S){let _={...S,tags:L};Y(_),r?.(S.id,{tags:L});}},[S,r]),lt=react.useCallback(L=>{if(S){let _=L.target.value,q={...S,endDate:_};Y(q),r?.(S.id,{endDate:_}),Ze(false);}},[S,r]),Vt=react.useCallback(L=>{if(S){let _={...S,estimatedTime:parseFloat(L)||0};Y(_),r?.(S.id,{estimatedTime:parseFloat(L)||0});}},[S,r]),zt=react.useCallback(()=>{if(B.trim()&&S){let L={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:C.length,createdAt:new Date},_=[...C,L];G(_),K(""),$e(false),D?.(S.id,_);}},[B,C,S,D]),pt=react.useCallback(L=>{let _=C.map(q=>q.id===L?{...q,completed:!q.completed,updatedAt:new Date}:q);G(_),S&&D?.(S.id,_);},[C,S,D]),Et=react.useCallback(L=>{let _=C.filter(q=>q.id!==L);G(_),S&&D?.(S.id,_);},[C,S,D]),mt=react.useCallback(()=>{he.trim()&&S&&c&&(c(S.id,he.trim()),Xe(""));},[he,S,c]),It=react.useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),mt());},[mt]),Ue=L=>jsxRuntime.jsx(oy__default.default,{remarkPlugins:[ny__default.default],rehypePlugins:[sy__default.default],components:{a:({node:_,...q})=>jsxRuntime.jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:L}),Re=l.filter(L=>H==="comments"?L.type.includes("COMMENT"):H==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let dt=S||e,se=s.filter(L=>dt.assignedUserIds?.includes(L.id)),ue=C.filter(L=>L.completed).length;return jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:je,onKeyDown:ve,children:dt.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Qe,children:[jsxRuntime.jsxs("button",{ref:ce,className:"modal-v2-field",onClick:()=>Ee(!Q),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:dt.columnId||"No status"})]}),jsxRuntime.jsx(ps,{triggerRef:ce,isOpen:Q,onClose:()=>Ee(false),width:250,estimatedHeight:200,children:(y.length>0?y:ly.map(L=>({id:L,title:L}))).map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${dt.columnId===L.id?"active":""}`,onClick:()=>Me(L.id),children:L.title},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ie,children:[jsxRuntime.jsxs("button",{ref:Ne,className:"modal-v2-field",onClick:()=>ot(!Be),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:se.map(L=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ps,{triggerRef:Ne,isOpen:Be,onClose:()=>ot(false),width:280,estimatedHeight:300,children:s.map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${dt.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>Nt(L.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,dt.assignedUserIds?.includes(L.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:O,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ie(!Te),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:dt.priority||"None"})]}),jsxRuntime.jsxs(ps,{triggerRef:W,isOpen:Te,onClose:()=>Ie(false),width:180,estimatedHeight:220,children:[iy.map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${dt.priority===L?"active":""}`,onClick:()=>We(L),children:L},L)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>We(""),children:"None"})]})]}),h.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Fo,{selectedTags:dt.tags||[],availableTags:h,onChange:it,onCreateTag:f,theme:ft[I]||ft.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:M,children:[jsxRuntime.jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>nt(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:dt.labels&&dt.labels.length>0?jsxRuntime.jsx("span",{children:dt.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ps,{triggerRef:ee,isOpen:ae,onClose:()=>nt(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${dt.labels?.includes(L)?"active":""}`,onClick:()=>ct(L),children:[L,dt.labels?.includes(L)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},L))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Ze(!fe),setTimeout(()=>V.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:dt.endDate?new Date(dt.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:V,type:"date",value:typeof dt.endDate=="string"?dt.endDate.split("T")[0]:dt.endDate?(()=>{let L=new Date(dt.endDate),_=L.getUTCFullYear(),q=String(L.getUTCMonth()+1).padStart(2,"0"),pe=String(L.getUTCDate()).padStart(2,"0");return `${_}-${q}-${pe}`})():"",onChange:lt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>St(!xt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:dt.estimatedTime?`${dt.estimatedTime}h`:"Not set"})]}),xt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:dt.estimatedTime||"",onChange:L=>Vt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>St(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:dt.description||"",onChange:L=>{if(S){let _={...S,description:L.target.value};Y(_);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>X(true),children:dt.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ue(dt.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ue,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>$e(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[C.map(L=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>pt(L.id),children:L.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:L.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Et(L.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},L.id)),Z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:L=>K(L.target.value),onKeyDown:L=>{L.key==="Enter"&&zt(),L.key==="Escape"&&($e(false),K(""));},onBlur:zt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(io,{cardId:dt.id,attachments:N,onUpload:k?L=>k(dt.id,L):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:L=>Xe(L.target.value),onKeyDown:It,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:mt,disabled:!he.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Re.map(L=>{let _=s.find(pe=>pe.id===L.userId);if(L.type.includes("COMMENT")){let pe=n.find(Fe=>Fe.id===L.metadata?.commentId);return pe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:_?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:pe.content})]})]},L.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:_?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),Re.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function hy({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 od({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height: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(hy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",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((n,l)=>n+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.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:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Dy({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 nd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Dy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var By={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Lp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ry({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ip({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function sd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||By[c.name]||Lp[e.indexOf(c)%Lp.length]})),l=n.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?Ry:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ip,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(Ip,{})}),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:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var hi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let y=e.map(T=>T.id),x=T=>{r.onBulkUpdate?.(y,{priority:T}),l(false);},h=T=>{r.onBulkMove?.(y,T),i(false),a();},f=T=>{r.onBulkUpdate?.(y,{assignedUserIds:T}),d(false);},b=T=>{let D=new Set;e.forEach(k=>{k.labels?.forEach(w=>D.add(w));});let N=Array.from(new Set([...D,...T]));r.onBulkUpdate?.(y,{labels:N}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(T),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(T.id),children:T.title},T.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([T.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([T]),children:T},T))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});hi.displayName="BulkOperationsToolbar";function Uy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function id({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Uy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Lo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let p=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Lo,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.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 ld=[{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 dd({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=ld.find(i=>i.value===e)||ld[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:u("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:ld.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var ms=[{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 Gy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function Hp(e={}){let{shortcuts:t=ms,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),l=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Gy(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function _y(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ky(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 qy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ky(e),r=t?_y(t):"";return a?`${a} + ${r}`:r}function Yy(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 cd({shortcuts:e=ms,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Yy(e);return jsxRuntime.jsxs("div",{className:u("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(n).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:qy(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var ud=[{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 cd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("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(([i,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:i})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function pd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await du(e,c,x);cu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await mu(h),b=h.name.endsWith(".json")?"json":"csv",v=pu(f,b);d(v),v.success&&r&&r(v,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:u("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:()=>l("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="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:m,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.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:u("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:u("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((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var ex=["URGENT","HIGH","MEDIUM","LOW"],tx=[{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"}],ax=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function md({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=react.useState(true),f=react.useCallback(T=>{a({search:T.target.value});},[a]),b=react.useCallback(T=>{a({dateFilter:T.target.value});},[a]),v=react.useCallback(T=>{r({by:T.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=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 ${m?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&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"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,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:T=>{let k=T.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ex.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let k=T.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsxRuntime.jsx("option",{value:T.id,children:T.name},T.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let k=T.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:tx.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:T=>y(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ax.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function gd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var fd={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:"#2E94FF",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"}},bd={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:"#2E94FF",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"}},hd={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"}},tn={dark:fd,light:bd,neutral:hd},bi="dark";var hi=react.createContext(void 0),px="asakaa-theme";function Up({children:e,defaultTheme:t=bi,storageKey:a=px}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=tn[r];Object.entries(c.colors).forEach(([p,d])=>{d&&l.style.setProperty(`--theme-${mx(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let m=c.colors[p];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:tn};return jsxRuntime.jsx(hi.Provider,{value:n,children:e})}function En(){let e=react.useContext(hi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function mx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function yd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=En();return e?jsxRuntime.jsxs("div",{className:u("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(tn).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/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:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.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}function Wp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ft[e]||ft.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ft[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ft[e].bgSecondary),bgGrid:r("--theme-bg-card",ft[e].bgGrid),bgWeekend:r("--theme-bg-hover",ft[e].bgWeekend),border:r("--theme-border-primary",ft[e].border),borderLight:r("--theme-border-subtle",ft[e].borderLight),textPrimary:r("--theme-text-primary",ft[e].textPrimary),textSecondary:r("--theme-text-secondary",ft[e].textSecondary),textTertiary:r("--theme-text-tertiary",ft[e].textTertiary),accent:r("--theme-accent-primary",ft[e].accent),accentHover:r("--theme-accent-hover",ft[e].accentHover),accentLight:r("--theme-accent-primary",ft[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ft[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ft[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ft[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ft[e].dependency),dependencyHover:r("--theme-border-secondary",ft[e].dependencyHover),criticalPath:r("--theme-error",ft[e].criticalPath),criticalPathLight:r("--theme-error",ft[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ft[e].today):e==="neutral"?r("--theme-text-primary",ft[e].today):r("--theme-error",ft[e].today),todayLight:e==="light"?r("--theme-accent-primary",ft[e].todayLight):e==="neutral"?r("--theme-text-primary",ft[e].todayLight):r("--theme-error",ft[e].todayLight),milestone:r("--theme-warning",ft[e].milestone),milestoneLight:r("--theme-warning",ft[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ft[e].statusTodo),statusInProgress:r("--theme-accent-primary",ft[e].statusInProgress),statusCompleted:r("--theme-success",ft[e].statusCompleted),hoverBg:r("--theme-bg-hover",ft[e].hoverBg),focusRing:r("--theme-accent-primary",ft[e].focusRing),...ft[e].dotGrid&&{dotGrid:ft[e].dotGrid},...ft[e].glassHeader&&{glassHeader:ft[e].glassHeader},...ft[e].glassToolbar&&{glassToolbar:ft[e].glassToolbar},...ft[e].forecastHud&&{forecastHud:ft[e].forecastHud},...ft[e].neonRedGlow&&{neonRedGlow:ft[e].neonRedGlow},...ft[e].executionBarBg&&{executionBarBg:ft[e].executionBarBg}}}var yi={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Vp={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"}},xd={en:yi,es:Vp};function Gp(e){return xd[e]||xd.en}function vd(e,t){let a=Gp(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 Fn=react.createContext(yi);function Br(){return react.useContext(Fn)}function ms(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function Zp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,p]=react.useState(null),d=react.useRef(null),m=react.useRef(null),g=Br(),y=ms(d,l,"right",176);if(react.useEffect(()=>{if(!l)return;let b=v=>{let C=v.target;d.current&&!d.current.contains(C)&&m.current&&!m.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,v)=>{if(v){p(b);try{await v();}catch(C){console.error(`Export ${b} failed:`,C);}finally{p(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref: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-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:h.map((b,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(b.id,b.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===b.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"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function _p({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[c,i]=react.useState(null),[p,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),y=Br(),x=ms(m,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let N=T=>{let k=T.target;m.current&&!m.current.contains(k)&&g.current&&!g.current.contains(k)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),v=async(N,T)=>{if(T){i(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{i(null),l(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:b.map((N,T)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(N.id,N.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:T*.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===N.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"})}):N.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),b.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b.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?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Rx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Ox({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.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:o.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}})]},o.value)})})}function Kp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=Br(),i=ms(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.current.contains(y)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,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:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((m,g)=>{let y=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:m.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function qp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=Br(),p=ms(l,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),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:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"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:g?"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:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"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?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function $x({value:e,onChange:t,theme:a}){let r=Br(),o=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:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Hx({theme:e,forecast:t}){let a=Br(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,l=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},i=t?.confidencePercent,p=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.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:g}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function zx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=react.useState(false),y=react.useRef(null),x=react.useRef(null),h=Br(),f=ms(y,m,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let T=k=>{let w=k.target;y.current&&!y.current.contains(w)&&x.current&&!x.current.contains(w)&&g(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[m]);let v=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],N=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:y,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.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:[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.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:C.map((T,k)=>{let w=T.icon,F=T.disabled,I=T.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!F&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:F?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:F?"not-allowed":"pointer"},whileHover:F?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:I,children:[jsxRuntime.jsx(w,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:F?b?"rgba(255,255,255,0.2)":"#D1D5DB":T.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.label}),T.active&&!F&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((T,k)=>{let w=i===T.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(T.value),className:"w-full flex items-center justify-between 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:(C.length+k)*.03},children:[jsxRuntime.jsx("span",{style:{color:w?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:T.label}),w&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.value)})]})]})}),document.body)]})}function xi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:v,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:T,projectForecast:k,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportCSV:S,onExportJSON:X,onExportMSProject:O,showCriticalPath:$=true,onShowCriticalPathChange:A,showDependencies:q=true,onShowDependenciesChange:Z,highlightWeekends:Ee=true,onHighlightWeekendsChange:B,showBaseline:_=false,onShowBaselineChange:he,onCopySnapshotLink:Ye,hasDependencies:z=true}){let re=Br(),J=w||F||I||S||X||O,Le=!!e.glassToolbar,[we,Oe]=react.useState(false),Be=react.useRef(null);react.useEffect(()=>{we&&Be.current&&Be.current.focus();},[we]);let lt=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ee=[{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"})}],ct=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Le){let pe=ct?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:ct?"#1A1A1A":e.bgSecondary,border:`1px solid ${ct?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Oe(!we),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),we&&jsxRuntime.jsx("input",{ref:Be,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Oe(false),onKeyDown:et=>{et.key==="Escape"&&Oe(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),T&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ct?"#000000":e.bgSecondary,border:`1px solid ${ct?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?ct?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?ct?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx($x,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),v&&jsxRuntime.jsx(Kp,{theme:e,value:b??"all",onChange:v,maxDepth:C}),y&&jsxRuntime.jsx(qp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsxRuntime.jsx(zx,{theme:e,showCriticalPath:$,onShowCriticalPathChange:A,showBaseline:_,onShowBaselineChange:he,highlightWeekends:Ee,onHighlightWeekendsChange:B,showDependencies:q,onShowDependenciesChange:Z,rowDensity:l,onRowDensityChange:c,hasDependencies:z}),jsxRuntime.jsx(_p,{theme:e,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Ye}),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, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ct?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ct?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]})]})]}),k&&jsxRuntime.jsx(Hx,{theme:e,forecast:k})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Ox,{options:lt,value:t,onChange:pe=>a(pe),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsxRuntime.jsx(Kp,{theme:e,value:b??"all",onChange:v,maxDepth:C}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(qp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.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, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]}),(J||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(_p,{theme:e,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Ye}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Rx,{options:ee,value:s,onChange:pe=>n(pe),theme:e})]})]})}function vi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor: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"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function An({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+p+m>g&&(x=t-p,x<m&&(x=m)),a+d+m>y&&(h=y-d-m,h<m&&(h=m)),c({x,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=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:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children: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(),o());},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:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 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 sm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),y=react.useCallback(v=>{g.current=v;},[]),x=react.useCallback(v=>{let C=[],N=T=>{for(let k of T)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&N(k.subtasks);};return N(v),C},[]),h=react.useCallback(()=>{let v=x(e);for(let C of v)if(t.has(C.id))return C;return null},[e,t,x]),f=react.useCallback((v,C)=>{let N=x(e);if(N.length===0)return;let T=h();if(!T){a(N[0].id,false);return}let k=N.findIndex(I=>I.id===T.id);if(k===-1)return;let w=v==="up"?k-1:k+1;if(w<0||w>=N.length)return;let F=N[w];a(F.id,C);},[e,h,x,a]),b=react.useCallback(v=>{if(!m)return;let C=v.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){v.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,w=Array.from(t),F=h();if(v.key==="ArrowUp"){v.preventDefault(),f("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),f("down",v.shiftKey);return}if(F&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){F.subtasks&&F.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!F.isExpanded||v.key==="ArrowLeft"&&F.isExpanded)&&p(F.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){w.length>0&&(v.preventDefault(),n(w,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){w.length>0&&(v.preventDefault(),l(w));return}if(v.key==="Tab"&&v.shiftKey){w.length>0&&(v.preventDefault(),c(w));return}if(v.key==="Enter"&&!v.shiftKey&&!k){F&&(v.preventDefault(),r(F.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!k){F&&(v.preventDefault(),r(F.id,"above"));return}if(v.key==="Enter"&&k){F&&(v.preventDefault(),d(F.id));return}if(v.key==="F2"){F&&(v.preventDefault(),i(F.id));return}if(v.key==="Delete"||v.key==="Backspace"&&k){w.length>0&&(v.preventDefault(),o(w));return}if(v.key==="d"&&k&&!v.shiftKey){w.length>0&&(v.preventDefault(),s(w));return}},[m,t,h,f,r,o,s,n,l,c,i,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[m,b]),{setIsEditing:y}}function lm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),y=m.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=m.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,y)=>{y?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:p}}function Nd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Nd(t.subtasks):t.subtasks}))}function Ln(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function In(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=In(a.subtasks,t);if(r)return r}}return null}function Td(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Td(a.subtasks,t);if(r)return r}return null}function Dd(e,t){if(t.length===0)return e;let a=Ln(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let y=[];return {tasks:m.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},l=(m,g,y)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:p}=n(e,c),d=l(i,s.id,p);return Nd(d)}function Sd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Td(a,r);if(!o)continue;let s=Td(a,o.id),n=(i,p,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===p&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,p,d);if(y)return y}}return null},l=(i,p,d)=>{let m=i.findIndex(g=>g.id===p);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,p,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return Nd(a)}function Ed(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let p=c==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],n[i]={...n[i],position:i},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function Md(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function fs(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let p=c[i],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function dm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return c.splice(p,0,n),true};return l(r),{tasks:r,newTask:n}}function Fd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Fd(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 Ad(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},i=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function cm(e,t,a,r){if(t===a)return e;let o=In(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===i||l(p,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(p=>p.id!==t),i=c.length<l.length;return c.map((p,d)=>{let m=i?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((y,x)=>({...y,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Rr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Rr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=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,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ki({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:v,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:T,onDeleteRequest:k,onTaskReparent:w,scrollContainerRef:F,showCriticalPath:I=false}){let S=react.useContext(Fn),[X,O]=react.useState(null),[$,A]=react.useState(null),[q,Z]=react.useState(""),Ee=react.useRef(null),[B,_]=react.useState(null),[he,Ye]=react.useState(0),[z,re]=react.useState(0),[J,Le]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[we,Oe]=react.useState(null),[Be,lt]=react.useState(null),[ee,ct]=react.useState(null),pe=react.useRef(0),et=5,nt=react.useRef(false),[Ut,Ce]=react.useState(null),[mt,Dt]=react.useState(false),Xe=react.useRef(null),[H,ne]=react.useState(null),[D,K]=react.useState(false),ue=react.useRef(null);react.useEffect(()=>{function ie(me){ue.current&&!ue.current.contains(me.target)&&K(false);}if(D)return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[D]),react.useEffect(()=>{$&&Ee.current&&(Ee.current.focus(),Ee.current.select());},[$]),react.useEffect(()=>{if(!B)return;let ie=L=>{let j=L.clientX-he,Y=z+j;m?.(B,Y);},me=()=>{_(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[B,he,z,m]);let{selectedTaskIds:Te,handleTaskClick:V,isTaskSelected:te}=lm(),{setIsEditing:$e}=sm({tasks:e,selectedTaskIds:Te,onTaskSelect:(ie,me)=>{let j=Ln(e).map(Y=>Y.id);V(ie,j,me||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ie=>{let me=Ln(e).find(L=>L.id===ie);me&&dt(me);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:ie=>{let me=Ln(e).find(L=>L.id===ie);me&&T&&T(me);},enableKeyboard:true}),Ne=(ie,me=0,L="")=>{let j=[],Y=[...ie].sort((ge,De)=>(ge.position??0)-(De.position??0));for(let ge=0;ge<Y.length;ge++){let De=Y[ge],Je=ge+1,_e=L?`${L}.${Je}`:`${Je}.0`;if(De.wbsCode=_e,j.push({task:De,level:me}),De.subtasks&&De.subtasks.length>0&&De.isExpanded){let ze=L?`${L}.${Je}`:`${Je}`;j.push(...Ne(De.subtasks,me+1,ze));}}return j},He=Ne(e),Fe=48,Ge=Math.max(He.length*a,600-Fe),ht=ie=>!ie.startDate||!ie.endDate?"-":`${Math.ceil((ie.endDate.getTime()-ie.startDate.getTime())/(1e3*60*60*24))}d`,dt=ie=>{A(ie.id),Z(ie.name),$e(true);},gt=ie=>{q.trim()&&q!==e.find(me=>me.id===ie)?.name&&C?.(ie,q.trim()),A(null),Z(""),$e(false);},ot=()=>{A(null),Z(""),$e(false);},jt=(ie,me)=>{me.stopPropagation(),N?.(ie.id);},Et=(ie,me)=>{me.preventDefault(),pe.current=me.clientY,Oe(ie),nt.current=false,Dt(false),Ce({x:me.clientX,y:me.clientY});},Nt=ie=>{if(!we||(Math.abs(ie.clientY-pe.current)>et&&!nt.current&&(nt.current=true,Dt(true)),Ce({x:ie.clientX,y:ie.clientY}),!nt.current))return;if(F?.current){let ge=F.current,De=ge.getBoundingClientRect(),Je=60,_e=12;Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null);let ze=ie.clientY-De.top,vt=De.bottom-ie.clientY;if(ze<Je&&ge.scrollTop>0){let ut=Math.round(_e*(1-ze/Je)),Wt=()=>{ge.scrollTop-=ut,nt.current&&ge.scrollTop>0&&(Xe.current=requestAnimationFrame(Wt));};Xe.current=requestAnimationFrame(Wt);}else if(vt<Je&&ge.scrollTop<ge.scrollHeight-ge.clientHeight){let ut=Math.round(_e*(1-vt/Je)),Wt=()=>{ge.scrollTop+=ut,nt.current&&ge.scrollTop<ge.scrollHeight-ge.clientHeight&&(Xe.current=requestAnimationFrame(Wt));};Xe.current=requestAnimationFrame(Wt);}}let L=document.querySelectorAll("[data-task-row]"),j=null,Y=null;L.forEach(ge=>{let De=ge.getBoundingClientRect(),Je=ge.getAttribute("data-task-row");if(Je&&Je!==we&&ie.clientY>=De.top&&ie.clientY<=De.bottom){j=Je;let _e=ie.clientY-De.top,ze=De.height;_e<ze*.25?Y="above":_e>ze*.75?Y="below":Y="child";}}),lt(j),ct(Y);},Tt=()=>{if(nt.current&&we&&Be&&ee){if(ee==="child")w?.(we,Be);else if(ee==="above"||ee==="below"){let ie=(Y,ge,De=null)=>{for(let Je of Y){if(Je.id===ge)return De;if(Je.subtasks){let _e=ie(Je.subtasks,ge,Je.id);if(_e!==void 0)return _e}}},me=ie(e,we,null),L=ie(e,Be,null),j=(Y,ge,De,Je)=>{let _e=Y.findIndex(ut=>ut.id===ge),ze=Je?Y.findIndex(ut=>ut.id===De):-1,vt=ee==="below"?_e+1:_e;return Je&&ze!==-1&&ze<_e&&(vt-=1),Math.max(0,vt)};if(L===null){let ge=j(e,Be,we,me===null);w?.(we,null,ge);}else {let Y=In(e,L);if(Y?.subtasks){let ge=me===L,De=j(Y.subtasks,Be,we,ge);w?.(we,L,De);}}}}Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null),Oe(null),lt(null),ct(null),Ce(null),nt.current=false,Dt(false);};react.useEffect(()=>{if(we)return document.addEventListener("mousemove",Nt),document.addEventListener("mouseup",Tt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Nt),document.removeEventListener("mouseup",Tt),document.body.style.cursor="",document.body.style.userSelect="";}},[we,Be,ee]);let yt=(ie,me,L)=>{let j=me.subtasks&&me.subtasks.length>0;switch(ie.id){case "name":let Y=$===me.id,ge=X===me.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${L*20}px`},children:[w&&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:ge?1:.3},onMouseDown:U=>Et(me.id,U),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),c?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.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"}),Y?jsxRuntime.jsx("input",{ref:Ee,type:"text",value:q,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?gt(me.id):U.key==="Escape"&&ot();},onBlur:()=>gt(me.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:U=>U.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),me.isHighlighted&&me.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:me.name}),me.subtasks&&me.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(me.progress||0),"%"]}),I&&me.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&me.cpmData&&jsxRuntime.jsxs("span",{style:{color:me.cpmData.totalFloat<=0?"#EF4444":me.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(me.cpmData.totalFloat),"d"]})]}),ge&&!Y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:U=>jt(me,U),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:U=>{U.stopPropagation(),dt(me);},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 Je=ie.id==="startDate"?"startDate":"endDate",_e=me[Je],ze=H?.taskId===me.id&&H?.field===Je,vt=U=>U?(typeof U=="string"?new Date(U):U).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:U=>U.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:U=>{if(!j)if(ze)ne(null);else {let Ze=U.currentTarget.getBoundingClientRect();ne({taskId:me.id,field:Je,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Ze.bottom+4,left:Ze.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:vt(_e)}),j&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),ze&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ne(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:H?.position.top,left:H?.position.left},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,Ze=new Date(U);Ze.setDate(U.getDate()+1);let ye=new Date(U);ye.setDate(U.getDate()+7);let E=new Date(U);return E.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:Ze},{label:"Pr\xF3xima semana",date:ye},{label:"2 semanas",date:E}].map((je,tt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ra=>ra.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ra=>ra.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Je]:je.date}),ne(null);},children:je.label},tt))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Je]:void 0}),ne(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:()=>ne(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ne(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,Ze)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},Ze))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=H?.month||new Date,Ze=U.getFullYear(),ye=U.getMonth(),E=new Date(Ze,ye,1).getDay(),fe=new Date(Ze,ye+1,0).getDate(),je=new Date,tt=[];for(let Vt=E-1;Vt>=0;Vt--)tt.push({day:new Date(Ze,ye,-Vt).getDate(),date:new Date(Ze,ye-1,new Date(Ze,ye,-Vt).getDate()),isCurrentMonth:false});for(let Vt=1;Vt<=fe;Vt++)tt.push({day:Vt,date:new Date(Ze,ye,Vt),isCurrentMonth:true});let ra=42-tt.length;for(let Vt=1;Vt<=ra;Vt++)tt.push({day:Vt,date:new Date(Ze,ye+1,Vt),isCurrentMonth:false});return tt.map((Vt,Ua)=>{let lr=Vt.date.toDateString()===je.toDateString(),ya=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===Vt.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:Vt.isCurrentMonth?ya?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ya?"#2E94FF":"transparent",boxShadow:lr&&!ya?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Je]:Vt.date}),ne(null);},children:Vt.day},Ua)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:ht(me)})});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 ut=r.filter(U=>me.assignees?.some(Ze=>Ze.name===U.name||Ze.initials===U.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsxRuntime.jsx(Yo,{assignedUsers:ut,availableUsers:r,onChange:U=>{let Ze=U.map(ye=>({id:ye.id,name:ye.name,initials:ye.initials,color:ye.color}));g?.(me.id,{assignees:Ze.length>0?Ze:void 0});}})});case "status":if(j){let U=me.progress===100?"\u2713":me.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:U})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsxRuntime.jsx(Au,{status:me.status||"todo",onChange:U=>{g?.(me.id,{status:U,progress:U==="completed"?100:me.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:`${me.progress}%`,backgroundColor:me.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:[me.progress,"%"]})]});case "priority":let Wt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ha={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ta=Wt[me.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsxRuntime.jsx(Ko,{priority:ta,onChange:U=>{U&&g?.(me.id,{priority:ha[U]||"medium"});}})});default:return null}},Ot=ie=>[{id:"hide",label:"Hide Column",icon:ca.Hide,onClick:()=>d(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:()=>{}}],We=ie=>ie.subtasks&&ie.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(ie.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([ie.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(ie.id,ie.name):f?.([ie.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{n?.(ie);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(ie.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{g?.(ie.id,{status:"todo",progress:0});},disabled:ie.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{g?.(ie.id,{status:"in-progress"});},disabled:ie.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{g?.(ie.id,{status:"completed",progress:100});},disabled:ie.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([ie.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(ie.id,ie.name):f?.([ie.id]);}}],Re=p.filter(ie=>ie.visible),at=Re.reduce((ie,me)=>ie+me.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:at},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Fe}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:Re.map((ie,me)=>{let L=me===Re.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&&Re.length===1?1:0,flexGrow:j&&Re.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Y=>{Y.preventDefault(),Le({isOpen:true,x:Y.clientX,y:Y.clientY,type:"header",columnId:ie.id});},onMouseEnter:Y=>{Y.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Y=>{Y.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:B===ie.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Y=>{Y.preventDefault(),Y.stopPropagation(),_(ie.id),Ye(Y.clientX),re(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:B===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(vi,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>K(!D),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"})}),D&&jsxRuntime.jsxs("div",{ref:ue,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:()=>K(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",style:{minHeight:Ge},children:He.map(({task:ie,level:me},L)=>{let j=te(ie.id),Y=Be===ie.id,ge=Y&&ee==="above",De=Y&&ee==="below",Je=Y&&ee==="child",_e={};return Je&&(_e.backgroundColor=`${t.accent}15`,_e.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 ${we===ie.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:Je?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?ie.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>O(ie.id),onMouseLeave:()=>O(null),onClick:ze=>{let ut=Ln(e).map(ta=>ta.id),ha=navigator.platform.toUpperCase().indexOf("MAC")>=0?ze.metaKey:ze.ctrlKey;V(ie.id,ut,ha,ze.shiftKey),s?.(ie);},onDoubleClick:ze=>{ze.stopPropagation(),n?.(ie);},onContextMenu:ze=>{ze.preventDefault(),Le({isOpen:true,x:ze.clientX,y:ze.clientY,type:"task",task:ie}),l?.(ie,ze);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[ge&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),De&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((ze,vt)=>{let ut=vt===Re.length-1,Wt=ze.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Wt?"justify-start":"justify-center"}`,style:{width:`${ze.width}px`,minWidth:`${ze.minWidth??(Wt?200:60)}px`,maxWidth:`${ze.maxWidth??2e3}px`,flexShrink:Wt&&Re.length===1?1:0,flexGrow:Wt&&Re.length===1?1:0,borderRight:ut?"none":`1px solid ${X===ie.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:yt(ze,ie,Wt?me:0)},`${ie.id}-${ze.id}`)})]},ie.id)})}),jsxRuntime.jsx(An,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Ot(J.columnId):J.type==="task"&&J.task?We(J.task):[],onClose:()=>Le({...J,isOpen:false}),theme:t}),mt&&Ut&&we&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ut.x+12,top:Ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ie=He.find(me=>me.task.id===we)?.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 fm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,v]=react.useState(0),[C,N]=react.useState(0),[T,k]=react.useState(null),[w,F]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:v,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:T,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,A)=>{r("none"),d(null),g(null),l($),i(A),N(0),f(null),v(0);}}}function Ni({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:v=false}){let C=fm(t,r),N=react.useRef(null),T=react.useRef(false),k=react.useRef(null),w=react.useRef(null),{dragMode:F,setDragMode:I,dragOffset:S,setDragOffset:X,ghostX:O,setGhostX:$,ghostWidth:A,setGhostWidth:q,connectionLine:Z,setConnectionLine:Ee,hoveredTaskId:B,setHoveredTaskId:_,activeZone:he,setActiveZone:Ye,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Le,segmentDragOffsetX:we,setSegmentDragOffsetX:Oe,hoveredSegmentIndex:Be,setHoveredSegmentIndex:lt,isHovered:ee,setIsHovered:ct,isDragging:pe,isResizing:et,isConnecting:nt,resetDragState:Ut}=C,Ce=18,mt=!!o.executionBarBg,Dt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Xe=mt?3:6,H=e.subtasks&&e.subtasks.length>0,ne=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let j=new Date(e.endDate);return j.setHours(0,0,0,0),j<L})()&&e.progress<100,D=b&&e.isCriticalPath,K=o.name==="neutral"||o.today==="#1C1917",ue=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||ne?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,$e=v?"default":pe?nt?"crosshair":et?"ew-resize":"grabbing":"grab",Ne=v?"default":"ew-resize",Fe=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),Ge=r<50,ht=r<40;react.useEffect(()=>{x&&(!ee||pe||e.segments)&&x(null);},[ee,pe,e.segments,x]);let dt=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),gt=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},ot=L=>Math.round(L/s)*s,jt=L=>{let j=Math.round(L/s),Y=new Date(n);return Y.setDate(Y.getDate()+j),Y},Et=(L,j)=>{for(let Y of g){if(Y.id===e.id)continue;let ge=5;if(L>=Y.x-ge&&L<=Y.x+Y.width+ge&&j>=Y.y-ge&&j<=Y.y+Y.height+ge)return Y.id}return null},Nt=react.useCallback((L,j,Y)=>{if(v)return;L.preventDefault(),L.stopPropagation();let ge=N.current?.ownerSVGElement;if(!ge)return;let De=ge.createSVGPoint();De.x=L.clientX,De.y=L.clientY;let Je=De.matrixTransform(ge.getScreenCTM()?.inverse()),_e=Y!==void 0?Y:t,ze=j;if(!ze){let vt=Je.x-_e;L.shiftKey?(ze="connect",Ee({x:t+r,y:a+Ce/2})):L.ctrlKey||L.metaKey?ze="move":L.altKey?ze=vt<r/2?"resize-start":"resize-end":ht?vt<r/2?ze="move":ze="resize-end":Ge?vt<=Fe/2?ze="resize-start":vt>=r-Fe/2?ze="resize-end":ze="move":vt<=Fe?ze="resize-start":vt>=r-Fe?ze="resize-end":ze="move";}T.current=false,I(ze),ct(false),Ye(null),ze==="move"?X(Je.x-_e):ze==="connect"?Ee({x:t+r,y:a+Ce/2}):X(0),$(_e),q(r);},[t,r,a,Ce,v]),Tt=react.useCallback(L=>{let j=N.current?.ownerSVGElement;if(!j)return;let Y=j.closest(".gantt-timeline-scroll");if(!Y)return;let ge=Y.getBoundingClientRect(),De=60,Je=15,_e=0;if(L.clientX<ge.left+De){let ze=ge.left+De-L.clientX;_e=-Math.min(Je,ze/2);}else if(L.clientX>ge.right-De){let ze=L.clientX-(ge.right-De);_e=Math.min(Je,ze/2);}return _e!==0&&(Y.scrollLeft+=_e),_e!==0},[]),yt=react.useCallback(L=>{if(F==="none")return;T.current=true,w.current=L;let j=N.current?.ownerSVGElement;if(!j)return;if(F==="move"||F==="resize-start"||F==="resize-end"){let De=Tt(L);De&&!k.current?k.current=window.setInterval(()=>{w.current&&(Tt(w.current),yt(w.current));},16):!De&&k.current&&(window.clearInterval(k.current),k.current=null);}let Y=j.createSVGPoint();Y.x=L.clientX,Y.y=L.clientY;let ge=Y.matrixTransform(j.getScreenCTM()?.inverse());if(F==="connect"){Ee({x:ge.x,y:ge.y});let De=Et(ge.x,ge.y);_(De);}else if(F==="move"){let De=ge.x-S,Je=ot(De);$(Je),q(r);let _e=Math.round((Je-t)/s);if(y?.(e.id,_e,true),e.segments&&e.segments.length>0&&z!==null){let ze=Je-J;Oe(ze);}}else if(F==="resize-start"){let De=ge.x,Je=ot(De),_e=t+r-Je;_e>=s&&($(Je),q(_e));}else if(F==="resize-end"){let De=ge.x,_e=ot(De)-t;_e>=s&&q(_e);}},[F,t,r,s,S,e,ot,z,J,Et,_,Ee,$,q,Oe,y,Tt]),Ot=react.useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),w.current=null,F!=="none"){if(F==="connect")B&&m&&m(e,B),Ee(null),_(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),j,Y,ge=true;if(F==="move"){if(j=jt(O),Y=new Date(j.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let De=Math.round(we/s),Je=e.segments.map((ut,Wt)=>{if(Wt===z){let ha=new Date(ut.startDate),ta=new Date(ut.endDate);return ha.setDate(ha.getDate()+De),ta.setDate(ta.getDate()+De),{startDate:ha,endDate:ta}}return ut}),_e=Je.flatMap(ut=>[ut.startDate,ut.endDate]),ze=new Date(Math.min(..._e.map(ut=>ut.getTime()))),vt=new Date(Math.max(..._e.map(ut=>ut.getTime())));d?.({...e,segments:Je},ze,vt),Ut(t,r);return}}else F==="resize-start"?(j=jt(O),Y=e.endDate,j>Y&&(console.warn("Invalid date range: start date must be before or equal to end date"),ge=false)):F==="resize-end"?(j=e.startDate,Y=jt(O+A),Y.setDate(Y.getDate()-1),Y<j&&(console.warn("Invalid date range: end date must be after or equal to start date"),ge=false)):ge=false;ge&&j&&Y&&(Y.getTime()<j.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,j,Y));}y?.(e.id,0,false),Ut(t,r);}},[F,O,A,e,d,B,m,t,r,s,jt,we,z,Ut,y]);react.useEffect(()=>{if(F==="none")return;let L=Y=>{yt(Y);},j=()=>{Ot();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",j),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",j),k.current&&(window.clearInterval(k.current),k.current=null);}},[F,yt,Ot]);let We=pe&&!nt?O:t,Re=pe&&!nt?A:r,at=l.taskClass(e),ie=24,me=b?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:me,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!pe&&!T.current&&(L.stopPropagation(),i?.(e));},onContextMenu:L=>{L.preventDefault(),p?.(e,L);},onMouseEnter:()=>!pe&&ct(true),onMouseMove:L=>{x&&ee&&!pe&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{pe||(ct(false),Ye(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+ie,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!pe&&!Ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Fe,height:Ce,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ye("resize-start"),onMouseDown:L=>Nt(L,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Fe,y:a,width:r-Fe*2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ye("move"),onMouseDown:L=>Nt(L,"move")}),jsxRuntime.jsx("rect",{x:t+r-Fe,y:a,width:Fe,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ye("resize-end"),onMouseDown:L=>Nt(L,"resize-end")})]}),ee&&!pe&&ht&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ye("move"),onMouseDown:L=>Nt(L,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ye("resize-end"),onMouseDown:L=>Nt(L,"resize-end")}),ee&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!nt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:A,height:Ce,rx:Xe,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!pe&&(()=>{let L=e.baselineStartDate.getTime(),j=e.baselineEndDate.getTime(),Y=n.getTime(),ge=864e5,De=(L-Y)/ge,Je=(j-L)/ge,_e=De*s,ze=Math.max(Je*s,s),vt=We+Re,ut=_e+ze,Wt=e.endDate?.getTime()??0,ha=Math.ceil((Wt-j)/ge),ta=ha>0,U=ha<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:_e,y:a,width:ze,height:Ce,rx:Xe,fill:"none",stroke:Dt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ta&&vt>ut&&jsxRuntime.jsx("rect",{x:ut,y:a,width:vt-ut,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),ta&&jsxRuntime.jsxs("text",{x:Math.max(vt,ut)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",ha,"d"]}),U&&jsxRuntime.jsxs("text",{x:vt+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[ha,"d"]})]})})(),!e.segments&&mt&&H&&(()=>{let j=a+(Ce-8)/2,Y=4,ge=e.progress||0,De=new Date;De.setHours(0,0,0,0);let Je=e.startDate&&De>=e.startDate,_e=e.endDate&&(()=>{let ta=new Date(e.endDate);return ta.setHours(0,0,0,0),De>ta})(),ze=e.startDate&&De<e.startDate,vt=1;if(Je&&e.startDate&&e.endDate&&!ze){let ta=new Date(e.startDate);ta.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let Ze=Math.max(1,(U.getTime()-ta.getTime())/(1e3*60*60*24)),E=Math.min((De.getTime()-ta.getTime())/(1e3*60*60*24),Ze)/Ze*100;vt=E>0?ge/E:1;}let ut;ge>=100?ut="#00E5CC":ze?ut="#4B5563":_e&&ge<100?ut="#EF4444":vt>=.95?ut="#22C55E":vt>=.8?ut="#F59E0B":ut="#EF4444";let Wt=Math.max(ge/100*Re,ge>0?Y*2:0),ha=Re>100&&ge>0;return jsxRuntime.jsxs("g",{"data-task-class":at,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:We,y:j,width:Re,height:8,rx:Y,fill:"rgba(255,255,255,0.10)"}),ge>0&&jsxRuntime.jsx("rect",{x:We,y:j,width:Wt,height:8,rx:Y,fill:ut}),ha&&jsxRuntime.jsxs("text",{x:We+Wt+6,y:j+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(ge),"%"]})]})})(),!e.segments&&mt&&!H&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":at,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!nt?.15:e.parentId?.6:1,scale:ee&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>Nt(L),style:{cursor:$e,pointerEvents:"all"}}),!e.segments&&!mt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:te,"data-task-class":at,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!nt?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:L=>Nt(L),style:{cursor:H?"default":$e,pointerEvents:"all"}}),mt&&(ne||D)&&!e.segments&&jsxRuntime.jsx("rect",{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsxRuntime.jsx("rect",{x:We,y:a,width:Math.max(Re*(e.progress/100),Xe*2),height:Ce,rx:Xe,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let L=e.progress>0?Re*(e.progress/100):0,j=We+L,Y=Re-L,ge=e.progress===0?Xe:0,De=e.progress===0?We:j,Je=e.progress===0?Re:Y;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:De,y:a,width:Je,height:Ce,rx:ge,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:De,y:a,width:Je,height:Ce,rx:ge,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),mt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!pe&&(()=>{let L=We+Re*(e.progress/100),j=8,Y=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:L,cy:a+Ce/2,r:j,fill:Y?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:L,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Y?.initials||Y?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,j)=>{let Y=(L.startDate.getTime()-n.getTime())/864e5*s,De=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Y+s,Je=pe&&F==="move"&&z===j,_e=Be===j,ze=Je?Y+we:Y;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!pe&&lt(j),onMouseLeave:()=>!pe&&lt(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:De,height:Ce,rx:Xe,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:Je||e.parentId?.6:_e?.9:.8,scale:_e&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:vt=>{vt.stopPropagation(),re(j),Le(Y),Nt(vt,void 0,Y);},style:{cursor:$e,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ze,y:a,width:De*(e.progress/100),height:Ce,rx:Xe,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${j}`)}),K&&(ne||D)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&!ne&&jsxRuntime.jsx("rect",{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsx("rect",{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Re>60&&!e.segments&&!(mt&&H)&&(()=>{let L=l.taskLabel(e),j=typeof L=="string"?L:e.name,Y=j.length>Math.floor(Re/8)?`${j.substring(0,Math.floor(Re/8))}...`:j;return jsxRuntime.jsx("text",{x:We+8,y:a+Ce/2,dominantBaseline:"middle",fill:ue?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ue?"line-through":"none"},children:Y})})(),!pe&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(mt?jsxRuntime.jsxs("text",{x:We+Re+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Re>100?jsxRuntime.jsxs("text",{x:We+Re-12,y:a+Ce/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&&Re>80&&!pe&&!e.segments&&!(mt&&H)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:We+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:We+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||et)&&!nt&&!e.segments&&!H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ye("resize-start"),onMouseLeave:()=>Ye(null),onMouseDown:L=>{L.stopPropagation(),Nt(L,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-start"||F==="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:We+Re-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ye("resize-end"),onMouseLeave:()=>Ye(null),onMouseDown:L=>{L.stopPropagation(),Nt(L,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+Re-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-end"||F==="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:ee&&!pe&&!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+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ye("connect"),onMouseLeave:()=>Ye(null),onMouseDown:L=>{L.stopPropagation(),Nt(L,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),nt&&Z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:Z.x,y2:Z.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Z.x,cy:Z.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||pe)&&!nt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We-1,y:a-1,width:Re+2,height:Ce+2,rx:Xe+1,fill:"none",stroke:pe?o.accent:mt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:mt?1:2,opacity:pe||mt?.6:.4,initial:{opacity:0},animate:{opacity:pe||mt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),et&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O+A,y1:0,x2:O+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&!pe&&!e.segments&&!x&&(()=>{let Y=a<100,ge=Y?a+Ce+13:a-82-13,De=Y?`M ${We+Re/2-6} ${a+Ce+3} L ${We+Re/2} ${a+Ce+13} L ${We+Re/2+6} ${a+Ce+3}`:`M ${We+Re/2-6} ${a-13} L ${We+Re/2} ${a-3} L ${We+Re/2+6} ${a-13}`,Je=ge+22,_e=ge+40,ze=ge+55,vt=ge+70,ut=Y?ge+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Y?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Y?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:De,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:We+Re/2-120,y:ge,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:We+Re/2,y:Je,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:We+Re/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:We+Re/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.startDate)}),jsxRuntime.jsx("text",{x:We+Re/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:We+Re/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.endDate)}),jsxRuntime.jsx("text",{x:We+Re/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:We+Re/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:gt()}),jsxRuntime.jsx("text",{x:We+Re/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:We+Re/2+65,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:We+Re/2-110,y:vt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:We+Re/2-50,y:vt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Wt=>Wt.name).join(", ").substring(0,30),e.assignees.map(Wt=>Wt.name).join(", ").length>30?"...":""]})]}),!Y&&jsxRuntime.jsx("text",{x:We+Re/2,y:ut,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ht?"Left: move \u2022 Right: resize":Ge?"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,Bn=8,ym=16,Sv=-12;function xm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:v,mouseY:C}=e,N=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null,T=b.lastActivity!=null,k=(N?155:105)+(T?28:0),w=v+ym,F=C+Sv-k;w+Ld>window.innerWidth-Bn&&(w=v-Ld-ym),w<Bn&&(w=Bn);let I=F<Bn;I&&(F=C+20),F+k>window.innerHeight-Bn&&(F=window.innerHeight-Bn-k),o({left:w,top:F,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={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"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},p=b=>{if(b==null||b===0)return "N/A";let v=Math.floor(b/60),C=b%60;return v===0?`${C}m`:C===0?`${v}h`:`${v}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.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:x,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:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(Di,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Di,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsxRuntime.jsx(Di,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Di,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:y,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]}),s.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:s.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:s.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:s.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function pd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("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(([i,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:i})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function gd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await cu(e,c,x);uu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await gu(h),b=h.name.endsWith(".json")?"json":"csv",v=mu(f,b);d(v),v.success&&r&&r(v,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:u("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:()=>l("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="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:m,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.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:u("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:u("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((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var ex=["URGENT","HIGH","MEDIUM","LOW"],tx=[{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"}],ax=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function fd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=react.useState(true),f=react.useCallback(N=>{a({search:N.target.value});},[a]),b=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),v=react.useCallback(N=>{r({by:N.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=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 ${m?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&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"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,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:N=>{let k=N.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ex.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let k=N.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let k=N.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:tx.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:N=>y(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ax.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function bd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var hd={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:"#2E94FF",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"}},yd={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:"#2E94FF",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"}},xd={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"}},rn={dark:hd,light:yd,neutral:xd},xi="dark";var vi=react.createContext(void 0),px="asakaa-theme";function Wp({children:e,defaultTheme:t=xi,storageKey:a=px}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=rn[r];Object.entries(c.colors).forEach(([p,d])=>{d&&l.style.setProperty(`--theme-${mx(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let m=c.colors[p];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:rn};return jsxRuntime.jsx(vi.Provider,{value:n,children:e})}function Fn(){let e=react.useContext(vi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function mx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function vd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Fn();return e?jsxRuntime.jsxs("div",{className:u("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(rn).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/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:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.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}function Vp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ft[e]||ft.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ft[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ft[e].bgSecondary),bgGrid:r("--theme-bg-card",ft[e].bgGrid),bgWeekend:r("--theme-bg-hover",ft[e].bgWeekend),border:r("--theme-border-primary",ft[e].border),borderLight:r("--theme-border-subtle",ft[e].borderLight),textPrimary:r("--theme-text-primary",ft[e].textPrimary),textSecondary:r("--theme-text-secondary",ft[e].textSecondary),textTertiary:r("--theme-text-tertiary",ft[e].textTertiary),accent:r("--theme-accent-primary",ft[e].accent),accentHover:r("--theme-accent-hover",ft[e].accentHover),accentLight:r("--theme-accent-primary",ft[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ft[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ft[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ft[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ft[e].dependency),dependencyHover:r("--theme-border-secondary",ft[e].dependencyHover),criticalPath:r("--theme-error",ft[e].criticalPath),criticalPathLight:r("--theme-error",ft[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ft[e].today):e==="neutral"?r("--theme-text-primary",ft[e].today):r("--theme-error",ft[e].today),todayLight:e==="light"?r("--theme-accent-primary",ft[e].todayLight):e==="neutral"?r("--theme-text-primary",ft[e].todayLight):r("--theme-error",ft[e].todayLight),milestone:r("--theme-warning",ft[e].milestone),milestoneLight:r("--theme-warning",ft[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ft[e].statusTodo),statusInProgress:r("--theme-accent-primary",ft[e].statusInProgress),statusCompleted:r("--theme-success",ft[e].statusCompleted),hoverBg:r("--theme-bg-hover",ft[e].hoverBg),focusRing:r("--theme-accent-primary",ft[e].focusRing),...ft[e].dotGrid&&{dotGrid:ft[e].dotGrid},...ft[e].glassHeader&&{glassHeader:ft[e].glassHeader},...ft[e].glassToolbar&&{glassToolbar:ft[e].glassToolbar},...ft[e].forecastHud&&{forecastHud:ft[e].forecastHud},...ft[e].neonRedGlow&&{neonRedGlow:ft[e].neonRedGlow},...ft[e].executionBarBg&&{executionBarBg:ft[e].executionBarBg}}}var wi={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"}},Gp={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"}},wd={en:wi,es:Gp};function jp(e){return wd[e]||wd.en}function kd(e,t){let a=jp(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 An=react.createContext(wi);function Or(){return react.useContext(An)}function bs(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function em({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,p]=react.useState(null),d=react.useRef(null),m=react.useRef(null),g=Or(),y=bs(d,l,"right",176);if(react.useEffect(()=>{if(!l)return;let b=v=>{let T=v.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,v)=>{if(v){p(b);try{await v();}catch(T){console.error(`Export ${b} failed:`,T);}finally{p(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref: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-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:h.map((b,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(b.id,b.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===b.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"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Kp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[c,i]=react.useState(null),[p,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),y=Or(),x=bs(m,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let D=N=>{let k=N.target;m.current&&!m.current.contains(k)&&g.current&&!g.current.contains(k)&&l(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(D=>D.handler),v=async(D,N)=>{if(N){i(D);try{await N();}catch(k){console.error(`Export ${D} failed:`,k);}finally{i(null),l(false);}}},T=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:b.map((D,N)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(D.id,D.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:N*.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===D.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"})}):D.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:D.label})]},D.id))})]}),b.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:T,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b.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?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Rx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Ox({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.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:o.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}})]},o.value)})})}function qp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=Or(),i=bs(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.current.contains(y)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,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:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((m,g)=>{let y=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:m.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Yp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=Or(),p=bs(l,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),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:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"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:g?"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:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"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?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function $x({value:e,onChange:t,theme:a}){let r=Or(),o=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:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Hx({theme:e,forecast:t}){let a=Or(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,l=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},i=t?.confidencePercent,p=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.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:g}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function zx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=react.useState(false),y=react.useRef(null),x=react.useRef(null),h=Or(),f=bs(y,m,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let N=k=>{let w=k.target;y.current&&!y.current.contains(w)&&x.current&&!x.current.contains(w)&&g(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]);let v=h.toolbar.visibility==="Visibilidad",T=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],D=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:y,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.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:[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.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:T.map((N,k)=>{let w=N.icon,F=N.disabled,I=N.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!F&&N.onChange?.(!N.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:F?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:F?"not-allowed":"pointer"},whileHover:F?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:I,children:[jsxRuntime.jsx(w,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:F?b?"rgba(255,255,255,0.2)":"#D1D5DB":N.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.label}),N.active&&!F&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},N.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),D.map((N,k)=>{let w=i===N.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(N.value),className:"w-full flex items-center justify-between 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:(T.length+k)*.03},children:[jsxRuntime.jsx("span",{style:{color:w?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:N.label}),w&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},N.value)})]})]})}),document.body)]})}function ki({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:v,maxWbsDepth:T=4,viewMode:D="execution",onViewModeChange:N,projectForecast:k,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportCSV:S,onExportJSON:Y,onExportMSProject:$,showCriticalPath:X=true,onShowCriticalPathChange:C,showDependencies:G=true,onShowDependenciesChange:Z,highlightWeekends:$e=true,onHighlightWeekendsChange:B,showBaseline:K=false,onShowBaselineChange:he,onCopySnapshotLink:Xe,hasDependencies:H=true}){let re=Or(),Q=w||F||I||S||Y||$,Ee=!!e.glassToolbar,[Te,Ie]=react.useState(false),Be=react.useRef(null);react.useEffect(()=>{Te&&Be.current&&Be.current.focus();},[Te]);let ot=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ae=[{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"})}],nt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ee){let fe=nt?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:nt?"#1A1A1A":e.bgSecondary,border:`1px solid ${nt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:Te?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ie(!Te),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),Te&&jsxRuntime.jsx("input",{ref:Be,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Ie(false),onKeyDown:Ze=>{Ze.key==="Escape"&&Ie(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:fe}}),N&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:nt?"#000000":e.bgSecondary,border:`1px solid ${nt?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>N("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:D==="execution"?nt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:D==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:D!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>N("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:D==="oracle"?nt?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:D==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:D!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx($x,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:fe}}),v&&jsxRuntime.jsx(qp,{theme:e,value:b??"all",onChange:v,maxDepth:T}),y&&jsxRuntime.jsx(Yp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:fe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:fe}}),jsxRuntime.jsx(zx,{theme:e,showCriticalPath:X,onShowCriticalPathChange:C,showBaseline:K,onShowBaselineChange:he,highlightWeekends:$e,onHighlightWeekendsChange:B,showDependencies:G,onShowDependenciesChange:Z,rowDensity:l,onRowDensityChange:c,hasDependencies:H}),jsxRuntime.jsx(Kp,{theme:e,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportMSProject:$,onCopySnapshotLink:Xe}),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, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${nt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${nt?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]})]})]}),k&&jsxRuntime.jsx(Hx,{theme:e,forecast:k})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Ox,{options:ot,value:t,onChange:fe=>a(fe),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsxRuntime.jsx(qp,{theme:e,value:b??"all",onChange:v,maxDepth:T}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Yp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.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, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]}),(Q||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Kp,{theme:e,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportMSProject:$,onCopySnapshotLink:Xe}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Rx,{options:ae,value:s,onChange:fe=>n(fe),theme:e})]})]})}function Ci({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Jt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor: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"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function In({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+p+m>g&&(x=t-p,x<m&&(x=m)),a+d+m>y&&(h=y-d-m,h<m&&(h=m)),c({x,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=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:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children: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(),o());},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:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 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 im({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),y=react.useCallback(v=>{g.current=v;},[]),x=react.useCallback(v=>{let T=[],D=N=>{for(let k of N)T.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&D(k.subtasks);};return D(v),T},[]),h=react.useCallback(()=>{let v=x(e);for(let T of v)if(t.has(T.id))return T;return null},[e,t,x]),f=react.useCallback((v,T)=>{let D=x(e);if(D.length===0)return;let N=h();if(!N){a(D[0].id,false);return}let k=D.findIndex(I=>I.id===N.id);if(k===-1)return;let w=v==="up"?k-1:k+1;if(w<0||w>=D.length)return;let F=D[w];a(F.id,T);},[e,h,x,a]),b=react.useCallback(v=>{if(!m)return;let T=v.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||g.current){v.key==="Escape"&&(T.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,w=Array.from(t),F=h();if(v.key==="ArrowUp"){v.preventDefault(),f("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),f("down",v.shiftKey);return}if(F&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){F.subtasks&&F.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!F.isExpanded||v.key==="ArrowLeft"&&F.isExpanded)&&p(F.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){w.length>0&&(v.preventDefault(),n(w,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){w.length>0&&(v.preventDefault(),l(w));return}if(v.key==="Tab"&&v.shiftKey){w.length>0&&(v.preventDefault(),c(w));return}if(v.key==="Enter"&&!v.shiftKey&&!k){F&&(v.preventDefault(),r(F.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!k){F&&(v.preventDefault(),r(F.id,"above"));return}if(v.key==="Enter"&&k){F&&(v.preventDefault(),d(F.id));return}if(v.key==="F2"){F&&(v.preventDefault(),i(F.id));return}if(v.key==="Delete"||v.key==="Backspace"&&k){w.length>0&&(v.preventDefault(),o(w));return}if(v.key==="d"&&k&&!v.shiftKey){w.length>0&&(v.preventDefault(),s(w));return}},[m,t,h,f,r,o,s,n,l,c,i,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[m,b]),{setIsEditing:y}}function dm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),y=m.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=m.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,y)=>{y?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:p}}function Sd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Sd(t.subtasks):t.subtasks}))}function Bn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Rn(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Rn(a.subtasks,t);if(r)return r}}return null}function Dd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Dd(a.subtasks,t);if(r)return r}return null}function Ed(e,t){if(t.length===0)return e;let a=Bn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let y=[];return {tasks:m.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},l=(m,g,y)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:p}=n(e,c),d=l(i,s.id,p);return Sd(d)}function Md(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Dd(a,r);if(!o)continue;let s=Dd(a,o.id),n=(i,p,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===p&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,p,d);if(y)return y}}return null},l=(i,p,d)=>{let m=i.findIndex(g=>g.id===p);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,p,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return Sd(a)}function Fd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let p=c==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],n[i]={...n[i],position:i},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function Pd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ys(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let p=c[i],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function cm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return c.splice(p,0,n),true};return l(r),{tasks:r,newTask:n}}function Ad(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ad(r.subtasks,t,a)}:r)}function Ld(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ld(a.subtasks,t)}:a)}function Id(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},i=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function um(e,t,a,r){if(t===a)return e;let o=Rn(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===i||l(p,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(p=>p.id!==t),i=c.length<l.length;return c.map((p,d)=>{let m=i?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((y,x)=>({...y,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function $r(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=$r(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=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,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function Ni({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:v,onTaskRename:T,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:k,onTaskReparent:w,scrollContainerRef:F,showCriticalPath:I=false}){let S=react.useContext(An),[Y,$]=react.useState(null),[X,C]=react.useState(null),[G,Z]=react.useState(""),$e=react.useRef(null),[B,K]=react.useState(null),[he,Xe]=react.useState(0),[H,re]=react.useState(0),[Q,Ee]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Te,Ie]=react.useState(null),[Be,ot]=react.useState(null),[ae,nt]=react.useState(null),fe=react.useRef(0),Ze=5,xt=react.useRef(false),[St,Ce]=react.useState(null),[gt,Tt]=react.useState(false),Qe=react.useRef(null),[O,ie]=react.useState(null),[M,V]=react.useState(false),ce=react.useRef(null);react.useEffect(()=>{function se(ue){ce.current&&!ce.current.contains(ue.target)&&V(false);}if(M)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[M]),react.useEffect(()=>{X&&$e.current&&($e.current.focus(),$e.current.select());},[X]),react.useEffect(()=>{if(!B)return;let se=L=>{let _=L.clientX-he,q=H+_;m?.(B,q);},ue=()=>{K(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",ue),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[B,he,H,m]);let{selectedTaskIds:Ne,handleTaskClick:W,isTaskSelected:ee}=dm(),{setIsEditing:je}=im({tasks:e,selectedTaskIds:Ne,onTaskSelect:(se,ue)=>{let _=Bn(e).map(q=>q.id);W(se,_,ue||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:se=>{let ue=Bn(e).find(L=>L.id===se);ue&&ct(ue);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:se=>{let ue=Bn(e).find(L=>L.id===se);ue&&N&&N(ue);},enableKeyboard:true}),ve=(se,ue=0,L="")=>{let _=[],q=[...se].sort((pe,Fe)=>(pe.position??0)-(Fe.position??0));for(let pe=0;pe<q.length;pe++){let Fe=q[pe],Ke=pe+1,Ve=L?`${L}.${Ke}`:`${Ke}.0`;if(Fe.wbsCode=Ve,_.push({task:Fe,level:ue}),Fe.subtasks&&Fe.subtasks.length>0&&Fe.isExpanded){let ze=L?`${L}.${Ke}`:`${Ke}`;_.push(...ve(Fe.subtasks,ue+1,ze));}}return _},He=ve(e),Me=48,We=Math.max(He.length*a,600-Me),Nt=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,ct=se=>{C(se.id),Z(se.name),je(true);},it=se=>{G.trim()&&G!==e.find(ue=>ue.id===se)?.name&&T?.(se,G.trim()),C(null),Z(""),je(false);},lt=()=>{C(null),Z(""),je(false);},Vt=(se,ue)=>{ue.stopPropagation(),D?.(se.id);},zt=(se,ue)=>{ue.preventDefault(),fe.current=ue.clientY,Ie(se),xt.current=false,Tt(false),Ce({x:ue.clientX,y:ue.clientY});},pt=se=>{if(!Te||(Math.abs(se.clientY-fe.current)>Ze&&!xt.current&&(xt.current=true,Tt(true)),Ce({x:se.clientX,y:se.clientY}),!xt.current))return;if(F?.current){let pe=F.current,Fe=pe.getBoundingClientRect(),Ke=60,Ve=12;Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null);let ze=se.clientY-Fe.top,ht=Fe.bottom-se.clientY;if(ze<Ke&&pe.scrollTop>0){let wt=Math.round(Ve*(1-ze/Ke)),Bt=()=>{pe.scrollTop-=wt,xt.current&&pe.scrollTop>0&&(Qe.current=requestAnimationFrame(Bt));};Qe.current=requestAnimationFrame(Bt);}else if(ht<Ke&&pe.scrollTop<pe.scrollHeight-pe.clientHeight){let wt=Math.round(Ve*(1-ht/Ke)),Bt=()=>{pe.scrollTop+=wt,xt.current&&pe.scrollTop<pe.scrollHeight-pe.clientHeight&&(Qe.current=requestAnimationFrame(Bt));};Qe.current=requestAnimationFrame(Bt);}}let L=document.querySelectorAll("[data-task-row]"),_=null,q=null;L.forEach(pe=>{let Fe=pe.getBoundingClientRect(),Ke=pe.getAttribute("data-task-row");if(Ke&&Ke!==Te&&se.clientY>=Fe.top&&se.clientY<=Fe.bottom){_=Ke;let Ve=se.clientY-Fe.top,ze=Fe.height;Ve<ze*.25?q="above":Ve>ze*.75?q="below":q="child";}}),ot(_),nt(q);},Et=()=>{if(xt.current&&Te&&Be&&ae){if(ae==="child")w?.(Te,Be);else if(ae==="above"||ae==="below"){let se=(q,pe,Fe=null)=>{for(let Ke of q){if(Ke.id===pe)return Fe;if(Ke.subtasks){let Ve=se(Ke.subtasks,pe,Ke.id);if(Ve!==void 0)return Ve}}},ue=se(e,Te,null),L=se(e,Be,null),_=(q,pe,Fe,Ke)=>{let Ve=q.findIndex(wt=>wt.id===pe),ze=Ke?q.findIndex(wt=>wt.id===Fe):-1,ht=ae==="below"?Ve+1:Ve;return Ke&&ze!==-1&&ze<Ve&&(ht-=1),Math.max(0,ht)};if(L===null){let pe=_(e,Be,Te,ue===null);w?.(Te,null,pe);}else {let q=Rn(e,L);if(q?.subtasks){let pe=ue===L,Fe=_(q.subtasks,Be,Te,pe);w?.(Te,L,Fe);}}}}Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null),Ie(null),ot(null),nt(null),Ce(null),xt.current=false,Tt(false);};react.useEffect(()=>{if(Te)return document.addEventListener("mousemove",pt),document.addEventListener("mouseup",Et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",pt),document.removeEventListener("mouseup",Et),document.body.style.cursor="",document.body.style.userSelect="";}},[Te,Be,ae]);let mt=(se,ue,L)=>{let _=ue.subtasks&&ue.subtasks.length>0;switch(se.id){case "name":let q=X===ue.id,pe=Y===ue.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${L*20}px`},children:[w&&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:pe?1:.3},onMouseDown:z=>zt(ue.id,z),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ue.subtasks&&ue.subtasks.length>0?jsxRuntime.jsx("button",{onClick:z=>{z.stopPropagation(),c?.(ue.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ue.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),q?jsxRuntime.jsx("input",{ref:$e,type:"text",value:G,onChange:z=>Z(z.target.value),onKeyDown:z=>{z.key==="Enter"?it(ue.id):z.key==="Escape"&&lt();},onBlur:()=>it(ue.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:z=>z.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ue.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ue.parentId?"13px":"14px",fontWeight:ue.isMilestone?600:ue.parentId?400:600,letterSpacing:ue.parentId?"0":"-0.01em"},title:ue.name,children:[ue.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ue.wbsCode}),ue.isHighlighted&&ue.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ue.name}),ue.subtasks&&ue.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ue.progress||0),"%"]}),I&&ue.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&ue.cpmData&&jsxRuntime.jsxs("span",{style:{color:ue.cpmData.totalFloat<=0?"#EF4444":ue.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ue.cpmData.totalFloat),"d"]})]}),pe&&!q&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:z=>Vt(ue,z),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:z=>{z.stopPropagation(),ct(ue);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Ke=se.id==="startDate"?"startDate":"endDate",Ve=ue[Ke],ze=O?.taskId===ue.id&&O?.field===Ke,ht=z=>z?(typeof z=="string"?new Date(z):z).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:z=>z.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:z=>{if(!_)if(ze)ie(null);else {let et=z.currentTarget.getBoundingClientRect();ie({taskId:ue.id,field:Ke,month:Ve?typeof Ve=="string"?new Date(Ve):Ve:new Date,position:{top:et.bottom+4,left:et.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ht(Ve)}),_&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),ze&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ie(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:O?.position.top,left:O?.position.left},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let z=new Date,et=new Date(z);et.setDate(z.getDate()+1);let ye=new Date(z);ye.setDate(z.getDate()+7);let E=new Date(z);return E.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:et},{label:"Pr\xF3xima semana",date:ye},{label:"2 semanas",date:E}].map((_e,at)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:oa=>oa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:oa=>oa.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ue.id,{[Ke]:_e.date}),ie(null);},children:_e.label},at))})(),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:z=>z.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ue.id,{[Ke]:void 0}),ie(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:()=>ie(z=>z?{...z,month:new Date(z.month.getFullYear(),z.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:O?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ie(z=>z?{...z,month:new Date(z.month.getFullYear(),z.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((z,et)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:z},et))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let z=O?.month||new Date,et=z.getFullYear(),ye=z.getMonth(),E=new Date(et,ye,1).getDay(),me=new Date(et,ye+1,0).getDate(),_e=new Date,at=[];for(let Ut=E-1;Ut>=0;Ut--)at.push({day:new Date(et,ye,-Ut).getDate(),date:new Date(et,ye-1,new Date(et,ye,-Ut).getDate()),isCurrentMonth:false});for(let Ut=1;Ut<=me;Ut++)at.push({day:Ut,date:new Date(et,ye,Ut),isCurrentMonth:true});let oa=42-at.length;for(let Ut=1;Ut<=oa;Ut++)at.push({day:Ut,date:new Date(et,ye+1,Ut),isCurrentMonth:false});return at.map((Ut,Ua)=>{let ir=Ut.date.toDateString()===_e.toDateString(),Na=(Ve?typeof Ve=="string"?new Date(Ve):Ve:null)?.toDateString()===Ut.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:Ut.isCurrentMonth?Na?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Na?"#2E94FF":"transparent",boxShadow:ir&&!Na?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(ue.id,{[Ke]:Ut.date}),ie(null);},children:Ut.day},Ua)})})()})]})]})]}),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(ue)})});case "assignees":if(_)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let wt=r.filter(z=>ue.assignees?.some(et=>et.name===z.name||et.initials===z.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:z=>z.stopPropagation(),children:jsxRuntime.jsx(Jo,{assignedUsers:wt,availableUsers:r,onChange:z=>{let et=z.map(ye=>({id:ye.id,name:ye.name,initials:ye.initials,color:ye.color}));g?.(ue.id,{assignees:et.length>0?et:void 0});}})});case "status":if(_){let z=ue.progress===100?"\u2713":ue.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:z})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:z=>z.stopPropagation(),children:jsxRuntime.jsx(Lu,{status:ue.status||"todo",onChange:z=>{g?.(ue.id,{status:z,progress:z==="completed"?100:ue.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:ue.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[ue.progress,"%"]})]});case "priority":let Bt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ga={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ua=Bt[ue.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:z=>z.stopPropagation(),children:jsxRuntime.jsx(Yo,{priority:ua,onChange:z=>{z&&g?.(ue.id,{priority:ga[z]||"medium"});}})});default:return null}},It=se=>[{id:"hide",label:"Hide Column",icon:ca.Hide,onClick:()=>d(se),disabled:se==="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:()=>{}}],Ue=se=>se.subtasks&&se.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{D?.(se.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([se.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(se.id,se.name):f?.([se.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{n?.(se);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{D?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{g?.(se.id,{status:"todo",progress:0});},disabled:se.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{g?.(se.id,{status:"in-progress"});},disabled:se.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{g?.(se.id,{status:"completed",progress:100});},disabled:se.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([se.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(se.id,se.name):f?.([se.id]);}}],Re=p.filter(se=>se.visible),dt=Re.reduce((se,ue)=>se+ue.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:dt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Me}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:Re.map((se,ue)=>{let L=ue===Re.length-1,_=se.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:`${se.width}px`,minWidth:`${se.minWidth??(_?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:_&&Re.length===1?1:0,flexGrow:_&&Re.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ee({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:se.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:se.label,children:se.label}),se.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),K(se.id),Xe(q.clientX),re(se.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:B===se.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.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(Ci,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>V(!M),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"})}),M&&jsxRuntime.jsxs("div",{ref:ce,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:se=>se.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:()=>V(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",style:{minHeight:We},children:He.map(({task:se,level:ue},L)=>{let _=ee(se.id),q=Be===se.id,pe=q&&ae==="above",Fe=q&&ae==="below",Ke=q&&ae==="child",Ve={};return Ke&&(Ve.backgroundColor=`${t.accent}15`,Ve.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${Te===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Ke?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Ve},onMouseEnter:()=>$(se.id),onMouseLeave:()=>$(null),onClick:ze=>{let wt=Bn(e).map(ua=>ua.id),ga=navigator.platform.toUpperCase().indexOf("MAC")>=0?ze.metaKey:ze.ctrlKey;W(se.id,wt,ga,ze.shiftKey),s?.(se);},onDoubleClick:ze=>{ze.stopPropagation(),n?.(se);},onContextMenu:ze=>{ze.preventDefault(),Ee({isOpen:true,x:ze.clientX,y:ze.clientY,type:"task",task:se}),l?.(se,ze);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[pe&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Fe&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((ze,ht)=>{let wt=ht===Re.length-1,Bt=ze.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Bt?"justify-start":"justify-center"}`,style:{width:`${ze.width}px`,minWidth:`${ze.minWidth??(Bt?200:60)}px`,maxWidth:`${ze.maxWidth??2e3}px`,flexShrink:Bt&&Re.length===1?1:0,flexGrow:Bt&&Re.length===1?1:0,borderRight:wt?"none":`1px solid ${Y===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:mt(ze,se,Bt?ue:0)},`${se.id}-${ze.id}`)})]},se.id)})}),jsxRuntime.jsx(In,{isOpen:Q.isOpen,x:Q.x,y:Q.y,items:Q.type==="header"&&Q.columnId?It(Q.columnId):Q.type==="task"&&Q.task?Ue(Q.task):[],onClose:()=>Ee({...Q,isOpen:false}),theme:t}),gt&&St&&Te&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:St.x+12,top:St.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=He.find(ue=>ue.task.id===Te)?.task;return se?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:se.name})}):null})()}),document.body)]})}function bm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,v]=react.useState(0),[T,D]=react.useState(0),[N,k]=react.useState(null),[w,F]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:v,segmentDragOffsetX:T,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(X,C)=>{r("none"),d(null),g(null),l(X),i(C),D(0),f(null),v(0);}}}function Ei({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:v=false}){let T=bm(t,r),D=react.useRef(null),N=react.useRef(false),k=react.useRef(null),w=react.useRef(null),{dragMode:F,setDragMode:I,dragOffset:S,setDragOffset:Y,ghostX:$,setGhostX:X,ghostWidth:C,setGhostWidth:G,connectionLine:Z,setConnectionLine:$e,hoveredTaskId:B,setHoveredTaskId:K,activeZone:he,setActiveZone:Xe,draggedSegmentIndex:H,setDraggedSegmentIndex:re,draggedSegmentStartX:Q,setDraggedSegmentStartX:Ee,segmentDragOffsetX:Te,setSegmentDragOffsetX:Ie,hoveredSegmentIndex:Be,setHoveredSegmentIndex:ot,isHovered:ae,setIsHovered:nt,isDragging:fe,isResizing:Ze,isConnecting:xt,resetDragState:St}=T,Ce=18,gt=!!o.executionBarBg,Tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=gt?3:6,O=e.subtasks&&e.subtasks.length>0,ie=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let _=new Date(e.endDate);return _.setHours(0,0,0,0),_<L})()&&e.progress<100,M=b&&e.isCriticalPath,V=o.name==="neutral"||o.today==="#1C1917",ce=e.status==="completed"||e.progress===100,Ne={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=b&&e.isCriticalPath||ie?"#EF4444":e.color?e.color:e.priority&&Ne[e.priority]?Ne[e.priority]:o.taskBarPrimary,je=v?"default":fe?xt?"crosshair":Ze?"ew-resize":"grabbing":"grab",ve=v?"default":"ew-resize",Me=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),We=r<50,Nt=r<40;react.useEffect(()=>{x&&(!ae||fe||e.segments)&&x(null);},[ae,fe,e.segments,x]);let ct=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),it=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},lt=L=>Math.round(L/s)*s,Vt=L=>{let _=Math.round(L/s),q=new Date(n);return q.setDate(q.getDate()+_),q},zt=(L,_)=>{for(let q of g){if(q.id===e.id)continue;let pe=5;if(L>=q.x-pe&&L<=q.x+q.width+pe&&_>=q.y-pe&&_<=q.y+q.height+pe)return q.id}return null},pt=react.useCallback((L,_,q)=>{if(v)return;L.preventDefault(),L.stopPropagation();let pe=D.current?.ownerSVGElement;if(!pe)return;let Fe=pe.createSVGPoint();Fe.x=L.clientX,Fe.y=L.clientY;let Ke=Fe.matrixTransform(pe.getScreenCTM()?.inverse()),Ve=q!==void 0?q:t,ze=_;if(!ze){let ht=Ke.x-Ve;L.shiftKey?(ze="connect",$e({x:t+r,y:a+Ce/2})):L.ctrlKey||L.metaKey?ze="move":L.altKey?ze=ht<r/2?"resize-start":"resize-end":Nt?ht<r/2?ze="move":ze="resize-end":We?ht<=Me/2?ze="resize-start":ht>=r-Me/2?ze="resize-end":ze="move":ht<=Me?ze="resize-start":ht>=r-Me?ze="resize-end":ze="move";}N.current=false,I(ze),nt(false),Xe(null),ze==="move"?Y(Ke.x-Ve):ze==="connect"?$e({x:t+r,y:a+Ce/2}):Y(0),X(Ve),G(r);},[t,r,a,Ce,v]),Et=react.useCallback(L=>{let _=D.current?.ownerSVGElement;if(!_)return;let q=_.closest(".gantt-timeline-scroll");if(!q)return;let pe=q.getBoundingClientRect(),Fe=60,Ke=15,Ve=0;if(L.clientX<pe.left+Fe){let ze=pe.left+Fe-L.clientX;Ve=-Math.min(Ke,ze/2);}else if(L.clientX>pe.right-Fe){let ze=L.clientX-(pe.right-Fe);Ve=Math.min(Ke,ze/2);}return Ve!==0&&(q.scrollLeft+=Ve),Ve!==0},[]),mt=react.useCallback(L=>{if(F==="none")return;N.current=true,w.current=L;let _=D.current?.ownerSVGElement;if(!_)return;if(F==="move"||F==="resize-start"||F==="resize-end"){let Fe=Et(L);Fe&&!k.current?k.current=window.setInterval(()=>{w.current&&(Et(w.current),mt(w.current));},16):!Fe&&k.current&&(window.clearInterval(k.current),k.current=null);}let q=_.createSVGPoint();q.x=L.clientX,q.y=L.clientY;let pe=q.matrixTransform(_.getScreenCTM()?.inverse());if(F==="connect"){$e({x:pe.x,y:pe.y});let Fe=zt(pe.x,pe.y);K(Fe);}else if(F==="move"){let Fe=pe.x-S,Ke=lt(Fe);X(Ke),G(r);let Ve=Math.round((Ke-t)/s);if(y?.(e.id,Ve,true),e.segments&&e.segments.length>0&&H!==null){let ze=Ke-Q;Ie(ze);}}else if(F==="resize-start"){let Fe=pe.x,Ke=lt(Fe),Ve=t+r-Ke;Ve>=s&&(X(Ke),G(Ve));}else if(F==="resize-end"){let Fe=pe.x,Ve=lt(Fe)-t;Ve>=s&&G(Ve);}},[F,t,r,s,S,e,lt,H,Q,zt,K,$e,X,G,Ie,y,Et]),It=react.useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),w.current=null,F!=="none"){if(F==="connect")B&&m&&m(e,B),$e(null),K(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),_,q,pe=true;if(F==="move"){if(_=Vt($),q=new Date(_.getTime()+L),e.segments&&e.segments.length>0&&H!==null){let Fe=Math.round(Te/s),Ke=e.segments.map((wt,Bt)=>{if(Bt===H){let ga=new Date(wt.startDate),ua=new Date(wt.endDate);return ga.setDate(ga.getDate()+Fe),ua.setDate(ua.getDate()+Fe),{startDate:ga,endDate:ua}}return wt}),Ve=Ke.flatMap(wt=>[wt.startDate,wt.endDate]),ze=new Date(Math.min(...Ve.map(wt=>wt.getTime()))),ht=new Date(Math.max(...Ve.map(wt=>wt.getTime())));d?.({...e,segments:Ke},ze,ht),St(t,r);return}}else F==="resize-start"?(_=Vt($),q=e.endDate,_>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),pe=false)):F==="resize-end"?(_=e.startDate,q=Vt($+C),q.setDate(q.getDate()-1),q<_&&(console.warn("Invalid date range: end date must be after or equal to start date"),pe=false)):pe=false;pe&&_&&q&&(q.getTime()<_.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,_,q));}y?.(e.id,0,false),St(t,r);}},[F,$,C,e,d,B,m,t,r,s,Vt,Te,H,St,y]);react.useEffect(()=>{if(F==="none")return;let L=q=>{mt(q);},_=()=>{It();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",_),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",_),k.current&&(window.clearInterval(k.current),k.current=null);}},[F,mt,It]);let Ue=fe&&!xt?$:t,Re=fe&&!xt?C:r,dt=l.taskClass(e),se=24,ue=b?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:D,"data-task-bar":"true",style:{opacity:ue,transition:"opacity 300ms ease"},onClick:()=>{!fe&&!N.current&&c?.(e),N.current=false;},onDoubleClick:L=>{!fe&&!N.current&&(L.stopPropagation(),i?.(e));},onContextMenu:L=>{L.preventDefault(),p?.(e,L);},onMouseEnter:()=>!fe&&nt(true),onMouseMove:L=>{x&&ae&&!fe&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{fe||(nt(false),Xe(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+se,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!fe&&!We&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Me,height:Ce,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>Xe("resize-start"),onMouseDown:L=>pt(L,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Me,y:a,width:r-Me*2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Xe("move"),onMouseDown:L=>pt(L,"move")}),jsxRuntime.jsx("rect",{x:t+r-Me,y:a,width:Me,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>Xe("resize-end"),onMouseDown:L=>pt(L,"resize-end")})]}),ae&&!fe&&Nt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Xe("move"),onMouseDown:L=>pt(L,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>Xe("resize-end"),onMouseDown:L=>pt(L,"resize-end")}),ae&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),fe&&!xt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$,y:a,width:C,height:Ce,rx:Qe,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!fe&&(()=>{let L=e.baselineStartDate.getTime(),_=e.baselineEndDate.getTime(),q=n.getTime(),pe=864e5,Fe=(L-q)/pe,Ke=(_-L)/pe,Ve=Fe*s,ze=Math.max(Ke*s,s),ht=Ue+Re,wt=Ve+ze,Bt=e.endDate?.getTime()??0,ga=Math.ceil((Bt-_)/pe),ua=ga>0,z=ga<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Ve,y:a,width:ze,height:Ce,rx:Qe,fill:"none",stroke:Tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ua&&ht>wt&&jsxRuntime.jsx("rect",{x:wt,y:a,width:ht-wt,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),ua&&jsxRuntime.jsxs("text",{x:Math.max(ht,wt)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",ga,"d"]}),z&&jsxRuntime.jsxs("text",{x:ht+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[ga,"d"]})]})})(),!e.segments&&gt&&O&&(()=>{let _=a+(Ce-8)/2,q=4,pe=e.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ke=e.startDate&&Fe>=e.startDate,Ve=e.endDate&&(()=>{let ua=new Date(e.endDate);return ua.setHours(0,0,0,0),Fe>ua})(),ze=e.startDate&&Fe<e.startDate,ht=1;if(Ke&&e.startDate&&e.endDate&&!ze){let ua=new Date(e.startDate);ua.setHours(0,0,0,0);let z=new Date(e.endDate);z.setHours(0,0,0,0);let et=Math.max(1,(z.getTime()-ua.getTime())/(1e3*60*60*24)),E=Math.min((Fe.getTime()-ua.getTime())/(1e3*60*60*24),et)/et*100;ht=E>0?pe/E:1;}let wt;pe>=100?wt="#00E5CC":ze?wt="#4B5563":Ve&&pe<100?wt="#EF4444":ht>=.95?wt="#22C55E":ht>=.8?wt="#F59E0B":wt="#EF4444";let Bt=Math.max(pe/100*Re,pe>0?q*2:0),ga=Re>100&&pe>0;return jsxRuntime.jsxs("g",{"data-task-class":dt,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ue,y:_,width:Re,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),pe>0&&jsxRuntime.jsx("rect",{x:Ue,y:_,width:Bt,height:8,rx:q,fill:wt}),ga&&jsxRuntime.jsxs("text",{x:Ue+Bt+6,y:_+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(pe),"%"]})]})})(),!e.segments&&gt&&!O&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue,y:a,width:Re,height:Ce,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":dt,initial:{opacity:0,scale:.95},animate:{opacity:fe&&!xt?.15:e.parentId?.6:1,scale:ae&&!fe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>pt(L),style:{cursor:je,pointerEvents:"all"}}),!e.segments&&!gt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue,y:a,width:Re,height:Ce,rx:Qe,fill:ee,"data-task-class":dt,initial:{opacity:0,scale:.95},animate:{opacity:fe&&!xt?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!fe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:O?void 0:L=>pt(L),style:{cursor:O?"default":je,pointerEvents:"all"}}),gt&&(ie||M)&&!e.segments&&jsxRuntime.jsx("rect",{x:Ue,y:a,width:Re,height:Ce,rx:Qe,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!O&&jsxRuntime.jsx("rect",{x:Ue,y:a,width:Math.max(Re*(e.progress/100),Qe*2),height:Ce,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!O&&e.progress<100&&(()=>{let L=e.progress>0?Re*(e.progress/100):0,_=Ue+L,q=Re-L,pe=e.progress===0?Qe:0,Fe=e.progress===0?Ue:_,Ke=e.progress===0?Re:q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Fe,y:a,width:Ke,height:Ce,rx:pe,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Fe,y:a,width:Ke,height:Ce,rx:pe,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),gt&&!e.segments&&e.progress>0&&e.progress<100&&!O&&!fe&&(()=>{let L=Ue+Re*(e.progress/100),_=8,q=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:L,cy:a+Ce/2,r:_,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:L,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,_)=>{let q=(L.startDate.getTime()-n.getTime())/864e5*s,Fe=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Ke=fe&&F==="move"&&H===_,Ve=Be===_,ze=Ke?q+Te:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!fe&&ot(_),onMouseLeave:()=>!fe&&ot(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:Fe,height:Ce,rx:Qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Ke||e.parentId?.6:Ve?.9:.8,scale:Ve&&!fe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ht=>{ht.stopPropagation(),re(_),Ee(q),pt(ht,void 0,q);},style:{cursor:je,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ze,y:a,width:Fe*(e.progress/100),height:Ce,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${_}`)}),V&&(ie||M)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M&&!ie&&jsxRuntime.jsx("rect",{x:Ue,y:a,width:Re,height:Ce,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ie&&jsxRuntime.jsx("rect",{x:Ue,y:a,width:Re,height:Ce,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Re>60&&!e.segments&&!(gt&&O)&&(()=>{let L=l.taskLabel(e),_=typeof L=="string"?L:e.name,q=_.length>Math.floor(Re/8)?`${_.substring(0,Math.floor(Re/8))}...`:_;return jsxRuntime.jsx("text",{x:Ue+8,y:a+Ce/2,dominantBaseline:"middle",fill:ce?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ce?"line-through":"none"},children:q})})(),!fe&&!e.segments&&!O&&e.progress>0&&e.progress<100&&(gt?jsxRuntime.jsxs("text",{x:Ue+Re+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Re>100?jsxRuntime.jsxs("text",{x:Ue+Re-12,y:a+Ce/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&&Re>80&&!fe&&!e.segments&&!(gt&&O)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ue+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ue+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||Ze)&&!xt&&!e.segments&&!O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ue-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>Xe("resize-start"),onMouseLeave:()=>Xe(null),onMouseDown:L=>{L.stopPropagation(),pt(L,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-start"||F==="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:Ue+Re-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>Xe("resize-end"),onMouseLeave:()=>Xe(null),onMouseDown:L=>{L.stopPropagation(),pt(L,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue+Re-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-end"||F==="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:ae&&!fe&&!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+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Xe("connect"),onMouseLeave:()=>Xe(null),onMouseDown:L=>{L.stopPropagation(),pt(L,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),xt&&Z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:Z.x,y2:Z.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Z.x,cy:Z.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||fe)&&!xt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue-1,y:a-1,width:Re+2,height:Ce+2,rx:Qe+1,fill:"none",stroke:fe?o.accent:gt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:gt?1:2,opacity:fe||gt?.6:.4,initial:{opacity:0},animate:{opacity:fe||gt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:$,y1:0,x2:$,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:$+C,y1:0,x2:$+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!fe&&!e.segments&&!x&&(()=>{let q=a<100,pe=q?a+Ce+13:a-82-13,Fe=q?`M ${Ue+Re/2-6} ${a+Ce+3} L ${Ue+Re/2} ${a+Ce+13} L ${Ue+Re/2+6} ${a+Ce+3}`:`M ${Ue+Re/2-6} ${a-13} L ${Ue+Re/2} ${a-3} L ${Ue+Re/2+6} ${a-13}`,Ke=pe+22,Ve=pe+40,ze=pe+55,ht=pe+70,wt=q?pe+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Fe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ue+Re/2-120,y:pe,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Ue+Re/2,y:Ke,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ue+Re/2-110,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ue+Re/2-70,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.startDate)}),jsxRuntime.jsx("text",{x:Ue+Re/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ue+Re/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.endDate)}),jsxRuntime.jsx("text",{x:Ue+Re/2+10,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ue+Re/2+65,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it()}),jsxRuntime.jsx("text",{x:Ue+Re/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ue+Re/2+65,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ue+Re/2-110,y:ht,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ue+Re/2-50,y:ht,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Bt=>Bt.name).join(", ").substring(0,30),e.assignees.map(Bt=>Bt.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:Ue+Re/2,y:wt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Nt?"Left: move \u2022 Right: resize":We?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Bd=260,On=8,xm=16,Sv=-12;function vm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:v,mouseY:T}=e,D=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null,N=b.lastActivity!=null,k=(D?155:105)+(N?28:0),w=v+xm,F=T+Sv-k;w+Bd>window.innerWidth-On&&(w=v-Bd-xm),w<On&&(w=On);let I=F<On;I&&(F=T+20),F+k>window.innerHeight-On&&(F=window.innerHeight-On-k),o({left:w,top:F,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={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"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},p=b=>{if(b==null||b===0)return "N/A";let v=Math.floor(b/60),T=b%60;return v===0?`${T}m`:T===0?`${v}h`:`${v}h ${T}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Bd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,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:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(Mi,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:y,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]}),s.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:s.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:s.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:s.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
126
126
  @keyframes gantt-tooltip-fade {
127
127
  from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
128
128
  to { opacity: 1; transform: translateY(0); }
129
129
  }
130
- `})]});return reactDom.createPortal(f,document.body)}function Di({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 hs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[y,x]=react.useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,v=20,C=!b&&a<=e,N,T,k=a-e,w=e+k/2;T=w;let F=8;if(n==="squared")if(b)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let we=e+15,Oe=a-v,Be=f?t+20:t-20;T=Oe;let lt=f?1:-1;N=`M ${e} ${t} L ${we-F} ${t} Q ${we} ${t} ${we} ${t+lt*F} L ${we} ${Be-lt*F} Q ${we} ${Be} ${we-F} ${Be} L ${Oe+F} ${Be} Q ${Oe} ${Be} ${Oe} ${Be+lt*F} L ${Oe} ${r-lt*F} Q ${Oe} ${r} ${Oe+F} ${r} L ${a} ${r}`;}else {T=a-v;let Le=f?1:-1;N=`M ${e} ${t} L ${T-F} ${t} Q ${T} ${t} ${T} ${t+Le*F} L ${T} ${r-Le*F} Q ${T} ${r} ${T+F} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let I=6,S=5,X=`M ${a} ${r} L ${a-I} ${r-S/2} L ${a-I} ${r+S/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),$=p||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),A=d||1,q=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Z="#f87171",Ee="rgba(248, 113, 113, 0.15)",B=T,_=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),_=t;else if(C){let Le=e+15,we=a-v,Oe=f?t+20:t-20,Be=[[e,t,Le,t],[Le,t,Le,Oe],[Le,Oe,we,Oe],[we,Oe,we,r],[we,r,a,r]],lt=1/0,ee={x:B,y:_};for(let ct of Be){let pe=he(y.x,y.y,ct[0],ct[1],ct[2],ct[3]),et=Math.hypot(y.x-pe.x,y.y-pe.y);et<lt&&(lt=et,ee=pe);}B=ee.x,_=ee.y;}else {let Le=[[e,t,T,t],[T,t,T,r],[T,r,a,r]],we=1/0,Oe={x:B,y:_};for(let Be of Le){let lt=he(y.x,y.y,Be[0],Be[1],Be[2],Be[3]),ee=Math.hypot(y.x-lt.x,y.y-lt.y);ee<we&&(we=ee,Oe=lt);}B=Oe.x,_=Oe.y;}else {let Le=w,we=t,Oe=w,Be=r,lt=1/0,ee=B,ct=_;for(let pe=0;pe<=1;pe+=.02){let et=1-pe,nt=et*et*et*e+3*et*et*pe*Le+3*et*pe*pe*Oe+pe*pe*pe*a,Ut=et*et*et*t+3*et*et*pe*we+3*et*pe*pe*Be+pe*pe*pe*r,Ce=Math.hypot(y.x-nt,y.y-Ut);Ce<lt&&(lt=Ce,ee=nt,ct=Ut);}B=ee,_=ct;}function he(Le,we,Oe,Be,lt,ee){let ct=lt-Oe,pe=ee-Be,et=ct*ct+pe*pe;if(et===0)return {x:Oe,y:Be};let nt=((Le-Oe)*ct+(we-Be)*pe)/et;return nt=Math.max(0,Math.min(1,nt)),{x:Oe+nt*ct,y:Be+nt*pe}}let Ye=Le=>{let we=Le.currentTarget.ownerSVGElement;if(!we)return;let Oe=we.getScreenCTM();if(!Oe)return;let Be=Oe.inverse();x({x:Be.a*Le.clientX+Be.c*Le.clientY+Be.e,y:Be.b*Le.clientX+Be.d*Le.clientY+Be.f});},z=()=>{g(false),x(null),c?.(false);},re=()=>{g(true),c?.(true);},J=Le=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Le,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:we=>{we.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:_,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:_,r:9,fill:Ee,stroke:Z,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:_-3,x2:B+3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:_-3,x2:B-3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:Ye,children:[jsxRuntime.jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:X,fill:q,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:q,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Ye,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:X,fill:q,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:q,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Ye,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:N,fill:"none",stroke:$,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:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:X,fill:$,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:$,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Fi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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 o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.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 o=r.parentId;for(;o;){let s=Se.findTaskById(e,o);if(s)a.unshift(s),o=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(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(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(o=>a.dependencies.includes(o.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 o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Se.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>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'),o=new a,s=Se.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=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",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Se.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let f=h.assignees.map(b=>b.id?s[b.id]:void 0).filter(b=>b!=null&&b>0);return f.length===0?n:f.reduce((b,v)=>b+v,0)/f.length},c=new Map,i=(h,f="")=>{[...h].sort((v,C)=>(v.position??0)-(C.position??0)).forEach((v,C)=>{let N=f?`${f}.${C+1}`:`${C+1}`;c.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(e);let p=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let f=h.startDate&&h.endDate?Se.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,v=h.timeLoggedMinutes,C=h.soldEffortMinutes,N=typeof b=="number"?+(b/60).toFixed(1):0,T=typeof v=="number"?+(v/60).toFixed(1):0,k=typeof C=="number"?+(C/60).toFixed(1):0,w=h._costRate>0?h._costRate:l(h),F={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Se.formatDate(h.startDate):"","End Date":h.endDate?Se.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":T||"","Quoted (h)":k||""};p&&(F["$ Estimated"]=N>0&&w>0?Math.round(N*w):"",F["$ Executed"]=T>0&&w>0?Math.round(T*w):"",F["$ Quoted"]=k>0&&w>0?Math.round(k*w):"",F["Rate ($/h)"]=w>0?w:"");let I=h.weight;return F["Weight (%)"]=typeof I=="number"&&I>0?I:"",F["Is Milestone"]=h.isMilestone?"Yes":"No",F}),m=a?.projectName||"";if(m||d.length>0){let h=0,f=0,b=0,v=0,C=0,N=0,T=0,k=0,w=o.filter(S=>S.startDate).map(S=>S.startDate.getTime()),F=o.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of d)typeof S["Estimated (h)"]=="number"&&(h+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(f+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(b+=S["Quoted (h)"]),p&&(typeof S["$ Estimated"]=="number"&&(v+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(C+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(N+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(T+=S["Progress (%)"],k++);let I={WBS:"0","Task Name":`\u{1F4CB} ${m||"PROJECT TOTAL"}`,"Start Date":w.length>0?Se.formatDate(new Date(Math.min(...w))):"","End Date":F.length>0?Se.formatDate(new Date(Math.max(...F))):"","Duration (days)":w.length>0&&F.length>0?Se.calculateDuration(new Date(Math.min(...w)),new Date(Math.max(...F))):"","Progress (%)":k>0?Math.round(T/k):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+f.toFixed(1)||"","Quoted (h)":+b.toFixed(1)||""};p&&(I["$ Estimated"]=v||"",I["$ Executed"]=C||"",I["$ Quoted"]=N||"",I["Rate ($/h)"]=""),I["Is Milestone"]="No",d.unshift(I);}let g=r.utils.json_to_sheet(d),y=[{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}];g["!cols"]=y;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let h=new Date,f=v=>String(v).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${f(h.getMonth()+1)}-${f(h.getDate())}_${f(h.getHours())}${f(h.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Se.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Se.getEarliestStartDate(e)||new Date,l=Se.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let y=o.get(m.id),x=m.startDate&&m.endDate?Se.calculateDuration(m.startDate,m.endDate):0,h=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
130
+ `})]});return reactDom.createPortal(f,document.body)}function Mi({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 vs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[y,x]=react.useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,v=20,T=!b&&a<=e,D,N,k=a-e,w=e+k/2;N=w;let F=8;if(n==="squared")if(b)D=`M ${e} ${t} L ${a} ${r}`;else if(T){let Te=e+15,Ie=a-v,Be=f?t+20:t-20;N=Ie;let ot=f?1:-1;D=`M ${e} ${t} L ${Te-F} ${t} Q ${Te} ${t} ${Te} ${t+ot*F} L ${Te} ${Be-ot*F} Q ${Te} ${Be} ${Te-F} ${Be} L ${Ie+F} ${Be} Q ${Ie} ${Be} ${Ie} ${Be+ot*F} L ${Ie} ${r-ot*F} Q ${Ie} ${r} ${Ie+F} ${r} L ${a} ${r}`;}else {N=a-v;let Ee=f?1:-1;D=`M ${e} ${t} L ${N-F} ${t} Q ${N} ${t} ${N} ${t+Ee*F} L ${N} ${r-Ee*F} Q ${N} ${r} ${N+F} ${r} L ${a} ${r}`;}else D=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let I=6,S=5,Y=`M ${a} ${r} L ${a-I} ${r-S/2} L ${a-I} ${r+S/2} Z`,$=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),X=p||($?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),C=d||1,G=o.dependencyHover||($?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Z="#f87171",$e="rgba(248, 113, 113, 0.15)",B=N,K=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),K=t;else if(T){let Ee=e+15,Te=a-v,Ie=f?t+20:t-20,Be=[[e,t,Ee,t],[Ee,t,Ee,Ie],[Ee,Ie,Te,Ie],[Te,Ie,Te,r],[Te,r,a,r]],ot=1/0,ae={x:B,y:K};for(let nt of Be){let fe=he(y.x,y.y,nt[0],nt[1],nt[2],nt[3]),Ze=Math.hypot(y.x-fe.x,y.y-fe.y);Ze<ot&&(ot=Ze,ae=fe);}B=ae.x,K=ae.y;}else {let Ee=[[e,t,N,t],[N,t,N,r],[N,r,a,r]],Te=1/0,Ie={x:B,y:K};for(let Be of Ee){let ot=he(y.x,y.y,Be[0],Be[1],Be[2],Be[3]),ae=Math.hypot(y.x-ot.x,y.y-ot.y);ae<Te&&(Te=ae,Ie=ot);}B=Ie.x,K=Ie.y;}else {let Ee=w,Te=t,Ie=w,Be=r,ot=1/0,ae=B,nt=K;for(let fe=0;fe<=1;fe+=.02){let Ze=1-fe,xt=Ze*Ze*Ze*e+3*Ze*Ze*fe*Ee+3*Ze*fe*fe*Ie+fe*fe*fe*a,St=Ze*Ze*Ze*t+3*Ze*Ze*fe*Te+3*Ze*fe*fe*Be+fe*fe*fe*r,Ce=Math.hypot(y.x-xt,y.y-St);Ce<ot&&(ot=Ce,ae=xt,nt=St);}B=ae,K=nt;}function he(Ee,Te,Ie,Be,ot,ae){let nt=ot-Ie,fe=ae-Be,Ze=nt*nt+fe*fe;if(Ze===0)return {x:Ie,y:Be};let xt=((Ee-Ie)*nt+(Te-Be)*fe)/Ze;return xt=Math.max(0,Math.min(1,xt)),{x:Ie+xt*nt,y:Be+xt*fe}}let Xe=Ee=>{let Te=Ee.currentTarget.ownerSVGElement;if(!Te)return;let Ie=Te.getScreenCTM();if(!Ie)return;let Be=Ie.inverse();x({x:Be.a*Ee.clientX+Be.c*Ee.clientY+Be.e,y:Be.b*Ee.clientX+Be.d*Ee.clientY+Be.f});},H=()=>{g(false),x(null),c?.(false);},re=()=>{g(true),c?.(true);},Q=Ee=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ee,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Te=>{Te.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:K,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:K,r:9,fill:$e,stroke:Z,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:K-3,x2:B+3,y2:K+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:K-3,x2:B-3,y2:K+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:H,onMouseMove:Xe,children:[jsxRuntime.jsx("path",{d:D,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:G,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:G,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:Y,fill:G,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:G,opacity:.9,style:{pointerEvents:"none"}}),Q({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:H,onMouseMove:Xe,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:D,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:G,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:Y,fill:G,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:G,style:{pointerEvents:"none"}}),Q({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:H,onMouseMove:Xe,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:D,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:X,strokeWidth:C,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:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:Y,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 Li({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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 De={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.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=De.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=De.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=De.findTaskById(e,o);if(s)a.unshift(s),o=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=De.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(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=De.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=De.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)=>De.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=De.findTaskById(e,t);return !a||!a.dependencies?[]:De.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>De.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>De.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=De.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>De.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=De.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?De.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?De.formatDate(c.startDate):"N/A",c.endDate?De.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=De.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let f=h.assignees.map(b=>b.id?s[b.id]:void 0).filter(b=>b!=null&&b>0);return f.length===0?n:f.reduce((b,v)=>b+v,0)/f.length},c=new Map,i=(h,f="")=>{[...h].sort((v,T)=>(v.position??0)-(T.position??0)).forEach((v,T)=>{let D=f?`${f}.${T+1}`:`${T+1}`;c.set(v.id,D),v.subtasks?.length&&i(v.subtasks,D);});};i(e);let p=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let f=h.startDate&&h.endDate?De.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,v=h.timeLoggedMinutes,T=h.soldEffortMinutes,D=typeof b=="number"?+(b/60).toFixed(1):0,N=typeof v=="number"?+(v/60).toFixed(1):0,k=typeof T=="number"?+(T/60).toFixed(1):0,w=h._costRate>0?h._costRate:l(h),F={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?De.formatDate(h.startDate):"","End Date":h.endDate?De.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":D||"","Logged (h)":N||"","Quoted (h)":k||""};p&&(F["$ Estimated"]=D>0&&w>0?Math.round(D*w):"",F["$ Executed"]=N>0&&w>0?Math.round(N*w):"",F["$ Quoted"]=k>0&&w>0?Math.round(k*w):"",F["Rate ($/h)"]=w>0?w:"");let I=h.weight;return F["Weight (%)"]=typeof I=="number"&&I>0?I:"",F["Is Milestone"]=h.isMilestone?"Yes":"No",F}),m=a?.projectName||"";if(m||d.length>0){let h=0,f=0,b=0,v=0,T=0,D=0,N=0,k=0,w=o.filter(S=>S.startDate).map(S=>S.startDate.getTime()),F=o.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of d)typeof S["Estimated (h)"]=="number"&&(h+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(f+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(b+=S["Quoted (h)"]),p&&(typeof S["$ Estimated"]=="number"&&(v+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(T+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(D+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(N+=S["Progress (%)"],k++);let I={WBS:"0","Task Name":`\u{1F4CB} ${m||"PROJECT TOTAL"}`,"Start Date":w.length>0?De.formatDate(new Date(Math.min(...w))):"","End Date":F.length>0?De.formatDate(new Date(Math.max(...F))):"","Duration (days)":w.length>0&&F.length>0?De.calculateDuration(new Date(Math.min(...w)),new Date(Math.max(...F))):"","Progress (%)":k>0?Math.round(N/k):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+f.toFixed(1)||"","Quoted (h)":+b.toFixed(1)||""};p&&(I["$ Estimated"]=v||"",I["$ Executed"]=T||"",I["$ Quoted"]=D||"",I["Rate ($/h)"]=""),I["Is Milestone"]="No",d.unshift(I);}let g=r.utils.json_to_sheet(d),y=[{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}];g["!cols"]=y;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let h=new Date,f=v=>String(v).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${f(h.getMonth()+1)}-${f(h.getDate())}_${f(h.getHours())}${f(h.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=De.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=De.getEarliestStartDate(e)||new Date,l=De.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let y=o.get(m.id),x=m.startDate&&m.endDate?De.calculateDuration(m.startDate,m.endDate):0,h=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${o.get(f)}</PredecessorUID>
134
134
  <Type>1</Type>
@@ -358,14 +358,14 @@
358
358
  </Calendars>
359
359
  <Tasks>${c}
360
360
  </Tasks>
361
- </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let m=d+p;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),m=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;m=Math.min(m,x);}let g=m-p;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,c=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.set(m,{es:x,ef:x+y});let h=s.get(m)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&i.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=p;if(h.length>0)for(let b of h){let v=d.get(b);v&&(f=Math.min(f,v.ls));}d.set(g,{ls:f-x,lf:f});}for(let m of c){let g=l.get(m),y=d.get(m),x=y.ls-g.es,h=s.get(m)||[],f;h.length>0?f=Math.min(...h.map(b=>l.get(b).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.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 o=Se.getDependentTasks(e,t);if(o.length===0){let l=Se.getLatestEndDate(e);if(!l)return null;let c=Se.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=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 g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),p<y&&(p=y);}let d=Se.calculateEndDate(p,i),m=g=>g.map(y=>y.id===c.id?{...y,startDate:p,endDate:d}:y.subtasks?{...y,subtasks:m(y.subtasks)}:y);l=m(l),l=Se.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),p=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(S=>S.id===f.id);if(b===-1)continue;let v=f.startDate.getTime(),N=(f.endDate.getTime()-v)/p,k=(v-i)/p*s,w=k+y*s,F=Math.max(N*s,s),I=l+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:w,width:F,y:I,rowIndex:b,daysDelta:y,color:f.color}),m(f.id,y,x);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ai({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:v=true,highlightWeekends:C=true,canEditTask:N}){let k=Br(),w=react.useRef(null),[F,I]=react.useState([]),[S,X]=react.useState(null),[O,$]=react.useState(null),[A,q]=react.useState(null),Z=react.useRef(false),[Ee,B]=react.useState(new Set),[_,he]=react.useState(null),Ye=react.useCallback(H=>{if(A&&!Z.current){let ne=H.target,D=false;for(;ne&&ne!==H.currentTarget;){if(ne.getAttribute?.("data-dependency-line")==="true"||ne.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}ne=ne.parentElement;}D||q(null);}},[A]),z=react.useCallback(H=>{$(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Le=re*J*n,we=H=>{let ne=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=ne.getUTCDay()||7;ne.setUTCDate(ne.getUTCDate()+4-D);let K=new Date(Date.UTC(ne.getUTCFullYear(),0,1));return Math.ceil(((ne.getTime()-K.getTime())/864e5+1)/7)},Oe=H=>{let ne=H.getDay();return ne===0||ne===6},Be=react.useCallback(H=>{let ne=Math.round(H/(J*n)),D=new Date(o);return D.setDate(D.getDate()+ne),D},[o,J,n]),lt=react.useCallback((H,ne)=>{if(ne.startDate&&ne.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let K=D.createSVGPoint();K.x=H.clientX,K.y=H.clientY;let ue=K.matrixTransform(D.getScreenCTM()?.inverse()),Te=Be(ue.x),V=new Date(Te);V.setDate(V.getDate()+1),he(null),y?.(ne,Te,V);},[Be,y]),ee=react.useCallback((H,ne,D)=>{let K=H.currentTarget.ownerSVGElement;if(!K)return;let ue=K.createSVGPoint();ue.x=H.clientX,ue.y=H.clientY;let Te=ue.matrixTransform(K.getScreenCTM()?.inverse()),V=Be(Te.x),$e=Math.round(Te.x/(J*n))*J*n;he({taskId:ne.id,x:$e,y:D*a+a/2,date:V});},[Be,J,n,a]),ct=react.useCallback(()=>{he(null);},[]),pe=react.useMemo(()=>{let H=ue=>ue.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let V=H(Te.subtasks),te=V.filter($e=>$e.startDate&&$e.endDate);if(te.length>0){let $e=te.map(Ge=>Ge.startDate.getTime()),Ne=te.map(Ge=>Ge.endDate.getTime()),He=new Date(Math.min(...$e)),Fe=new Date(Math.max(...Ne));return {...Te,subtasks:V,startDate:He,endDate:Fe}}return {...Te,subtasks:V}}return Te}),ne=(ue,Te=[])=>{let V=[...ue].sort((te,$e)=>(te.position??0)-($e.position??0));for(let te of V)Te.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&ne(te.subtasks,Te);return Te},D=H(e);return ne(D)},[e]),et=react.useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let ne=H.startDate.getTime(),D=H.endDate.getTime(),K=o.getTime(),ue=(ne-K)/(1e3*60*60*24),Te=(D-ne)/(1e3*60*60*24)+1,V=ue*J*n,te=Math.max(J*n,40),$e=Math.max(Te*J*n,te);return {x:V,width:$e}},[o,J,n]),nt=react.useMemo(()=>pe.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:ne,width:D}=et(H),ue=pe.findIndex(Te=>Te.id===H.id)*a+(a-18)/2;return {id:H.id,x:ne,y:ue,width:D,height:18}}),[pe,et]),Ut=react.useCallback((H,ne,D)=>{if(!D){I([]),X(null);return}if(X({taskId:H,daysDelta:ne}),ne===0){I([]);return}let K=Se.calculateCascadePreview(e,H,ne,pe,o,J*n,a,48);I(K);},[e,pe,o,J,n,a,48]),Ce=react.useCallback((H,ne)=>{if(!S)return ne;let D=J*n,K=S.daysDelta*D;if(H===S.taskId)return {x:ne.x+K,width:ne.width};let ue=F.find(Te=>Te.taskId===H);return ue?{x:ue.previewX,width:ue.width}:ne},[S,F,J,n]),mt=react.useMemo(()=>{let H=[],ne=new Date(o);for(;ne<=s;){let ue=(ne.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(ne),label:ne.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ue}),ne.setDate(ne.getDate()+1);else if(r==="week"){let Te=we(ne);H.push({date:new Date(ne),label:`${k.labels.week} ${Te}`,x:ue}),ne.setDate(ne.getDate()+7);}else H.push({date:new Date(ne),label:ne.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ue}),ne.setMonth(ne.getMonth()+1);}return H},[o,s,r,J,n,l,k.labels.week]),Dt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),Xe=Math.max(pe.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(Le,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Le,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),mt.map((H,ne)=>jsxRuntime.jsxs("g",{children:[ne>0&&jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${ne}`)),Dt>=0&&Dt<=Le&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:Dt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:Dt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${Dt-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:k.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:w,width:Math.max(Le,1e3),height:Xe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ye,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:"#2E94FF",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(Le,1e3),height:Xe,fill:t.bgPrimary}),pe.map((H,ne)=>jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Math.max(Le,1e3),height:a,fill:ne%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),mt.map((H,ne)=>ne>0?jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ne}`):null),C&&mt.map((H,ne)=>{let D=mt[ne+1]?.x||Le;return Oe(H.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:H.x,y:0,width:D-H.x,height:pe.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:H.x,y:0,width:D-H.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ne}`):null}),pe.map((H,ne)=>{let D=H.startDate&&H.endDate;return jsxRuntime.jsx("g",{children:!D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Le,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>lt(K,H),onMouseMove:K=>ee(K,H,ne),onMouseLeave:()=>{ct();}},`clickable-${H.id}`),_&&_.taskId===H.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:_.x,y1:ne*a+4,x2:_.x,y2:ne*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:_.x,cy:_.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:_.x,cy:_.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${_.x}, ${ne*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:_.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!_||_.taskId!==H.id)&&jsxRuntime.jsx("text",{x:Dt>0?Dt:100,y:ne*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),pe.map((H,ne)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:K}=et(H),ue=ne*a+(a-18)/2,Te=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsxRuntime.jsx(Fi,{task:H,x:D+K/2,y:ue+12,theme:t,onClick:d},H.id);if(Te){let V=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,$e=ue+(a-18)/2+(18-te)/2,Ne=4,He=H.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ge=H.startDate&&Fe>=H.startDate,ht=H.endDate&&(()=>{let yt=new Date(H.endDate);return yt.setHours(0,0,0,0),Fe>yt})(),dt=H.startDate&&Fe<H.startDate,gt=1;if(Ge&&H.startDate&&H.endDate&&!dt){let yt=new Date(H.startDate);yt.setHours(0,0,0,0);let Ot=new Date(H.endDate);Ot.setHours(0,0,0,0);let We=Math.max(1,(Ot.getTime()-yt.getTime())/(1e3*60*60*24)),at=Math.min((Fe.getTime()-yt.getTime())/(1e3*60*60*24),We)/We*100;gt=at>0?He/at:1;}let ot;He>=100?ot="#00E5CC":dt?ot="#4B5563":ht&&He<100?ot="#EF4444":gt>=.95?ot="#22C55E":gt>=.8?ot="#F59E0B":ot="#EF4444";let jt=Math.max(He/100*K,He>0?Ne*2:0),Et=K>100&&He>0,Nt=H.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(H),onContextMenu:yt=>{yt.preventDefault(),yt.stopPropagation(),g?.(H,yt);},onMouseMove:yt=>{z({task:H,x:D,y:$e,width:K,height:te,showBelow:$e<100,mouseX:yt.clientX,mouseY:yt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?Nt?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:D,y:ue,width:K,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:D,y:$e,width:K,height:te,rx:Ne,fill:V?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),He>0&&jsxRuntime.jsx("rect",{x:D,y:$e,width:jt,height:te,rx:Ne,fill:ot}),b&&Nt&&jsxRuntime.jsx("rect",{x:D,y:$e,width:K,height:te,rx:Ne,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Et&&jsxRuntime.jsxs("text",{x:D+jt+6,y:$e+te/2,dominantBaseline:"central",fill:V?"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(He),"%"]})]},H.id)}return jsxRuntime.jsx(Ni,{task:H,x:D,y:ue,width:K,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:nt,onDragMove:Ut,onHoverChange:z,showBaseline:f,showTaskBarLabels:p,showCriticalPath:b,readOnly:N?!N(H):false},H.id)}),v&&pe.map((H,ne)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let K=pe.find(ot=>ot.id===D);if(!K||!K.startDate||!K.endDate)return null;let ue=pe.findIndex(ot=>ot.id===D),Te=Ce(K.id,et(K)),V=Ce(H.id,et(H)),te=Te.x+Te.width,$e=ue*a+26,Ne=V.x,He=ne*a+26,Fe=`dep-${D}-${H.id}`;if(Ee.has(Fe))return null;let Ge=b&&H.isCriticalPath&&K.isCriticalPath;return jsxRuntime.jsx(hs,{x1:te,y1:$e,x2:Ne,y2:He,theme:t,lineStyle:i,colorOverride:b?Ge?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?Ge?2:1:void 0,glowFilter:Ge?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(H.id,D),onHoverChange:ot=>{Z.current=ot,ot&&q({key:Fe,fromId:D,toId:H.id,exitX:te,exitY:$e,enterX:Ne,enterY:He});}},Fe)})),F.map(H=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsxRuntime.jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),v&&A&&jsxRuntime.jsx(hs,{x1:A.exitX,y1:A.exitY,x2:A.enterX,y2:A.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=A.key;q(null),Z.current=false,B(ne=>new Set(ne).add(H)),h?.(A.toId,A.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Z.current=H,H||q(null);}},`${A.key}-hover-overlay`),Dt>=0&&Dt<=Le&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:Dt,y1:0,x2:Dt,y2:Xe,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:Dt,y1:0,x2:Dt,y2:Xe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsxRuntime.jsx(xm,{tooltipData:O,theme:t,locale:l==="es"?"es":"en"})]})}var Pv=['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"'],km=({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"})}),Av=()=>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"})}),Lv=()=>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"})}),Iv=()=>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"})}),Bv=()=>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 Bi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,p]=react.useState(false),[d,m]=react.useState(false),[g,y]=react.useState([]),[x,h]=react.useState(""),[f,b]=react.useState(false),[v,C]=react.useState(true),[N,T]=react.useState(""),[k,w]=react.useState(-1),[F,I]=react.useState(false),[S,X]=react.useState(0),O=react.useRef(null),$=react.useRef(null),A=react.useRef(null),q=react.useRef(null),{enabled:Z=true,placeholder:Ee='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:_,suggestions:he=Pv,maxHistory:Ye=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Le=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",we=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Oe=J?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Be=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",lt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ee=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",ct=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",et=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",nt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ut=J?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 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(46, 148, 255, 0.04)",Ce=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",mt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",Dt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Xe=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ne=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",K=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ue=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",V=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",$e=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ne=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Fe=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ge=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ht=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",dt="rgba(46, 148, 255, 0.06)",gt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",ot=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",jt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Et=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Nt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Tt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",yt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ot=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",We=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Re=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",at=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ie=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",me=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",L=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",j=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Y=z?.storageKey||"gantt-ai-history",ge=z?.maxMessages??5,De=re.filter(U=>{if(!N)return true;let Ze=N.toLowerCase();return U.name.toLowerCase().includes(Ze)||U.email&&U.email.toLowerCase().includes(Ze)}).slice(0,5),Je=react.useCallback(U=>{if(h(U),re.length===0)return;let Ze=O.current;if(!Ze)return;let ye=Ze.selectionStart||U.length,E=U.slice(0,ye),fe=E.lastIndexOf("@");if(fe>=0&&((fe>0?E[fe-1]:" ")===" "||fe===0)){let tt=E.slice(fe+1);if(tt.length<=40){T(tt),w(fe),I(true),X(0);return}}I(false),T(""),w(-1);},[re.length]),_e=react.useCallback(U=>{let Ze=x.slice(0,k),ye=x.slice(k+1+N.length),E=`${Ze}@${U.name} ${ye}`;h(E),I(false),T(""),w(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),ze=react.useCallback(U=>{if(!F||De.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(Ze=>Ze<De.length-1?Ze+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(Ze=>Ze>0?Ze-1:De.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let Ze=De[S];return Ze&&_e(Ze),true}return U.key==="Escape"?(I(false),true):false},[F,De,S,_e]);react.useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(Y);if(U){let ye=JSON.parse(U).map(E=>({...E,timestamp:new Date(E.timestamp)}));y(ye.slice(-ge));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,Y,ge]),react.useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(Ze=>!Ze.isLoading).slice(-ge);localStorage.setItem(Y,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,Y,ge]),react.useEffect(()=>{$.current&&$.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,d]);let vt=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,c]),ut=react.useCallback(async U=>{if(!U.trim()||f)return;let Ze={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};y(E=>[...E.slice(-(Ye-1)),Ze]),h(""),C(false),b(true);let ye={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(E=>[...E,ye]);try{if(_){let E=await _(U,e);y(fe=>{let je=fe.filter(ra=>!ra.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:E.message,timestamp:new Date,command:E};return [...je,tt]}),vt(E);}else y(E=>[...E.filter(je=>!je.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(E){y(fe=>[...fe.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${E instanceof Error?E.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Ye,_,e,vt]),Wt=U=>{U.preventDefault(),ut(x);},ha=U=>{h(U),O.current?.focus();};if(react.useEffect(()=>{let U=Ze=>{(Ze.metaKey||Ze.ctrlKey)&&Ze.key==="k"&&(Ze.preventDefault(),p(ye=>!ye),i||m(false)),Ze.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),react.useEffect(()=>{if(!i)return;let U=ye=>{let E=ye.target;A.current&&!A.current.contains(E)&&p(false);},Ze=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(Ze),document.removeEventListener("mousedown",U);}},[i]),!Z)return null;let ta={"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(Jt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ta[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Le,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${we}`,color:"#2E94FF",cursor:"pointer",boxShadow:Oe,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${lt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(km,{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:pe,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ct}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
361
+ </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=De.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let m=d+p;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),m=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;m=Math.min(m,x);}let g=m-p;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=De.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,c=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let y=De.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.set(m,{es:x,ef:x+y});let h=s.get(m)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&i.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=De.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=p;if(h.length>0)for(let b of h){let v=d.get(b);v&&(f=Math.min(f,v.ls));}d.set(g,{ls:f-x,lf:f});}for(let m of c){let g=l.get(m),y=d.get(m),x=y.ls-g.es,h=s.get(m)||[],f;h.length>0?f=Math.min(...h.map(b=>l.get(b).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=De.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(De.calculateCriticalPath(e).includes(t))return 0;let o=De.getDependentTasks(e,t);if(o.length===0){let l=De.getLatestEndDate(e);if(!l)return null;let c=De.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=De.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>De.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=De.findTaskById(e,t);if(!s||!s.endDate)return e;let n=De.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=De.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 g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),p<y&&(p=y);}let d=De.calculateEndDate(p,i),m=g=>g.map(y=>y.id===c.id?{...y,startDate:p,endDate:d}:y.subtasks?{...y,subtasks:m(y.subtasks)}:y);l=m(l),l=De.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),p=1e3*60*60*24,d=De.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=De.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(S=>S.id===f.id);if(b===-1)continue;let v=f.startDate.getTime(),D=(f.endDate.getTime()-v)/p,k=(v-i)/p*s,w=k+y*s,F=Math.max(D*s,s),I=l+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:w,width:F,y:I,rowIndex:b,daysDelta:y,color:f.color}),m(f.id,y,x);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=De.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Bi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:v=true,highlightWeekends:T=true,canEditTask:D}){let k=Or(),w=react.useRef(null),[F,I]=react.useState([]),[S,Y]=react.useState(null),[$,X]=react.useState(null),[C,G]=react.useState(null),Z=react.useRef(false),[$e,B]=react.useState(new Set),[K,he]=react.useState(null),Xe=react.useCallback(O=>{if(C&&!Z.current){let ie=O.target,M=false;for(;ie&&ie!==O.currentTarget;){if(ie.getAttribute?.("data-dependency-line")==="true"||ie.getAttribute?.("data-dependency-hover-overlay")==="true"){M=true;break}ie=ie.parentElement;}M||G(null);}},[C]),H=react.useCallback(O=>{X(O);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Q=r==="day"?60:r==="week"?20:8,Ee=re*Q*n,Te=O=>{let ie=new Date(Date.UTC(O.getFullYear(),O.getMonth(),O.getDate())),M=ie.getUTCDay()||7;ie.setUTCDate(ie.getUTCDate()+4-M);let V=new Date(Date.UTC(ie.getUTCFullYear(),0,1));return Math.ceil(((ie.getTime()-V.getTime())/864e5+1)/7)},Ie=O=>{let ie=O.getDay();return ie===0||ie===6},Be=react.useCallback(O=>{let ie=Math.round(O/(Q*n)),M=new Date(o);return M.setDate(M.getDate()+ie),M},[o,Q,n]),ot=react.useCallback((O,ie)=>{if(ie.startDate&&ie.endDate)return;let M=O.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=O.clientX,V.y=O.clientY;let ce=V.matrixTransform(M.getScreenCTM()?.inverse()),Ne=Be(ce.x),W=new Date(Ne);W.setDate(W.getDate()+1),he(null),y?.(ie,Ne,W);},[Be,y]),ae=react.useCallback((O,ie,M)=>{let V=O.currentTarget.ownerSVGElement;if(!V)return;let ce=V.createSVGPoint();ce.x=O.clientX,ce.y=O.clientY;let Ne=ce.matrixTransform(V.getScreenCTM()?.inverse()),W=Be(Ne.x),je=Math.round(Ne.x/(Q*n))*Q*n;he({taskId:ie.id,x:je,y:M*a+a/2,date:W});},[Be,Q,n,a]),nt=react.useCallback(()=>{he(null);},[]),fe=react.useMemo(()=>{let O=ce=>ce.map(Ne=>{if(Ne.subtasks&&Ne.subtasks.length>0){let W=O(Ne.subtasks),ee=W.filter(je=>je.startDate&&je.endDate);if(ee.length>0){let je=ee.map(We=>We.startDate.getTime()),ve=ee.map(We=>We.endDate.getTime()),He=new Date(Math.min(...je)),Me=new Date(Math.max(...ve));return {...Ne,subtasks:W,startDate:He,endDate:Me}}return {...Ne,subtasks:W}}return Ne}),ie=(ce,Ne=[])=>{let W=[...ce].sort((ee,je)=>(ee.position??0)-(je.position??0));for(let ee of W)Ne.push(ee),ee.subtasks&&ee.subtasks.length>0&&(ee.isExpanded===void 0||ee.isExpanded)&&ie(ee.subtasks,Ne);return Ne},M=O(e);return ie(M)},[e]),Ze=react.useCallback(O=>{if(!O.startDate||!O.endDate)return {x:0,width:0};let ie=O.startDate.getTime(),M=O.endDate.getTime(),V=o.getTime(),ce=(ie-V)/(1e3*60*60*24),Ne=(M-ie)/(1e3*60*60*24)+1,W=ce*Q*n,ee=Math.max(Q*n,40),je=Math.max(Ne*Q*n,ee);return {x:W,width:je}},[o,Q,n]),xt=react.useMemo(()=>fe.filter(O=>O.startDate&&O.endDate).map(O=>{let{x:ie,width:M}=Ze(O),ce=fe.findIndex(Ne=>Ne.id===O.id)*a+(a-18)/2;return {id:O.id,x:ie,y:ce,width:M,height:18}}),[fe,Ze]),St=react.useCallback((O,ie,M)=>{if(!M){I([]),Y(null);return}if(Y({taskId:O,daysDelta:ie}),ie===0){I([]);return}let V=De.calculateCascadePreview(e,O,ie,fe,o,Q*n,a,48);I(V);},[e,fe,o,Q,n,a,48]),Ce=react.useCallback((O,ie)=>{if(!S)return ie;let M=Q*n,V=S.daysDelta*M;if(O===S.taskId)return {x:ie.x+V,width:ie.width};let ce=F.find(Ne=>Ne.taskId===O);return ce?{x:ce.previewX,width:ce.width}:ie},[S,F,Q,n]),gt=react.useMemo(()=>{let O=[],ie=new Date(o);for(;ie<=s;){let ce=(ie.getTime()-o.getTime())/864e5*Q*n;if(r==="day")O.push({date:new Date(ie),label:ie.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ce}),ie.setDate(ie.getDate()+1);else if(r==="week"){let Ne=Te(ie);O.push({date:new Date(ie),label:`${k.labels.week} ${Ne}`,x:ce}),ie.setDate(ie.getDate()+7);}else O.push({date:new Date(ie),label:ie.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ce}),ie.setMonth(ie.getMonth()+1);}return O},[o,s,r,Q,n,l,k.labels.week]),Tt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Q*n,[o,Q,n]),Qe=Math.max(fe.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),gt.map((O,ie)=>jsxRuntime.jsxs("g",{children:[ie>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:O.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:O.label})]},`header-${ie}`)),Tt>=0&&Tt<=Ee&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:Tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:Tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${Tt-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:k.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:w,width:Math.max(Ee,1e3),height:Qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Xe,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:"#2E94FF",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(Ee,1e3),height:Qe,fill:t.bgPrimary}),fe.map((O,ie)=>jsxRuntime.jsx("rect",{x:0,y:ie*a,width:Math.max(Ee,1e3),height:a,fill:ie%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${O.id}`)),gt.map((O,ie)=>ie>0?jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:fe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ie}`):null),T&&gt.map((O,ie)=>{let M=gt[ie+1]?.x||Ee;return Ie(O.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:O.x,y:0,width:M-O.x,height:fe.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:O.x,y:0,width:M-O.x,height:fe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ie}`):null}),fe.map((O,ie)=>{let M=O.startDate&&O.endDate;return jsxRuntime.jsx("g",{children:!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ie*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>ot(V,O),onMouseMove:V=>ae(V,O,ie),onMouseLeave:()=>{nt();}},`clickable-${O.id}`),K&&K.taskId===O.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:K.x,y1:ie*a+4,x2:K.x,y2:ie*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:K.x,cy:K.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:K.x,cy:K.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${K.x}, ${ie*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:K.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!K||K.taskId!==O.id)&&jsxRuntime.jsx("text",{x:Tt>0?Tt:100,y:ie*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${O.id}`)]})},`row-group-${O.id}`)}),fe.map((O,ie)=>{if(!O.startDate||!O.endDate)return null;let{x:M,width:V}=Ze(O),ce=ie*a+(a-18)/2,Ne=O.subtasks&&O.subtasks.length>0&&!O.isMilestone;if(O.isMilestone)return jsxRuntime.jsx(Li,{task:O,x:M+V/2,y:ce+12,theme:t,onClick:d},O.id);if(Ne){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ee=8,je=ce+(a-18)/2+(18-ee)/2,ve=4,He=O.progress||0,Me=new Date;Me.setHours(0,0,0,0);let We=O.startDate&&Me>=O.startDate,Nt=O.endDate&&(()=>{let mt=new Date(O.endDate);return mt.setHours(0,0,0,0),Me>mt})(),ct=O.startDate&&Me<O.startDate,it=1;if(We&&O.startDate&&O.endDate&&!ct){let mt=new Date(O.startDate);mt.setHours(0,0,0,0);let It=new Date(O.endDate);It.setHours(0,0,0,0);let Ue=Math.max(1,(It.getTime()-mt.getTime())/(1e3*60*60*24)),dt=Math.min((Me.getTime()-mt.getTime())/(1e3*60*60*24),Ue)/Ue*100;it=dt>0?He/dt:1;}let lt;He>=100?lt="#00E5CC":ct?lt="#4B5563":Nt&&He<100?lt="#EF4444":it>=.95?lt="#22C55E":it>=.8?lt="#F59E0B":lt="#EF4444";let Vt=Math.max(He/100*V,He>0?ve*2:0),zt=V>100&&He>0,pt=O.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(O),onContextMenu:mt=>{mt.preventDefault(),mt.stopPropagation(),g?.(O,mt);},onMouseMove:mt=>{H({task:O,x:M,y:je,width:V,height:ee,showBelow:je<100,mouseX:mt.clientX,mouseY:mt.clientY});},onMouseLeave:()=>H(null),style:{cursor:"default",opacity:b?pt?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:M,y:ce,width:V,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:M,y:je,width:V,height:ee,rx:ve,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),He>0&&jsxRuntime.jsx("rect",{x:M,y:je,width:Vt,height:ee,rx:ve,fill:lt}),b&&pt&&jsxRuntime.jsx("rect",{x:M,y:je,width:V,height:ee,rx:ve,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),zt&&jsxRuntime.jsxs("text",{x:M+Vt+6,y:je+ee/2,dominantBaseline:"central",fill:W?"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(He),"%"]})]},O.id)}return jsxRuntime.jsx(Ei,{task:O,x:M,y:ce,width:V,theme:t,dayWidth:Q*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:xt,onDragMove:St,onHoverChange:H,showBaseline:f,showTaskBarLabels:p,showCriticalPath:b,readOnly:D?!D(O):false},O.id)}),v&&fe.map((O,ie)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(M=>{let V=fe.find(lt=>lt.id===M);if(!V||!V.startDate||!V.endDate)return null;let ce=fe.findIndex(lt=>lt.id===M),Ne=Ce(V.id,Ze(V)),W=Ce(O.id,Ze(O)),ee=Ne.x+Ne.width,je=ce*a+26,ve=W.x,He=ie*a+26,Me=`dep-${M}-${O.id}`;if($e.has(Me))return null;let We=b&&O.isCriticalPath&&V.isCriticalPath;return jsxRuntime.jsx(vs,{x1:ee,y1:je,x2:ve,y2:He,theme:t,lineStyle:i,colorOverride:b?We?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?We?2:1:void 0,glowFilter:We?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(O.id,M),onHoverChange:lt=>{Z.current=lt,lt&&G({key:Me,fromId:M,toId:O.id,exitX:ee,exitY:je,enterX:ve,enterY:He});}},Me)})),F.map(O=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:O.previewX,y:O.y-48,width:O.width,height:18,rx:6,fill:O.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(O.daysDelta)>0&&jsxRuntime.jsx("text",{x:O.previewX+O.width/2,y:O.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:O.daysDelta>0?`+${O.daysDelta}d`:`${O.daysDelta}d`})]},`cascade-preview-${O.taskId}`)),v&&C&&jsxRuntime.jsx(vs,{x1:C.exitX,y1:C.exitY,x2:C.enterX,y2:C.enterY,theme:t,lineStyle:i,onDelete:()=>{let O=C.key;G(null),Z.current=false,B(ie=>new Set(ie).add(O)),h?.(C.toId,C.fromId);},hoverOverlayOnly:true,onHoverChange:O=>{Z.current=O,O||G(null);}},`${C.key}-hover-overlay`),Tt>=0&&Tt<=Ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:Tt,y1:0,x2:Tt,y2:Qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:Tt,y1:0,x2:Tt,y2:Qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),$&&jsxRuntime.jsx(vm,{tooltipData:$,theme:t,locale:l==="es"?"es":"en"})]})}var Pv=['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"'],Cm=({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"})}),Av=()=>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"})}),Lv=()=>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"})}),Iv=()=>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"})}),Bv=()=>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 $i({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,p]=react.useState(false),[d,m]=react.useState(false),[g,y]=react.useState([]),[x,h]=react.useState(""),[f,b]=react.useState(false),[v,T]=react.useState(true),[D,N]=react.useState(""),[k,w]=react.useState(-1),[F,I]=react.useState(false),[S,Y]=react.useState(0),$=react.useRef(null),X=react.useRef(null),C=react.useRef(null),G=react.useRef(null),{enabled:Z=true,placeholder:$e='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:K,suggestions:he=Pv,maxHistory:Xe=50,persistHistory:H,mentionableUsers:re=[]}=a,Q=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ee=Q?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Te=Q?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ie=Q?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Be=Q?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",ot=Q?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=Q?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",nt=Q?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",fe=Q?"rgba(46, 148, 255, 0.9)":"#2E94FF",Ze=Q?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",xt=Q?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",St=Q?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 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(46, 148, 255, 0.04)",Ce=Q?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",gt=Q?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",Tt=Q?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Qe=Q?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",O=Q?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ie=Q?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",M=Q?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",V=Q?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ce=Q?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ne="rgba(46, 148, 255, 0.04)",W=Q?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ee=Q?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",je=Q?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ve=Q?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=Q?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Me=Q?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",We=Q?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Nt=Q?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ct="rgba(46, 148, 255, 0.06)",it=Q?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",lt=Q?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Vt=Q?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",zt=Q?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",pt=Q?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Et=Q?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",mt=Q?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",It=Q?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ue=Q?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Re=Q?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",dt=Q?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",se=Q?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ue=Q?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",L=Q?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",_=Q?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=H?.storageKey||"gantt-ai-history",pe=H?.maxMessages??5,Fe=re.filter(z=>{if(!D)return true;let et=D.toLowerCase();return z.name.toLowerCase().includes(et)||z.email&&z.email.toLowerCase().includes(et)}).slice(0,5),Ke=react.useCallback(z=>{if(h(z),re.length===0)return;let et=$.current;if(!et)return;let ye=et.selectionStart||z.length,E=z.slice(0,ye),me=E.lastIndexOf("@");if(me>=0&&((me>0?E[me-1]:" ")===" "||me===0)){let at=E.slice(me+1);if(at.length<=40){N(at),w(me),I(true),Y(0);return}}I(false),N(""),w(-1);},[re.length]),Ve=react.useCallback(z=>{let et=x.slice(0,k),ye=x.slice(k+1+D.length),E=`${et}@${z.name} ${ye}`;h(E),I(false),N(""),w(-1),setTimeout(()=>$.current?.focus(),0);},[x,k,D]),ze=react.useCallback(z=>{if(!F||Fe.length===0)return false;if(z.key==="ArrowDown")return z.preventDefault(),Y(et=>et<Fe.length-1?et+1:0),true;if(z.key==="ArrowUp")return z.preventDefault(),Y(et=>et>0?et-1:Fe.length-1),true;if(z.key==="Enter"||z.key==="Tab"){z.preventDefault();let et=Fe[S];return et&&Ve(et),true}return z.key==="Escape"?(I(false),true):false},[F,Fe,S,Ve]);react.useEffect(()=>{if(H?.enabled)try{let z=localStorage.getItem(q);if(z){let ye=JSON.parse(z).map(E=>({...E,timestamp:new Date(E.timestamp)}));y(ye.slice(-pe));}}catch(z){console.warn("[GanttAIAssistant] Failed to load persisted history:",z);}},[H?.enabled,q,pe]),react.useEffect(()=>{if(H?.enabled&&g.length>0)try{let z=g.filter(et=>!et.isLoading).slice(-pe);localStorage.setItem(q,JSON.stringify(z));}catch(z){console.warn("[GanttAIAssistant] Failed to persist history:",z);}},[g,H?.enabled,q,pe]),react.useEffect(()=>{X.current&&X.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&$.current&&setTimeout(()=>$.current?.focus(),100);},[i,d]);let ht=react.useCallback(z=>{if(z.success)switch(z.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":z.taskId&&z.updates&&o?.(z.taskId,z.updates);break;case "create_task":z.newTask&&s?.(z.newTask);break;case "delete_task":z.taskId&&n?.(z.taskId);break;case "link_tasks":z.dependencyFrom&&z.dependencyTo&&l?.(z.dependencyFrom,z.dependencyTo);break;case "unlink_tasks":z.taskId&&z.dependencyFrom&&c?.(z.taskId,z.dependencyFrom);break}},[o,s,n,l,c]),wt=react.useCallback(async z=>{if(!z.trim()||f)return;let et={id:`user-${Date.now()}`,role:"user",content:z,timestamp:new Date};y(E=>[...E.slice(-(Xe-1)),et]),h(""),T(false),b(true);let ye={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(E=>[...E,ye]);try{if(K){let E=await K(z,e);y(me=>{let _e=me.filter(oa=>!oa.isLoading),at={id:`assistant-${Date.now()}`,role:"assistant",content:E.message,timestamp:new Date,command:E};return [..._e,at]}),ht(E);}else y(E=>[...E.filter(_e=>!_e.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(E){y(me=>[...me.filter(at=>!at.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${E instanceof Error?E.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Xe,K,e,ht]),Bt=z=>{z.preventDefault(),wt(x);},ga=z=>{h(z),$.current?.focus();};if(react.useEffect(()=>{let z=et=>{(et.metaKey||et.ctrlKey)&&et.key==="k"&&(et.preventDefault(),p(ye=>!ye),i||m(false)),et.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),react.useEffect(()=>{if(!i)return;let z=ye=>{let E=ye.target;C.current&&!C.current.contains(E)&&p(false);},et=setTimeout(()=>{document.addEventListener("mousedown",z);},100);return ()=>{clearTimeout(et),document.removeEventListener("mousedown",z);}},[i]),!Z)return null;let ua={"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(Jt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ua[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ee,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Te}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ie,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ot}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Cm,{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:fe,background:ae,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${nt}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:et,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${nt}`,boxShadow:Ut},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${mt}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Dt,border:`1px solid ${Xe}`,color:"#2E94FF"},children:jsxRuntime.jsx(km,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=ne;},children:jsxRuntime.jsx(Iv,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=ne;},children:jsxRuntime.jsx(Lv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ue,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((U,Ze)=>jsxRuntime.jsx("button",{onClick:()=>ha(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:te,border:`1px solid ${V}`},onMouseEnter:ye=>{ye.currentTarget.style.borderColor=$e,ye.currentTarget.style.color="#2E94FF";},onMouseLeave:ye=>{ye.currentTarget.style.borderColor=V,ye.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},Ze))})]}),g.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?Ne:Fe,color:U.role==="user"?"#2E94FF":ht,border:U.role==="user"?`1px solid ${He}`:`1px solid ${Ge}`},children:[U.isLoading?jsxRuntime.jsx(Bv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:$})]}),jsxRuntime.jsxs("form",{onSubmit:U=>{if(F&&De.length>0){U.preventDefault();return}Wt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${dt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&De.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:q,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ot,border:`1px solid ${We}`,boxShadow:Re,backdropFilter:"blur(12px)"},children:De.map((U,Ze)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>_e(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Ze===S?at:"transparent",color:ie},onMouseEnter:()=>X(Ze),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:L,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map(ye=>ye[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:U.name}),U.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:me},children:U.email})]})]},U.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:gt,border:`1px solid ${ot}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:x,onChange:U=>Je(U.target.value),onKeyDown:U=>{ze(U);},placeholder:Ee,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:jt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Et:"transparent",color:x.trim()?"#2E94FF":Tt,border:x.trim()?`1px solid ${Nt}`:"1px solid transparent"},children:jsxRuntime.jsx(Av,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:yt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Cm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Tm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Hv={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 Nm(e){return {...Hv,...e}}var Kv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Em=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:p,projectName:d,availableUsers:m=[],templates:g,enableAutoCriticalPath:y=true,persistExpandedState:x,persistFilter:h,clearFiltersKey:f,aiAssistant:b,locale:v="en",customTranslations:C,showCreateTaskButton:N=false,createTaskLabel:T,onCreateTask:k,taskFilter:w,onTaskFilterChange:F,toolbarRightContent:I,showBaseline:S,viewMode:X,onViewModeChange:O,projectForecast:$,onThemeChange:A,onTaskClick:q,onTaskDblClick:Z,onTaskContextMenu:Ee,onTaskUpdate:B,onDependentTasksScheduled:_,onProgressChange:he,onTaskEdit:Ye,onTaskAddSubtask:z,onTaskMarkIncomplete:re,onTaskSetInProgress:J,onDependencyCreate:Le,onDependencyDelete:we,onBeforeTaskAdd:Oe,onAfterTaskAdd:Be,onBeforeTaskUpdate:lt,onAfterTaskUpdate:ee,onBeforeTaskDelete:ct,onAfterTaskDelete:pe,permissions:et,onCopySnapshotLink:nt}=a,Ce=react.useContext(hi)?.theme,[mt,Dt]=react.useState(Ce||s||"dark"),[Xe,H]=react.useState(n),[ne,D]=react.useState(l),[K,ue]=react.useState(1),[Te,V]=react.useState("all"),[te,$e]=react.useState(X||"execution"),Ne=X??te,He=react.useCallback(P=>{$e(P),O?.(P);},[O]),Fe=S??Ne==="oracle",[Ge,ht]=react.useState(a.showCriticalPath!==false),[dt,gt]=react.useState(a.showDependencies!==false),[ot,jt]=react.useState(a.highlightWeekends!==false),Et=react.useCallback(P=>{ht(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Nt=react.useCallback(P=>{gt(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Tt=react.useCallback(P=>{jt(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(Xe);},[Xe]),react.useEffect(()=>{a.onZoomChange?.(K);},[K]);let yt=react.useRef(a.onDateRangeChange);yt.current=a.onDateRangeChange;let Ot=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[We,Re]=react.useState(()=>{if(!h)return "all";try{let P=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(P);if(R){let G=JSON.parse(R);if(G.taskFilter)return G.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),at=w??We,ie=F??Re,[me,L]=react.useState(()=>{if(!h)return false;try{let P=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(P);if(R){let G=JSON.parse(R);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=Ot();if(P)try{let R={taskFilter:at,hideCompleted:me};localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[at,me,Ot]);let j=react.useRef(f);react.useEffect(()=>{if(j.current!==f&&f!==void 0){Re("all"),L(false);let P=Ot();if(P)try{localStorage.removeItem(P);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}j.current=f;},[f,Ot]);let[Y,ge]=react.useState(0),[De,Je]=react.useState(false),[_e,ze]=react.useState(null),[vt,ut]=react.useState({isOpen:false,x:0,y:0,task:null}),[Wt,ha]=react.useState(null),[ta,U]=react.useState(null);react.useEffect(()=>{Ce&&Ce!==mt&&Dt(Ce);},[Ce]),react.useEffect(()=>{s&&s!==mt&&Dt(s);},[s]);let Ze=react.useCallback(P=>{Dt(P),A?.(P);},[A]),{state:ye,setState:E,undo:fe,redo:je,canUndo:tt,canRedo:ra,clearHistory:Vt}=Cm(t,50),Ua=react.useMemo(()=>{let P=(R,G=0)=>{let Q=G;for(let ve of R)ve.subtasks?.length&&(Q=Math.max(Q,P(ve.subtasks,G+1)));return Q};return P(ye)+1},[ye]),lr=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),fa=react.useRef(new Map),ya=react.useRef(false);if(!ya.current&&x){ya.current=true;let P=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(P);if(R){let G=JSON.parse(R);Array.isArray(G)&&(fa.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Hr=react.useCallback(()=>{let P=lr();if(P)try{let R=Array.from(fa.current.entries());localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[lr]),Fr=react.useRef(0),Go=react.useRef(ye);react.useEffect(()=>{Go.current=ye;},[ye]);let M=react.useRef(false),se=react.useCallback(P=>{V(P),Fr.current+=1,E(R=>{let G=(ve,Ae=0)=>ve.map(Mt=>{let pt=P==="all"||Ae<P-1;return Mt.subtasks?.length&&fa.current.set(Mt.id,pt),{...Mt,isExpanded:pt,subtasks:Mt.subtasks?G(Mt.subtasks,Ae+1):void 0}}),Q=G(R);return Hr(),Q});},[E,Hr]);react.useEffect(()=>{if(Fr.current>0){Fr.current-=1;return}let P=G=>{let Q=new Map;for(let ve of G){let Ae=ve.id;Q.get(Ae)||Q.set(Ae,ve);}return Array.from(Q.values())},R=G=>G.map(Q=>{let ve=fa.current.get(Q.id),Ae=ve!==void 0?{...Q,isExpanded:ve}:Q;if(Ae.subtasks?.length){let Mt=P(Ae.subtasks);return {...Ae,subtasks:R(Mt)}}return Ae});if(fa.current.size>0)E(Rr(R(t)));else {let G=Q=>Q.map(ve=>ve.subtasks?.length?{...ve,subtasks:P(G(ve.subtasks))}:ve);E(Rr(G(t)));}},[t,E]);let xe=react.useRef(t),Pe=react.useRef(true);react.useEffect(()=>{if(Pe.current){Pe.current=false,xe.current=ye;return}if(M.current){M.current=false,xe.current=ye;return}if(!r)return;let P=JSON.stringify(xe.current),R=JSON.stringify(ye);P!==R&&(xe.current=ye,r(ye));},[ye,r]);let ke=react.useMemo(()=>vd(v,C),[v,C]),st=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ce,Ve]=react.useState(()=>st(ke));react.useEffect(()=>{Ve(P=>P.map(R=>({...R,label:ke.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ke]);let it=react.useMemo(()=>ce.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[ce]),wt=react.useRef(ce.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=ce.filter(Q=>Q.visible),R=P.map(Q=>Q.id).join(","),G=wt.current;if(R!==G){let Q=P.some(Ae=>Ae.id!=="name"),ve=G.includes(",");Q?!ve&&Q&&ze(null):ze(null),wt.current=R;}},[ce]);let Ht=60,St=.6,zt=react.useMemo(()=>{let R=it+Ht,G=typeof window<"u"?window.innerWidth*St:800,Q=Math.max(R,G);return _e!==null?Math.max(200,Math.min(_e,Q)):Math.max(200,R)},[_e,it]),oa=react.useRef(null),Sa=react.useRef(null),Ea=react.useRef(null),ar=react.useRef(null),Ft=react.useMemo(()=>Wp(mt),[mt]),eo=react.useMemo(()=>({theme:Ft,themeName:mt}),[Ft,mt]),mo=react.useMemo(()=>Nm(g),[g]),dl=react.useMemo(()=>{if(!y)return ye;let P=Se.calculateCriticalPathFull(ye),R=G=>G.map(Q=>{let ve=P.get(Q.id),Ae=Q.subtasks?R(Q.subtasks):void 0,Mt=Ae?.some(Ma=>Ma.isCriticalPath||Ma.subtasks&&Ma.subtasks.some(Xt=>Xt.isCriticalPath))||false,pt=ve?ve.isCritical:Mt;return {...Q,isCriticalPath:pt,cpmData:ve||void 0,subtasks:Ae}});return R(ye)},[ye,y]),sf=react.useMemo(()=>Se.flattenTasks(ye).some(R=>R.dependencies&&R.dependencies.length>0),[ye]),qc=react.useMemo(()=>{if(at==="all"&&!me)return dl;let P=R=>{let G=[];for(let Q of R){let ve=Q.subtasks?.length?P(Q.subtasks):void 0,Ae=false;if(me)Ae=Q.progress<100;else switch(at){case "all":Ae=true;break;case "incomplete":Ae=Q.progress<100;break;case "in_progress":Ae=Q.progress>0&&Q.progress<100;break;case "completed":Ae=Q.progress===100;break}(Ae||ve&&ve.length>0)&&G.push({...Q,subtasks:ve});}return G};return P(dl)},[dl,at,me]),Hs=Kv(ne);Tm({undo:fe,redo:je,canUndo:tt,canRedo:ra,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>Se.findTaskById(ye,P),addTask:(P,R)=>{E(G=>{if(!R)return [...G,{...P,level:0}];let Q=ve=>ve.map(Ae=>Ae.id===R?{...Ae,subtasks:[...Ae.subtasks||[],{...P,parentId:R,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(G)});},updateTask:(P,R)=>{E(G=>{let Q=ve=>ve.map(Ae=>Ae.id===P?{...Ae,...R}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(G)});},deleteTask:P=>{E(R=>{let G=Q=>Q.filter(ve=>ve.id===P?false:(ve.subtasks&&(ve.subtasks=G(ve.subtasks)),true));return G(R)});},deleteTasks:P=>{E(R=>Md(R,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let R=Se.findTaskById(ye,P);R&&a.onTaskDuplicate(R);}else E(R=>fs(R,[P]).tasks);},splitTask:(P,R,G=3)=>{E(Q=>Se.splitTask(Q,P,R,G));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(P,R)=>!Se.validateDependencies(ye,P,R),getAllTasks:()=>Se.flattenTasks(ye),getTasksByStatus:P=>Se.flattenTasks(ye).filter(R=>R.status===P),getTasksByParent:P=>P?Se.findTaskById(ye,P)?.subtasks||[]:ye.filter(G=>!G.parentId),getCriticalPath:()=>Se.flattenTasks(ye).filter(P=>P.isCriticalPath),indentTask:P=>{E(R=>Rr(Dd(R,[P])));},outdentTask:P=>{E(R=>Rr(Sd(R,[P])));},moveTask:(P,R)=>{E(G=>Ed(G,[P],R));},createSubtask:async P=>{let{tasks:R,newTask:G}=Ad(ye,P);if(Oe){let Q=Oe({...G,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}E(Rr(R)),Be&&Be({...G,parentId:P});},scrollToTask:P=>{let G=Se.flattenTasks(ye).findIndex(Q=>Q.id===P);if(G!==-1&&oa.current){let Q=G*Hs;oa.current.scrollTo({top:Q,behavior:"smooth"}),Ea.current&&Ea.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,R=2e3)=>{},expandTask:P=>{E(R=>{let G=Q=>Q.map(ve=>ve.id===P?{...ve,isExpanded:true}:ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve);return G(R)});},collapseTask:P=>{E(R=>{let G=Q=>Q.map(ve=>ve.id===P?{...ve,isExpanded:false}:ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve);return G(R)});},expandAll:()=>{E(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseAll:()=>{E(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseToLevel:P=>{se(P);},undo:fe,redo:je,canUndo:()=>tt,canRedo:()=>ra,clearHistory:Vt,exportToPNG:async()=>{if(!ar.current||!oa.current||!Ea.current)throw new Error("Gantt container not found");let P=ar.current,R=oa.current,G=Sa.current||R.querySelector(".gantt-grid-scroll"),Q=Ea.current,ve=G?.scrollTop||0,Ae=Q.scrollTop,Mt=P.style.overflow,pt=P.style.height,Ma=R.style.overflow;try{let Xt=G?.querySelector(".gantt-taskgrid-content"),ua=Q.querySelector("svg"),ir=Xt?.scrollHeight||G?.scrollHeight||600,Nr=ua?.getBoundingClientRect().height||Q.scrollHeight,jo=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ir,Nr)+20;G&&(G.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${jo}px`,R.style.overflow="visible",await new Promise(hn=>setTimeout(hn,100));let to=await htmlToImage.toPng(P,{backgroundColor:Ft.bgPrimary,pixelRatio:2,filter:hn=>{if(!(hn instanceof Element))return !0;let zs=window.getComputedStyle(hn),Yn=parseInt(zs.zIndex,10);return (isNaN(Yn)||Yn<50)&&zs.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=Mt,P.style.height=pt,R.style.overflow=Ma,G&&(G.scrollTop=ve),Q.scrollTop=Ae;}},exportToPDF:async P=>{await Se.exportToPDF(ye,P);},exportToExcel:async P=>{await Se.exportToExcel(ye,P,ml.current);},exportToJSON:()=>Se.exportToJSON(ye),exportToCSV:()=>Se.exportToCSV(ye),importFromJSON:P=>{let R=Se.importFromJSON(P);E(R);},getTasks:()=>ye,refresh:()=>{E(P=>[...P]);},clearAll:()=>{E([]);}}),[ye,fe,je,tt,ra,Vt,Ft,Hs]);let lf=react.useCallback(P=>{Ve(R=>R.map(G=>G.id===P?{...G,visible:!G.visible}:G));},[]),df=react.useCallback((P,R)=>{Ve(G=>G.map(Q=>{if(Q.id!==P)return Q;let ve=Q.minWidth??100,Ae=Q.maxWidth??800,Mt=Math.max(ve,Math.min(Ae,R));return {...Q,width:Mt}}));},[]),cf=react.useCallback(P=>{E(R=>{let G=Pd(R,P),Q=ve=>{for(let Ae of ve){if(Ae.id===P){fa.current.set(P,Ae.isExpanded??true);return}Ae.subtasks?.length&&Q(Ae.subtasks);}};return Q(G),Hr(),G}),a.onTaskToggleExpand?.(P);},[a,Hr]),mn=react.useCallback((P,R)=>{if(lt&&lt(P,R)===false)return;let Q=Se.findTaskById(ye,P)?.progress,ve=Mt=>Mt.map(pt=>pt.id===P?{...pt,...R}:pt.subtasks?{...pt,subtasks:ve(pt.subtasks)}:pt);E(ve(ye));let Ae=Se.findTaskById(ve(ye),P);Ae&&(B?.(Ae),ee?.(Ae),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&he?.(P,Q,R.progress));},[ye,B,lt,ee,he]),uf=react.useCallback(P=>{P.length!==0&&(Fr.current+=1,M.current=true,E(R=>Rr(Dd(R,P))),a.onTaskIndent?.(P[0]));},[a]),pf=react.useCallback(P=>{P.length!==0&&(Fr.current+=1,M.current=true,E(R=>Rr(Sd(R,P))),a.onTaskOutdent?.(P[0]));},[a]),mf=react.useCallback((P,R,G)=>{Fr.current+=1,M.current=true,E(Q=>Rr(cm(Q,P,R,G))),a.onTaskReparent?.(P,R,G);},[a]),gf=react.useCallback((P,R)=>{P.length!==0&&(Fr.current+=1,M.current=true,E(G=>Ed(G,P,R)),a.onTaskMove?.(P[0],R));},[a]),cl=react.useCallback(async P=>{let R=[];for(let G of P)ct&&await Promise.resolve(ct(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(E(G=>Rr(Md(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),pe&&R.forEach(G=>pe(G)));},[a,ct,pe]),ff=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(R=>{let G=Se.findTaskById(ye,R);G&&a.onTaskDuplicate(G);}):E(R=>fs(R,P).tasks);},[a,ye]),bf=react.useCallback((P,R)=>{E(G=>{let{tasks:Q,newTask:ve}=dm(G,P,R);return Oe&&Oe(ve)===false?G:(a.onTaskCreate?.(ve.parentId,ve.position||0),Be?.(ve),Q)});},[a,Oe,Be]),hf=react.useCallback((P,R)=>{E(G=>Fd(G,P,R)),a.onTaskRename?.(P,R);},[a]),ul=react.useCallback(P=>{let{onTaskAddSubtask:R}=a;if(R){let G=In(ye,P);if(G){R(G);return}}E(G=>{let{tasks:Q}=Ad(G,P);return a.onTaskCreate?.(P,0),Q});},[a,ye]),yf=react.useCallback((P,R,G)=>{let Q=!P.startDate&&!P.endDate,ve=P.startDate?Math.round((R.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ae=Xt=>Xt.map(ua=>ua.id===P.id?{...ua,startDate:R,endDate:G,...P.segments&&{segments:P.segments}}:ua.subtasks?{...ua,subtasks:Ae(ua.subtasks)}:ua),Mt=Ae(ye),pt=Mt;Mt=Se.autoScheduleDependents(Mt,P.id,ve),Mt=Rr(Mt),E(Mt);let Ma={...P,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,R,G):B?.(Ma),_&&ve!==0){let Xt=Se.flattenTasks(pt),ua=Se.flattenTasks(Mt),ir=[];for(let Nr of ua){if(Nr.id===P.id)continue;let Co=Xt.find(to=>to.id===Nr.id);if(!Co)continue;let bn=Nr.startDate?.getTime()!==Co.startDate?.getTime(),jo=Nr.endDate?.getTime()!==Co.endDate?.getTime();(bn||jo)&&ir.push(Nr);}ir.length>0&&_(ir);}},[ye,B,_,a]),xf=react.useCallback((P,R)=>{Ee?.(P,R),ut({isOpen:true,x:R.clientX,y:R.clientY,task:P});},[Ee]),vf=react.useCallback((P,R)=>{let G=Se.splitTask(ye,P.id,R);E(G),ut({isOpen:false,x:0,y:0,task:null});},[ye]),Yc=react.useCallback(P=>{let R=Se.findTaskById(ye,P.id)||P;Z?.(R),Ye||ha(R);},[ye,Z,Ye]),Xc=react.useCallback((P,R,G)=>{let Q=new Map,ve=Xt=>{Xt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&ve(ua.subtasks);});};ve(G);let Ae=Q.get(R)||[];Q.set(R,[...Ae,P]);let Mt=new Set,pt=new Set,Ma=Xt=>{if(!Mt.has(Xt)){Mt.add(Xt),pt.add(Xt);let ua=Q.get(Xt)||[];for(let ir of ua){if(!Mt.has(ir)&&Ma(ir))return true;if(pt.has(ir))return true}}return pt.delete(Xt),false};return Ma(R)},[]),Jc=react.useCallback((P,R)=>{if(Xc(P.id,R,Go.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
366
+ `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ua[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ze,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${xt}`,boxShadow:St},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${gt}`},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:Tt,border:`1px solid ${Qe}`,color:"#2E94FF"},children:jsxRuntime.jsx(Cm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:O},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(z=>!z),className:"p-1.5 rounded-lg transition-colors",style:{color:ie},onMouseEnter:z=>{z.currentTarget.style.background=V,z.currentTarget.style.color=M;},onMouseLeave:z=>{z.currentTarget.style.background="transparent",z.currentTarget.style.color=ie;},children:jsxRuntime.jsx(Iv,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ie},onMouseEnter:z=>{z.currentTarget.style.background=V,z.currentTarget.style.color=M;},onMouseLeave:z=>{z.currentTarget.style.background="transparent",z.currentTarget.style.color=ie;},children:jsxRuntime.jsx(Lv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&v&&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:he.slice(0,4).map((z,et)=>jsxRuntime.jsx("button",{onClick:()=>ga(z),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ne,color:ee,border:`1px solid ${W}`},onMouseEnter:ye=>{ye.currentTarget.style.borderColor=je,ye.currentTarget.style.color="#2E94FF";},onMouseLeave:ye=>{ye.currentTarget.style.borderColor=W,ye.currentTarget.style.color=ee;},children:z.length>30?z.slice(0,30)+"...":z},et))})]}),g.map(z=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${z.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${z.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:z.role==="user"?ve:Me,color:z.role==="user"?"#2E94FF":Nt,border:z.role==="user"?`1px solid ${He}`:`1px solid ${We}`},children:[z.isLoading?jsxRuntime.jsx(Bv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:z.content}),z.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:z.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:z.command.success?"#10B981":"#EF4444",border:`1px solid ${z.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[z.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:z.command.type.replace(/_/g," ")})]})]})},z.id)),jsxRuntime.jsx("div",{ref:X})]}),jsxRuntime.jsxs("form",{onSubmit:z=>{if(F&&Fe.length>0){z.preventDefault();return}Bt(z);},className:"p-3 relative",style:{borderTop:`1px solid ${ct}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&Fe.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:G,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:It,border:`1px solid ${Ue}`,boxShadow:Re,backdropFilter:"blur(12px)"},children:Fe.map((z,et)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ve(z),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:et===S?dt:"transparent",color:se},onMouseEnter:()=>Y(et),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:L,border:`1px solid ${_}`,color:"#2E94FF"},children:z.name.split(" ").map(ye=>ye[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:z.name}),z.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:ue},children:z.email})]})]},z.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:it,border:`1px solid ${lt}`},children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:x,onChange:z=>Ke(z.target.value),onKeyDown:z=>{ze(z);},placeholder:$e,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Vt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?zt:"transparent",color:x.trim()?"#2E94FF":Et,border:x.trim()?`1px solid ${pt}`:"1px solid transparent"},children:jsxRuntime.jsx(Av,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:mt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Tm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Nm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Hv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let a=De.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=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Dm(e){return {...Hv,...e}}var Kv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Mm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:p,projectName:d,availableUsers:m=[],templates:g,enableAutoCriticalPath:y=true,persistExpandedState:x,persistFilter:h,clearFiltersKey:f,aiAssistant:b,locale:v="en",customTranslations:T,showCreateTaskButton:D=false,createTaskLabel:N,onCreateTask:k,taskFilter:w,onTaskFilterChange:F,toolbarRightContent:I,showBaseline:S,viewMode:Y,onViewModeChange:$,projectForecast:X,onThemeChange:C,onTaskClick:G,onTaskDblClick:Z,onTaskContextMenu:$e,onTaskUpdate:B,onDependentTasksScheduled:K,onProgressChange:he,onTaskEdit:Xe,onTaskAddSubtask:H,onTaskMarkIncomplete:re,onTaskSetInProgress:Q,onDependencyCreate:Ee,onDependencyDelete:Te,onBeforeTaskAdd:Ie,onAfterTaskAdd:Be,onBeforeTaskUpdate:ot,onAfterTaskUpdate:ae,onBeforeTaskDelete:nt,onAfterTaskDelete:fe,permissions:Ze,onCopySnapshotLink:xt}=a,Ce=react.useContext(vi)?.theme,[gt,Tt]=react.useState(Ce||s||"dark"),[Qe,O]=react.useState(n),[ie,M]=react.useState(l),[V,ce]=react.useState(1),[Ne,W]=react.useState("all"),[ee,je]=react.useState(Y||"execution"),ve=Y??ee,He=react.useCallback(A=>{je(A),$?.(A);},[$]),Me=S??ve==="oracle",[We,Nt]=react.useState(a.showCriticalPath!==false),[ct,it]=react.useState(a.showDependencies!==false),[lt,Vt]=react.useState(a.highlightWeekends!==false),zt=react.useCallback(A=>{Nt(A),a.onShowCriticalPathChange?.(A);},[a.onShowCriticalPathChange]),pt=react.useCallback(A=>{it(A),a.onShowDependenciesChange?.(A);},[a.onShowDependenciesChange]),Et=react.useCallback(A=>{Vt(A),a.onHighlightWeekendsChange?.(A);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(Qe);},[Qe]),react.useEffect(()=>{a.onZoomChange?.(V);},[V]);let mt=react.useRef(a.onDateRangeChange);mt.current=a.onDateRangeChange;let It=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ue,Re]=react.useState(()=>{if(!h)return "all";try{let A=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(A);if(R){let j=JSON.parse(R);if(j.taskFilter)return j.taskFilter}}catch(A){console.warn("[GanttBoard] Error loading filter state from localStorage:",A);}return "all"}),dt=w??Ue,se=F??Re,[ue,L]=react.useState(()=>{if(!h)return false;try{let A=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(A);if(R){let j=JSON.parse(R);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(A){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",A);}return false});react.useEffect(()=>{let A=It();if(A)try{let R={taskFilter:dt,hideCompleted:ue};localStorage.setItem(A,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[dt,ue,It]);let _=react.useRef(f);react.useEffect(()=>{if(_.current!==f&&f!==void 0){Re("all"),L(false);let A=It();if(A)try{localStorage.removeItem(A);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}_.current=f;},[f,It]);let[q,pe]=react.useState(0),[Fe,Ke]=react.useState(false),[Ve,ze]=react.useState(null),[ht,wt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Bt,ga]=react.useState(null),[ua,z]=react.useState(null);react.useEffect(()=>{Ce&&Ce!==gt&&Tt(Ce);},[Ce]),react.useEffect(()=>{s&&s!==gt&&Tt(s);},[s]);let et=react.useCallback(A=>{Tt(A),C?.(A);},[C]),{state:ye,setState:E,undo:me,redo:_e,canUndo:at,canRedo:oa,clearHistory:Ut}=Tm(t,50),Ua=react.useMemo(()=>{let A=(R,j=0)=>{let J=j;for(let we of R)we.subtasks?.length&&(J=Math.max(J,A(we.subtasks,j+1)));return J};return A(ye)+1},[ye]),ir=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Ta=react.useRef(new Map),Na=react.useRef(false);if(!Na.current&&x){Na.current=true;let A=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(A);if(R){let j=JSON.parse(R);Array.isArray(j)&&(Ta.current=new Map(j));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Nr=react.useCallback(()=>{let A=ir();if(A)try{let R=Array.from(Ta.current.entries());localStorage.setItem(A,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[ir]),Pr=react.useRef(0),Xn=react.useRef(ye);react.useEffect(()=>{Xn.current=ye;},[ye]);let Ur=react.useRef(false),P=react.useCallback(A=>{W(A),Pr.current+=1,E(R=>{let j=(we,Pe=0)=>we.map(Mt=>{let ut=A==="all"||Pe<A-1;return Mt.subtasks?.length&&Ta.current.set(Mt.id,ut),{...Mt,isExpanded:ut,subtasks:Mt.subtasks?j(Mt.subtasks,Pe+1):void 0}}),J=j(R);return Nr(),J});},[E,Nr]);react.useEffect(()=>{if(Pr.current>0){Pr.current-=1;return}let A=j=>{let J=new Map;for(let we of j){let Pe=we.id;J.get(Pe)||J.set(Pe,we);}return Array.from(J.values())},R=j=>j.map(J=>{let we=Ta.current.get(J.id),Pe=we!==void 0?{...J,isExpanded:we}:J;if(Pe.subtasks?.length){let Mt=A(Pe.subtasks);return {...Pe,subtasks:R(Mt)}}return Pe});if(Ta.current.size>0)E($r(R(t)));else {let j=J=>J.map(we=>we.subtasks?.length?{...we,subtasks:A(j(we.subtasks))}:we);E($r(j(t)));}},[t,E]);let oe=react.useRef(t),ke=react.useRef(true);react.useEffect(()=>{if(ke.current){ke.current=false,oe.current=ye;return}if(Ur.current){Ur.current=false,oe.current=ye;return}if(!r)return;let A=JSON.stringify(oe.current),R=JSON.stringify(ye);A!==R&&(oe.current=ye,r(ye));},[ye,r]);let xe=react.useMemo(()=>kd(v,T),[v,T]),Le=react.useCallback(A=>[{id:"name",label:A.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:A.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:A.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:A.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:A.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:A.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:A.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:A.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[tt,ge]=react.useState(()=>Le(xe));react.useEffect(()=>{ge(A=>A.map(R=>({...R,label:xe.columns[R.id==="name"?"taskName":R.id]||R.label})));},[xe]);let Ge=react.useMemo(()=>tt.filter(R=>R.visible).reduce((R,j)=>R+j.width,0),[tt]),st=react.useRef(tt.filter(A=>A.visible).map(A=>A.id).join(","));react.useEffect(()=>{let A=tt.filter(J=>J.visible),R=A.map(J=>J.id).join(","),j=st.current;if(R!==j){let J=A.some(Pe=>Pe.id!=="name"),we=j.includes(",");J?!we&&J&&ze(null):ze(null),st.current=R;}},[tt]);let vt=60,ta=.6,Gt=react.useMemo(()=>{let R=Ge+vt,j=typeof window<"u"?window.innerWidth*ta:800,J=Math.max(R,j);return Ve!==null?Math.max(200,Math.min(Ve,J)):Math.max(200,R)},[Ve,Ge]),$t=react.useRef(null),aa=react.useRef(null),jt=react.useRef(null),Ia=react.useRef(null),Dt=react.useMemo(()=>Vp(gt),[gt]),ur=react.useMemo(()=>({theme:Dt,themeName:gt}),[Dt,gt]),Co=react.useMemo(()=>Dm(g),[g]),Ar=react.useMemo(()=>{if(!y)return ye;let A=De.calculateCriticalPathFull(ye),R=j=>j.map(J=>{let we=A.get(J.id),Pe=J.subtasks?R(J.subtasks):void 0,Mt=Pe?.some(Ea=>Ea.isCriticalPath||Ea.subtasks&&Ea.subtasks.some(Xt=>Xt.isCriticalPath))||false,ut=we?we.isCritical:Mt;return {...J,isCriticalPath:ut,cpmData:we||void 0,subtasks:Pe}});return R(ye)},[ye,y]),To=react.useMemo(()=>De.flattenTasks(ye).some(R=>R.dependencies&&R.dependencies.length>0),[ye]),No=react.useMemo(()=>{if(dt==="all"&&!ue)return Ar;let A=R=>{let j=[];for(let J of R){let we=J.subtasks?.length?A(J.subtasks):void 0,Pe=false;if(ue)Pe=J.progress<100;else switch(dt){case "all":Pe=true;break;case "incomplete":Pe=J.progress<100;break;case "in_progress":Pe=J.progress>0&&J.progress<100;break;case "completed":Pe=J.progress===100;break}(Pe||we&&we.length>0)&&j.push({...J,subtasks:we});}return j};return A(Ar)},[Ar,dt,ue]),Ws=Kv(ie);Nm({undo:me,redo:_e,canUndo:at,canRedo:oa,enabled:true}),react.useImperativeHandle(o,()=>({getTask:A=>De.findTaskById(ye,A),addTask:(A,R)=>{E(j=>{if(!R)return [...j,{...A,level:0}];let J=we=>we.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...A,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:J(Pe.subtasks)}:Pe);return J(j)});},updateTask:(A,R)=>{E(j=>{let J=we=>we.map(Pe=>Pe.id===A?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:J(Pe.subtasks)}:Pe);return J(j)});},deleteTask:A=>{E(R=>{let j=J=>J.filter(we=>we.id===A?false:(we.subtasks&&(we.subtasks=j(we.subtasks)),true));return j(R)});},deleteTasks:A=>{E(R=>Pd(R,A));},duplicateTask:A=>{if(a.onTaskDuplicate){let R=De.findTaskById(ye,A);R&&a.onTaskDuplicate(R);}else E(R=>ys(R,[A]).tasks);},splitTask:(A,R,j=3)=>{E(J=>De.splitTask(J,A,R,j));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(A,R)=>!De.validateDependencies(ye,A,R),getAllTasks:()=>De.flattenTasks(ye),getTasksByStatus:A=>De.flattenTasks(ye).filter(R=>R.status===A),getTasksByParent:A=>A?De.findTaskById(ye,A)?.subtasks||[]:ye.filter(j=>!j.parentId),getCriticalPath:()=>De.flattenTasks(ye).filter(A=>A.isCriticalPath),indentTask:A=>{E(R=>$r(Ed(R,[A])));},outdentTask:A=>{E(R=>$r(Md(R,[A])));},moveTask:(A,R)=>{E(j=>Fd(j,[A],R));},createSubtask:async A=>{let{tasks:R,newTask:j}=Id(ye,A);if(Ie){let J=Ie({...j,parentId:A});if((J instanceof Promise?await J:J)===false)return}E($r(R)),Be&&Be({...j,parentId:A});},scrollToTask:A=>{let j=De.flattenTasks(ye).findIndex(J=>J.id===A);if(j!==-1&&$t.current){let J=j*Ws;$t.current.scrollTo({top:J,behavior:"smooth"}),jt.current&&jt.current.scrollTo({top:J,behavior:"smooth"});}},highlightTask:(A,R=2e3)=>{},expandTask:A=>{E(R=>{let j=J=>J.map(we=>we.id===A?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:j(we.subtasks)}:we);return j(R)});},collapseTask:A=>{E(R=>{let j=J=>J.map(we=>we.id===A?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:j(we.subtasks)}:we);return j(R)});},expandAll:()=>{E(A=>{let R=j=>j.map(J=>({...J,isExpanded:true,subtasks:J.subtasks?R(J.subtasks):void 0}));return R(A)});},collapseAll:()=>{E(A=>{let R=j=>j.map(J=>({...J,isExpanded:false,subtasks:J.subtasks?R(J.subtasks):void 0}));return R(A)});},collapseToLevel:A=>{P(A);},undo:me,redo:_e,canUndo:()=>at,canRedo:()=>oa,clearHistory:Ut,exportToPNG:async()=>{if(!Ia.current||!$t.current||!jt.current)throw new Error("Gantt container not found");let A=Ia.current,R=$t.current,j=aa.current||R.querySelector(".gantt-grid-scroll"),J=jt.current,we=j?.scrollTop||0,Pe=J.scrollTop,Mt=A.style.overflow,ut=A.style.height,Ea=R.style.overflow;try{let Xt=j?.querySelector(".gantt-taskgrid-content"),pa=J.querySelector("svg"),sr=Xt?.scrollHeight||j?.scrollHeight||600,Dr=pa?.getBoundingClientRect().height||J.scrollHeight,Ko=(A.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(sr,Dr)+20;j&&(j.scrollTop=0),J.scrollTop=0,A.style.overflow="visible",A.style.height=`${Ko}px`,R.style.overflow="visible",await new Promise(xn=>setTimeout(xn,100));let ao=await htmlToImage.toPng(A,{backgroundColor:Dt.bgPrimary,pixelRatio:2,filter:xn=>{if(!(xn instanceof Element))return !0;let Vs=window.getComputedStyle(xn),Qn=parseInt(Vs.zIndex,10);return (isNaN(Qn)||Qn<50)&&Vs.position!=="fixed"}});return await(await fetch(ao)).blob()}finally{A.style.overflow=Mt,A.style.height=ut,R.style.overflow=Ea,j&&(j.scrollTop=we),J.scrollTop=Pe;}},exportToPDF:async A=>{await De.exportToPDF(ye,A);},exportToExcel:async A=>{await De.exportToExcel(ye,A,fl.current);},exportToJSON:()=>De.exportToJSON(ye),exportToCSV:()=>De.exportToCSV(ye),importFromJSON:A=>{let R=De.importFromJSON(A);E(R);},getTasks:()=>ye,refresh:()=>{E(A=>[...A]);},clearAll:()=>{E([]);}}),[ye,me,_e,at,oa,Ut,Dt,Ws]);let lf=react.useCallback(A=>{ge(R=>R.map(j=>j.id===A?{...j,visible:!j.visible}:j));},[]),df=react.useCallback((A,R)=>{ge(j=>j.map(J=>{if(J.id!==A)return J;let we=J.minWidth??100,Pe=J.maxWidth??800,Mt=Math.max(we,Math.min(Pe,R));return {...J,width:Mt}}));},[]),cf=react.useCallback(A=>{E(R=>{let j=Ld(R,A),J=we=>{for(let Pe of we){if(Pe.id===A){Ta.current.set(A,Pe.isExpanded??true);return}Pe.subtasks?.length&&J(Pe.subtasks);}};return J(j),Nr(),j}),a.onTaskToggleExpand?.(A);},[a,Nr]),fn=react.useCallback((A,R)=>{if(ot&&ot(A,R)===false)return;let J=De.findTaskById(ye,A)?.progress,we=Mt=>Mt.map(ut=>ut.id===A?{...ut,...R}:ut.subtasks?{...ut,subtasks:we(ut.subtasks)}:ut);E(we(ye));let Pe=De.findTaskById(we(ye),A);Pe&&(B?.(Pe),ae?.(Pe),R.progress!==void 0&&J!==void 0&&R.progress!==J&&he?.(A,J,R.progress));},[ye,B,ot,ae,he]),uf=react.useCallback(A=>{A.length!==0&&(Pr.current+=1,Ur.current=true,E(R=>$r(Ed(R,A))),a.onTaskIndent?.(A[0]));},[a]),pf=react.useCallback(A=>{A.length!==0&&(Pr.current+=1,Ur.current=true,E(R=>$r(Md(R,A))),a.onTaskOutdent?.(A[0]));},[a]),mf=react.useCallback((A,R,j)=>{Pr.current+=1,Ur.current=true,E(J=>$r(um(J,A,R,j))),a.onTaskReparent?.(A,R,j);},[a]),gf=react.useCallback((A,R)=>{A.length!==0&&(Pr.current+=1,Ur.current=true,E(j=>Fd(j,A,R)),a.onTaskMove?.(A[0],R));},[a]),pl=react.useCallback(async A=>{let R=[];for(let j of A)nt&&await Promise.resolve(nt(j))===false||R.push(j);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(E(j=>$r(Pd(j,R))),R.forEach(j=>a.onTaskDelete?.(j))),fe&&R.forEach(j=>fe(j)));},[a,nt,fe]),ff=react.useCallback(A=>{a.onTaskDuplicate?A.forEach(R=>{let j=De.findTaskById(ye,R);j&&a.onTaskDuplicate(j);}):E(R=>ys(R,A).tasks);},[a,ye]),bf=react.useCallback((A,R)=>{E(j=>{let{tasks:J,newTask:we}=cm(j,A,R);return Ie&&Ie(we)===false?j:(a.onTaskCreate?.(we.parentId,we.position||0),Be?.(we),J)});},[a,Ie,Be]),hf=react.useCallback((A,R)=>{E(j=>Ad(j,A,R)),a.onTaskRename?.(A,R);},[a]),ml=react.useCallback(A=>{let{onTaskAddSubtask:R}=a;if(R){let j=Rn(ye,A);if(j){R(j);return}}E(j=>{let{tasks:J}=Id(j,A);return a.onTaskCreate?.(A,0),J});},[a,ye]),yf=react.useCallback((A,R,j)=>{let J=!A.startDate&&!A.endDate,we=A.startDate?Math.round((R.getTime()-A.startDate.getTime())/(1e3*60*60*24)):0,Pe=Xt=>Xt.map(pa=>pa.id===A.id?{...pa,startDate:R,endDate:j,...A.segments&&{segments:A.segments}}:pa.subtasks?{...pa,subtasks:Pe(pa.subtasks)}:pa),Mt=Pe(ye),ut=Mt;Mt=De.autoScheduleDependents(Mt,A.id,we),Mt=$r(Mt),E(Mt);let Ea={...A,startDate:R,endDate:j};if(J&&a?.onTaskDateChange?a.onTaskDateChange(A,R,j):B?.(Ea),K&&we!==0){let Xt=De.flattenTasks(ut),pa=De.flattenTasks(Mt),sr=[];for(let Dr of pa){if(Dr.id===A.id)continue;let Do=Xt.find(ao=>ao.id===Dr.id);if(!Do)continue;let yn=Dr.startDate?.getTime()!==Do.startDate?.getTime(),Ko=Dr.endDate?.getTime()!==Do.endDate?.getTime();(yn||Ko)&&sr.push(Dr);}sr.length>0&&K(sr);}},[ye,B,K,a]),xf=react.useCallback((A,R)=>{$e?.(A,R),wt({isOpen:true,x:R.clientX,y:R.clientY,task:A});},[$e]),vf=react.useCallback((A,R)=>{let j=De.splitTask(ye,A.id,R);E(j),wt({isOpen:false,x:0,y:0,task:null});},[ye]),Xc=react.useCallback(A=>{let R=De.findTaskById(ye,A.id)||A;Z?.(R),Xe||ga(R);},[ye,Z,Xe]),Jc=react.useCallback((A,R,j)=>{let J=new Map,we=Xt=>{Xt.forEach(pa=>{pa.dependencies&&J.set(pa.id,pa.dependencies),pa.subtasks&&we(pa.subtasks);});};we(j);let Pe=J.get(R)||[];J.set(R,[...Pe,A]);let Mt=new Set,ut=new Set,Ea=Xt=>{if(!Mt.has(Xt)){Mt.add(Xt),ut.add(Xt);let pa=J.get(Xt)||[];for(let sr of pa){if(!Mt.has(sr)&&Ea(sr))return true;if(ut.has(sr))return true}}return ut.delete(Xt),false};return Ea(R)},[]),Qc=react.useCallback((A,R)=>{if(Jc(A.id,R,Xn.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 G=Q=>Q.map(ve=>{if(ve.id===R){let Ae=ve.dependencies||[];if(!Ae.includes(P.id))return {...ve,dependencies:[...Ae,P.id]}}return ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve});Fr.current+=1,E(Q=>G(Q)),Le?.(P.id,R);},[Le,Xc]),Qc=react.useCallback((P,R)=>{let G=Q=>Q.map(ve=>{if(ve.id===P&&ve.dependencies){let Ae=ve.dependencies.filter(Mt=>Mt!==R);return {...ve,dependencies:Ae}}return ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve});Fr.current+=1,E(Q=>G(Q)),we?.(P,R);},[we]),{startDate:gn,endDate:pl}=react.useMemo(()=>{let P=ye.filter(Ae=>Ae.startDate&&Ae.endDate);if(P.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let pt=new Date(Ae);return pt.setDate(pt.getDate()+60),{startDate:Mt,endDate:pt}}let R=P.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),G=new Date(Math.min(...R.map(Ae=>Ae.getTime()))),Q=new Date(Math.max(...R.map(Ae=>Ae.getTime()))),ve=Xe==="day"?7:Xe==="week"?14:30;return G.setDate(G.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:G,endDate:Q}},[ye,Xe]);react.useEffect(()=>{yt.current?.(gn,pl);},[gn,pl]);let wf=react.useCallback(async()=>{if(!ar.current||!oa.current||!Ea.current)return;await new Promise(jo=>setTimeout(jo,200));let P=ar.current,R=oa.current,G=Sa.current||R.querySelector(".gantt-grid-scroll"),Q=Ea.current,ve=G?.scrollTop||0,Ae=G?.scrollLeft||0,Mt=Q.scrollTop,pt=Q.scrollLeft,Ma=P.style.overflow,Xt=P.style.height,ua=G?.style.overflow||"",ir=Q.style.overflow,Nr=R.style.overflow,Co=P.style.width,bn=Q.style.width;try{let jo=G?.querySelector(".gantt-taskgrid-content"),to=Q.querySelector("svg"),fl=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,hn=jo?.scrollHeight||G?.scrollHeight||600,zs=Math.max(fl,Q.scrollHeight),Yn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||Q.scrollWidth,Mf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,bl=Math.max(hn,zs,fl),tu=Mf+bl+50,au=(G?.offsetWidth||R.offsetWidth||300)+Yn+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${tu}px`,P.style.width=`${au}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${bl+50}px`),Q.style.overflow="visible",Q.style.height=`${bl+50}px`,Q.style.width=`${Yn+10}px`,await new Promise(Us=>setTimeout(Us,150));let Ff=await htmlToImage.toPng(P,{backgroundColor:Ft.bgPrimary,pixelRatio:2,width:au,height:tu,skipFonts:!1,filter:Us=>{if(!(Us instanceof Element))return !0;let ru=window.getComputedStyle(Us),ou=parseInt(ru.zIndex,10);return !(!isNaN(ou)&&ou>=50||ru.position==="fixed")}}),hl=document.createElement("a");hl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,hl.href=Ff,hl.click();}finally{P.style.overflow=Ma,P.style.height=Xt,P.style.width=Co,R.style.overflow=Nr,G&&(G.style.overflow=ua,G.style.height="",G.scrollTop=ve,G.scrollLeft=Ae),Q.style.overflow=ir,Q.style.height="",Q.style.width=bn,Q.scrollTop=Mt,Q.scrollLeft=pt;}p?.("png");},[Ft,p]),kf=react.useCallback(async()=>{await Se.exportToPDF(ye),p?.("pdf");},[ye,p]),ml=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});ml.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Cf=react.useCallback(async()=>{let P=new Date,R=ve=>String(ve).padStart(2,"0"),G=`${P.getFullYear()}-${R(P.getMonth()+1)}-${R(P.getDate())}_${R(P.getHours())}${R(P.getMinutes())}`,Q=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(ye,`${Q}_${G}.xlsx`,ml.current),p?.("excel");},[ye,d,p]),Tf=react.useCallback(()=>{let P=Se.exportToCSV(ye),R=new Blob([P],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href),p?.("csv");},[ye,p]),Nf=react.useCallback(()=>{let P=Se.exportToJSON(ye),R=new Blob([P],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href),p?.("json");},[ye,p]),Df=react.useCallback(()=>{Se.exportToMSProject(ye,"Gantt Project","project.xml"),p?.("msproject");},[ye,p]),Sf=P=>{P.preventDefault(),Je(true);},fn=react.useRef(false),[gl,Zc]=react.useState(false),qn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=Ea.current,R=oa.current?.querySelector(".gantt-grid-scroll");if(!P||!R)return;let G=()=>{if(fn.current)return;fn.current=true;let pt=P.scrollTop;ge(pt),R.scrollTop=pt,requestAnimationFrame(()=>{fn.current=false;});},Q=()=>{if(fn.current)return;fn.current=true;let pt=R.scrollTop;ge(pt),P.scrollTop=pt,requestAnimationFrame(()=>{fn.current=false;});},ve=pt=>{if(De&&R){let Xt=R.parentElement?.getBoundingClientRect()?.left||0,ua=pt.clientX-Xt,ir=200,Nr=it+Ht,Co=window.innerWidth*St,bn=Math.max(Nr,Co);ua>=ir&&ua<=bn&&ze(ua);}if(gl&&P){let Ma=pt.clientX-qn.current.x,Xt=pt.clientY-qn.current.y;P.scrollLeft=qn.current.scrollLeft-Ma,P.scrollTop=qn.current.scrollTop-Xt;}},Ae=()=>{Je(false),Zc(false);},Mt=pt=>{if(pt.button!==0)return;let Ma=pt.target;Ma.closest("[data-task-bar]")||Ma.closest("[data-dependency-line]")||Ma.closest("button")||Ma.closest('[role="button"]')||Ma.tagName==="rect"&&Ma.getAttribute("data-clickable")==="true"||(Zc(true),qn.current={x:pt.clientX,y:pt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},pt.preventDefault());};return P.addEventListener("scroll",G),R.addEventListener("scroll",Q),P.addEventListener("mousedown",Mt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Ae),()=>{P.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Ae);}},[De,gl,it]);let eu=react.useRef(false),Ef=react.useRef(null);return react.useLayoutEffect(()=>{if(eu.current||ye.length===0||!Ea.current)return;eu.current=true,Ef.current=gn;let P=Ea.current,R=new Date,G=Xe==="day"?60:Xe==="week"?20:8,Q=(R.getTime()-gn.getTime())/(1e3*60*60*24),ve=P.clientWidth,Mt=Q*G*K-ve/2;Q>=0&&ve>0&&(P.scrollLeft=Math.max(0,Mt));},[ye.length,gn,Xe,K]),jsxRuntime.jsx(Fn.Provider,{value:ke,children:jsxRuntime.jsx(kl.Provider,{value:eo,children:jsxRuntime.jsxs("div",{ref:ar,className:"flex flex-col h-full w-full",style:{backgroundColor:Ft.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Ft.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Ft.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(xi,{theme:Ft,timeScale:Xe,onTimeScaleChange:H,zoom:K,onZoomChange:ue,currentTheme:mt,onThemeChange:Ze,rowDensity:ne,onRowDensityChange:D,showThemeSelector:c,showCreateTaskButton:N&&et?.canCreateTask!==false&&!et?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:k,taskFilter:at,onTaskFilterChange:ie,hideCompleted:me,onHideCompletedChange:L,toolbarRightContent:I,wbsLevel:Te,onWbsLevelChange:se,maxWbsDepth:Ua,viewMode:Ne,onViewModeChange:He,projectForecast:$,onExportPNG:i?wf:void 0,onExportPDF:i?kf:void 0,onExportExcel:i?Cf:void 0,onExportCSV:i?Tf:void 0,onExportJSON:i?Nf:void 0,onExportMSProject:i?Df:void 0,showCriticalPath:Ge,onShowCriticalPathChange:Et,showDependencies:dt,onShowDependenciesChange:Nt,highlightWeekends:ot,onHighlightWeekendsChange:Tt,showBaseline:Fe,onShowBaselineChange:P=>{P&&Ne!=="oracle"&&He("oracle"),!P&&Ne==="oracle"&&He("execution");},onCopySnapshotLink:nt,hasDependencies:sf})}),jsxRuntime.jsxs("div",{ref:oa,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Sa,className:"gantt-grid-scroll flex-shrink-0",style:{width:zt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ki,{tasks:qc,theme:Ft,rowHeight:Hs,availableUsers:m,templates:mo,showCriticalPath:Ge,onTaskClick:q,onTaskDblClick:Yc,onTaskContextMenu:Ee,onTaskToggle:cf,scrollTop:Y,columns:ce,onToggleColumn:lf,onColumnResize:df,onTaskUpdate:mn,onTaskIndent:uf,onTaskOutdent:pf,onTaskMove:gf,onMultiTaskDelete:cl,onTaskDuplicate:ff,onTaskCreate:bf,onTaskRename:hf,onCreateSubtask:ul,onOpenTaskModal:q?P=>q(P):void 0,onDeleteRequest:(P,R)=>U({taskId:P,taskName:R}),onTaskReparent:mf,scrollContainerRef:Sa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Ft.border,zIndex:15},onMouseDown:Sf}),jsxRuntime.jsx("div",{ref:Ea,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:gl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ai,{tasks:qc,theme:Ft,rowHeight:Hs,timeScale:Xe,startDate:gn,endDate:pl,zoom:K,locale:v,templates:mo,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:q,onTaskDblClick:Yc,onTaskContextMenu:xf,onTaskDateChange:yf,onDependencyCreate:Jc,onDependencyDelete:Qc,showBaseline:Fe,showCriticalPath:Ge,showDependencies:dt,highlightWeekends:ot,canEditTask:et?.canEditTask})})]}),vt.task&&jsxRuntime.jsx(An,{isOpen:vt.isOpen,x:vt.x,y:vt.y,theme:Ft,onClose:()=>ut({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=vt.task;if(!P)return [];let R=Se.findTaskById(ye,P.id)||P,G=R.subtasks&&R.subtasks.length>0,Q=et?.canCreateTask!==false,ve=et?.canDeleteTask!==false;if(G){let Xt=[],ua=et?.canDuplicateTask!==false;return Q&&Xt.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{z?z(R):ul(R.id);}}),ua&&Xt.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):E(ir=>fs(ir,[R.id]).tasks),ut({isOpen:false,x:0,y:0,task:null});}}),ve&&(Xt.length>0&&Xt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Xt.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{U({taskId:R.id,taskName:R.name});}})),Xt}let Ae=et?.canUpdateTask!==false,Mt=et?.canDuplicateTask!==false,pt=[];return Ae&&pt.push({id:"edit",label:ke.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{Ye?Ye(R):ha(R);}}),Q&&pt.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{z?z(R):ul(R.id);}}),pt.length>0&&Ae&&pt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(pt.push({id:"markIncomplete",label:ke.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{re?re(R):mn(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),pt.push({id:"setInProgress",label:ke.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{J?J(R):mn(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),pt.push({id:"markComplete",label:ke.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{mn(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Mt||Ae&&R.startDate&&R.endDate)&&pt.length>0&&pt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&pt.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):E(Xt=>fs(Xt,[R.id]).tasks),ut({isOpen:false,x:0,y:0,task:null});}}),Ae&&R.startDate&&R.endDate&&pt.push({id:"split",label:ke.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Xt=R.startDate.getTime(),ua=R.endDate.getTime(),ir=Xt+(ua-Xt)/2,Nr=new Date(ir);vf(R,Nr);}}),ve&&(pt.length>0&&pt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),pt.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{U({taskId:R.id,taskName:R.name});}})),pt})()}),jsxRuntime.jsx(bo,{task:Wt,isOpen:!!Wt,onClose:()=>ha(null),onTaskUpdate:P=>{Wt&&(mn(Wt.id,P),ha(null));},theme:mt==="light"?"light":"dark",locale:v==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ta&&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:()=>U(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ft.bgSecondary,border:`1px solid ${Ft.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ft.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:Ft.textPrimary,fontFamily:"Inter, sans-serif"},children:[ke.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Ft.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Ft.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Ft.textPrimary},children:['"',ta.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ft.bgPrimary,borderTop:`1px solid ${Ft.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>U(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ft.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Ft.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{cl([ta.taskId]),U(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsxRuntime.jsx(Bi,{tasks:ye,theme:Ft,config:b,onTasksUpdate:E,onTaskUpdate:mn,onTaskCreate:P=>{E(R=>[...R,P]);},onTaskDelete:P=>{cl([P]);},onDependencyCreate:(P,R)=>{let G=Se.findTaskById(ye,P);G&&Jc(G,R);},onDependencyDelete:Qc})]})})})});function o2(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 n2(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 l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Bd=[{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 Pm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Bd,...i.filter(D=>!Bd.some(K=>K.id===D.id))],f=ft[c]||ft.dark,[b,v]=react.useState(false),[C,N]=react.useState(false),[T,k]=react.useState(false),[w,F]=react.useState(false),[I,S]=react.useState({top:0,left:0}),[X,O]=react.useState(null),[$,A]=react.useState(new Date),[q,Z]=react.useState({top:0,left:0}),[Ee,B]=react.useState(false),[_,he]=react.useState([]),[Ye,z]=react.useState(false),[re,J]=react.useState(""),Le=react.useRef(null),we=react.useRef(null),Oe=react.useRef(null),Be=react.useRef(null),lt=react.useRef(null),[ee,ct]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[pe,et]=react.useState({});react.useEffect(()=>{a?(ct({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||"#2E94FF",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)&&B(true)):(ct({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),he([]));},[a,e,x]),react.useEffect(()=>{let D=K=>{Le.current&&!Le.current.contains(K.target)&&v(false),we.current&&!we.current.contains(K.target)&&N(false),Oe.current&&!Oe.current.contains(K.target)&&k(false),Be.current&&!Be.current.contains(K.target)&&F(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let nt=()=>{let D={};return ee.name.trim()||(D.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),et(D),Object.keys(D).length===0},Ut=async D=>{if(D.preventDefault(),!!nt())try{let K=l==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(K),he([]),t();}catch(K){console.error("Error submitting task:",K);}},Ce=(D,K)=>{ct(ue=>{let Te={...ue,[D]:K};if(D==="status"){let V=K;V==="todo"?Te.progress=0:V==="in-progress"?(ue.progress===0||ue.progress===100)&&(Te.progress=50):V==="completed"||V==="closed"?Te.progress=100:(V==="in-review"||V==="review")&&(Te.progress=75);}if(D==="progress"){let V=typeof K=="number"?K:parseInt(K,10);V===100&&ue.status!=="completed"?Te.status="completed":V>0&&V<100&&ue.status==="todo"?Te.status="in-progress":V===0&&ue.status!=="todo"&&(Te.status="todo");}return Te}),pe[D]&&et(ue=>{let Te={...ue};return delete Te[D],Te});},mt=h.find(D=>D.id===ee.status)??Bd[0],Dt=Rd.find(D=>D.id===ee.priority)??Rd[1],Xe=Jo.find(D=>D.value===ee.color)??Jo[0],H=c==="dark",ne={backgroundColor:H?"#1d1f27":f.bgSecondary,border:`1px solid ${H?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.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:H?"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:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"rgba(65,71,84,0.1)":f.border}`,boxShadow:H?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:Ut,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:ee.name,onChange:D=>Ce("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.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"}),pe.name]}),jsxRuntime.jsx("textarea",{value:ee.description||"",onChange:D=>Ce("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),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:Le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,borderColor:mt.color,backgroundColor:`${mt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsxRuntime.jsx("span",{style:{color:mt.color},children:mt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:mt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",D.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ee.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:we,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Dt.color}}),jsxRuntime.jsx("span",{children:Dt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Rd.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",D.id),N(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,ee.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Oe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((D,K)=>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:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},K))}),ee.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let K=ee.assignees?.some(ue=>ue.name===D.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:f.textPrimary},onMouseEnter:ue=>ue.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ue=K?(ee.assignees||[]).filter(Te=>Te.name!==D.name):[...ee.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ue);},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:f.accent},children:D.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:Be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)F(false);else {if(Be.current){let D=Be.current.getBoundingClientRect(),K=window.innerHeight,ue=120,V=K-D.bottom<ue?D.top-ue-8:D.bottom+8;S({top:V,left:D.left});}F(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsxRuntime.jsx("span",{children:Xe.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>F(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:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Jo.slice(0,18).map(D=>{let K=ee.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:ue=>{ue.preventDefault(),ue.stopPropagation(),Ce("color",D.value),F(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:K?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(So,{selectedTags:ee.tags||[],availableTags:p,onChange:D=>Ce("tags",D),onCreateTag:d,theme:f,disabled:n}):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:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:H?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:lt,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X==="start")O(null);else {if(lt.current){let D=lt.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("start"),A(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X==="end")O(null);else {if(lt.current){let D=lt.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("end"),A(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(Jt,{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:`${q.top}px`,left:`${q.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let D=new Date,K=new Date(D);K.setDate(D.getDate()+1);let ue=new Date(D);ue.setDate(D.getDate()+7);let Te=new Date(D);return Te.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:ue},{label:"2 semanas",date:Te}].map((te,$e)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{X==="start"?(Ce("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&Ce("endDate",te.date),O("end")):(Ce("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&Ce("startDate",te.date),O(null));},children:te.label},$e))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("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($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,K)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=$.getFullYear(),K=$.getMonth(),ue=new Date(D,K,1).getDay(),Te=new Date(D,K+1,0).getDate(),V=new Date,te=[];for(let Ne=ue-1;Ne>=0;Ne--)te.push({day:new Date(D,K,-Ne).getDate(),date:new Date(D,K-1,new Date(D,K,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)te.push({day:Ne,date:new Date(D,K,Ne),isCurrentMonth:true});let $e=42-te.length;for(let Ne=1;Ne<=$e;Ne++)te.push({day:Ne,date:new Date(D,K+1,Ne),isCurrentMonth:false});return te.map((Ne,He)=>{let Fe=Ne.date.toDateString()===V.toDateString(),Ge=ee.startDate?.toDateString()===Ne.date.toDateString(),ht=ee.endDate?.toDateString()===Ne.date.toDateString(),dt=ee.startDate&&ee.endDate&&Ne.date>=ee.startDate&&Ne.date<=ee.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:Ne.isCurrentMonth?Ge||ht?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ge?f.accent:ht?"#7C3AED":dt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ge&&!ht?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X==="start"?(Ce("startDate",Ne.date),ee.endDate&&Ne.date>ee.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ee.startDate&&Ne.date<ee.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},He)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.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:f.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:H?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let K=D.currentTarget.getBoundingClientRect(),ue=Math.round((D.clientX-K.left)/K.width*100/5)*5;Ce("progress",Math.max(0,Math.min(100,ue)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Ee),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Ee?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&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:f.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:f.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?o2(ee.effortMinutes):"",onChange:D=>{let K=n2(D.target.value);Ce("effortMinutes",K);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.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:f.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:f.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ee.parentId||"",onChange:D=>Ce("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.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:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:D=>Ce("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),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:f.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:D=>Ce("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.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:f.textTertiary},children:["Adjuntos ",l==="create"?_.length>0&&`(${_.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(so,{cardId:"pending",attachments:_.map((D,K)=>({id:`pending-${K}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>he(K=>[...K,...D]),onDelete:D=>{let K=parseInt(D.replace("pending-",""),10);he(ue=>ue.filter((Te,V)=>V!==K));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(so,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&_.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:D=>Ce("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.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:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(D=>{let K=r.find(ue=>ue.id===D);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[K?.name||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ue=(ee.dependencies||[]).filter(Te=>Te!==D);Ce("dependencies",ue);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},D)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{z(!Ye),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),J("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"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 ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:re,onChange:D=>J(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>re===""||D.name.toLowerCase().includes(re.toLowerCase())).map(D=>{let K=ee.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ue=ee.dependencies||[],Te;K?Te=ue.filter(V=>V!==D.id):Te=[...ue,D.id],Ce("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${f.accent}10`:"transparent"},onMouseEnter:ue=>{K||(ue.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ue=>{ue.currentTarget.style.backgroundColor=K?`${f.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:K?f.accent:"transparent",borderColor:K?f.accent:f.borderLight},children:K&&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:f.textPrimary},children:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.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 ${H?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:H?"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:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Am=`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 j=J=>J.map(we=>{if(we.id===R){let Pe=we.dependencies||[];if(!Pe.includes(A.id))return {...we,dependencies:[...Pe,A.id]}}return we.subtasks?{...we,subtasks:j(we.subtasks)}:we});Pr.current+=1,E(J=>j(J)),Ee?.(A.id,R);},[Ee,Jc]),Zc=react.useCallback((A,R)=>{let j=J=>J.map(we=>{if(we.id===A&&we.dependencies){let Pe=we.dependencies.filter(Mt=>Mt!==R);return {...we,dependencies:Pe}}return we.subtasks?{...we,subtasks:j(we.subtasks)}:we});Pr.current+=1,E(J=>j(J)),Te?.(A,R);},[Te]),{startDate:bn,endDate:gl}=react.useMemo(()=>{let A=ye.filter(Pe=>Pe.startDate&&Pe.endDate);if(A.length===0){let Pe=new Date,Mt=new Date(Pe);Mt.setDate(Mt.getDate()-30);let ut=new Date(Pe);return ut.setDate(ut.getDate()+60),{startDate:Mt,endDate:ut}}let R=A.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),j=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),J=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),we=Qe==="day"?7:Qe==="week"?14:30;return j.setDate(j.getDate()-we),J.setDate(J.getDate()+we),{startDate:j,endDate:J}},[ye,Qe]);react.useEffect(()=>{mt.current?.(bn,gl);},[bn,gl]);let wf=react.useCallback(async()=>{if(!Ia.current||!$t.current||!jt.current)return;await new Promise(Ko=>setTimeout(Ko,200));let A=Ia.current,R=$t.current,j=aa.current||R.querySelector(".gantt-grid-scroll"),J=jt.current,we=j?.scrollTop||0,Pe=j?.scrollLeft||0,Mt=J.scrollTop,ut=J.scrollLeft,Ea=A.style.overflow,Xt=A.style.height,pa=j?.style.overflow||"",sr=J.style.overflow,Dr=R.style.overflow,Do=A.style.width,yn=J.style.width;try{let Ko=j?.querySelector(".gantt-taskgrid-content"),ao=J.querySelector("svg"),hl=ao?.getAttribute("height")?parseInt(ao.getAttribute("height"),10):ao?.getBoundingClientRect().height||0,xn=Ko?.scrollHeight||j?.scrollHeight||600,Vs=Math.max(hl,J.scrollHeight),Qn=ao?.getAttribute("width")?parseInt(ao.getAttribute("width"),10):ao?.getBoundingClientRect().width||J.scrollWidth,Mf=A.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,yl=Math.max(xn,Vs,hl),au=Mf+yl+50,ru=(j?.offsetWidth||R.offsetWidth||300)+Qn+10;j&&(j.scrollTop=0,j.scrollLeft=0),J.scrollTop=0,J.scrollLeft=0,A.style.overflow="visible",A.style.height=`${au}px`,A.style.width=`${ru}px`,R.style.overflow="visible",j&&(j.style.overflow="visible",j.style.height=`${yl+50}px`),J.style.overflow="visible",J.style.height=`${yl+50}px`,J.style.width=`${Qn+10}px`,await new Promise(Gs=>setTimeout(Gs,150));let Ff=await htmlToImage.toPng(A,{backgroundColor:Dt.bgPrimary,pixelRatio:2,width:ru,height:au,skipFonts:!1,filter:Gs=>{if(!(Gs instanceof Element))return !0;let ou=window.getComputedStyle(Gs),nu=parseInt(ou.zIndex,10);return !(!isNaN(nu)&&nu>=50||ou.position==="fixed")}}),xl=document.createElement("a");xl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,xl.href=Ff,xl.click();}finally{A.style.overflow=Ea,A.style.height=Xt,A.style.width=Do,R.style.overflow=Dr,j&&(j.style.overflow=pa,j.style.height="",j.scrollTop=we,j.scrollLeft=Pe),J.style.overflow=sr,J.style.height="",J.style.width=yn,J.scrollTop=Mt,J.scrollLeft=ut;}p?.("png");},[Dt,p]),kf=react.useCallback(async()=>{await De.exportToPDF(ye),p?.("pdf");},[ye,p]),fl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});fl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Cf=react.useCallback(async()=>{let A=new Date,R=we=>String(we).padStart(2,"0"),j=`${A.getFullYear()}-${R(A.getMonth()+1)}-${R(A.getDate())}_${R(A.getHours())}${R(A.getMinutes())}`,J=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(ye,`${J}_${j}.xlsx`,fl.current),p?.("excel");},[ye,d,p]),Tf=react.useCallback(()=>{let A=De.exportToCSV(ye),R=new Blob([A],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href),p?.("csv");},[ye,p]),Nf=react.useCallback(()=>{let A=De.exportToJSON(ye),R=new Blob([A],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href),p?.("json");},[ye,p]),Df=react.useCallback(()=>{De.exportToMSProject(ye,"Gantt Project","project.xml"),p?.("msproject");},[ye,p]),Sf=A=>{A.preventDefault(),Ke(true);},hn=react.useRef(false),[bl,eu]=react.useState(false),Jn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let A=jt.current,R=$t.current?.querySelector(".gantt-grid-scroll");if(!A||!R)return;let j=()=>{if(hn.current)return;hn.current=true;let ut=A.scrollTop;pe(ut),R.scrollTop=ut,requestAnimationFrame(()=>{hn.current=false;});},J=()=>{if(hn.current)return;hn.current=true;let ut=R.scrollTop;pe(ut),A.scrollTop=ut,requestAnimationFrame(()=>{hn.current=false;});},we=ut=>{if(Fe&&R){let Xt=R.parentElement?.getBoundingClientRect()?.left||0,pa=ut.clientX-Xt,sr=200,Dr=Ge+vt,Do=window.innerWidth*ta,yn=Math.max(Dr,Do);pa>=sr&&pa<=yn&&ze(pa);}if(bl&&A){let Ea=ut.clientX-Jn.current.x,Xt=ut.clientY-Jn.current.y;A.scrollLeft=Jn.current.scrollLeft-Ea,A.scrollTop=Jn.current.scrollTop-Xt;}},Pe=()=>{Ke(false),eu(false);},Mt=ut=>{if(ut.button!==0)return;let Ea=ut.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(eu(true),Jn.current={x:ut.clientX,y:ut.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},ut.preventDefault());};return A.addEventListener("scroll",j),R.addEventListener("scroll",J),A.addEventListener("mousedown",Mt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Pe),()=>{A.removeEventListener("scroll",j),R.removeEventListener("scroll",J),A.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Pe);}},[Fe,bl,Ge]);let tu=react.useRef(false),Ef=react.useRef(null);return react.useLayoutEffect(()=>{if(tu.current||ye.length===0||!jt.current)return;tu.current=true,Ef.current=bn;let A=jt.current,R=new Date,j=Qe==="day"?60:Qe==="week"?20:8,J=(R.getTime()-bn.getTime())/(1e3*60*60*24),we=A.clientWidth,Mt=J*j*V-we/2;J>=0&&we>0&&(A.scrollLeft=Math.max(0,Mt));},[ye.length,bn,Qe,V]),jsxRuntime.jsx(An.Provider,{value:xe,children:jsxRuntime.jsx(Tl.Provider,{value:ur,children:jsxRuntime.jsxs("div",{ref:Ia,className:"flex flex-col h-full w-full",style:{backgroundColor:Dt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Dt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Dt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(ki,{theme:Dt,timeScale:Qe,onTimeScaleChange:O,zoom:V,onZoomChange:ce,currentTheme:gt,onThemeChange:et,rowDensity:ie,onRowDensityChange:M,showThemeSelector:c,showCreateTaskButton:D&&Ze?.canCreateTask!==false&&!Ze?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:k,taskFilter:dt,onTaskFilterChange:se,hideCompleted:ue,onHideCompletedChange:L,toolbarRightContent:I,wbsLevel:Ne,onWbsLevelChange:P,maxWbsDepth:Ua,viewMode:ve,onViewModeChange:He,projectForecast:X,onExportPNG:i?wf:void 0,onExportPDF:i?kf:void 0,onExportExcel:i?Cf:void 0,onExportCSV:i?Tf:void 0,onExportJSON:i?Nf:void 0,onExportMSProject:i?Df:void 0,showCriticalPath:We,onShowCriticalPathChange:zt,showDependencies:ct,onShowDependenciesChange:pt,highlightWeekends:lt,onHighlightWeekendsChange:Et,showBaseline:Me,onShowBaselineChange:A=>{A&&ve!=="oracle"&&He("oracle"),!A&&ve==="oracle"&&He("execution");},onCopySnapshotLink:xt,hasDependencies:To})}),jsxRuntime.jsxs("div",{ref:$t,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:aa,className:"gantt-grid-scroll flex-shrink-0",style:{width:Gt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Ni,{tasks:No,theme:Dt,rowHeight:Ws,availableUsers:m,templates:Co,showCriticalPath:We,onTaskClick:G,onTaskDblClick:Xc,onTaskContextMenu:$e,onTaskToggle:cf,scrollTop:q,columns:tt,onToggleColumn:lf,onColumnResize:df,onTaskUpdate:fn,onTaskIndent:uf,onTaskOutdent:pf,onTaskMove:gf,onMultiTaskDelete:pl,onTaskDuplicate:ff,onTaskCreate:bf,onTaskRename:hf,onCreateSubtask:ml,onOpenTaskModal:G?A=>G(A):void 0,onDeleteRequest:(A,R)=>z({taskId:A,taskName:R}),onTaskReparent:mf,scrollContainerRef:aa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Dt.border,zIndex:15},onMouseDown:Sf}),jsxRuntime.jsx("div",{ref:jt,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:bl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Bi,{tasks:No,theme:Dt,rowHeight:Ws,timeScale:Qe,startDate:bn,endDate:gl,zoom:V,locale:v,templates:Co,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:G,onTaskDblClick:Xc,onTaskContextMenu:xf,onTaskDateChange:yf,onDependencyCreate:Qc,onDependencyDelete:Zc,showBaseline:Me,showCriticalPath:We,showDependencies:ct,highlightWeekends:lt,canEditTask:Ze?.canEditTask})})]}),ht.task&&jsxRuntime.jsx(In,{isOpen:ht.isOpen,x:ht.x,y:ht.y,theme:Dt,onClose:()=>wt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let A=ht.task;if(!A)return [];let R=De.findTaskById(ye,A.id)||A,j=R.subtasks&&R.subtasks.length>0,J=Ze?.canCreateTask!==false,we=Ze?.canDeleteTask!==false;if(j){let Xt=[],pa=Ze?.canDuplicateTask!==false;return J&&Xt.push({id:"addSubtask",label:xe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{H?H(R):ml(R.id);}}),pa&&Xt.push({id:"duplicate",label:xe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):E(sr=>ys(sr,[R.id]).tasks),wt({isOpen:false,x:0,y:0,task:null});}}),we&&(Xt.length>0&&Xt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Xt.push({id:"delete",label:xe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{z({taskId:R.id,taskName:R.name});}})),Xt}let Pe=Ze?.canUpdateTask!==false,Mt=Ze?.canDuplicateTask!==false,ut=[];return Pe&&ut.push({id:"edit",label:xe.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{Xe?Xe(R):ga(R);}}),J&&ut.push({id:"addSubtask",label:xe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{H?H(R):ml(R.id);}}),ut.length>0&&Pe&&ut.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(ut.push({id:"markIncomplete",label:xe.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{re?re(R):fn(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ut.push({id:"setInProgress",label:xe.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{Q?Q(R):fn(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ut.push({id:"markComplete",label:xe.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{fn(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Mt||Pe&&R.startDate&&R.endDate)&&ut.length>0&&ut.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&ut.push({id:"duplicate",label:xe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):E(Xt=>ys(Xt,[R.id]).tasks),wt({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&ut.push({id:"split",label:xe.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Xt=R.startDate.getTime(),pa=R.endDate.getTime(),sr=Xt+(pa-Xt)/2,Dr=new Date(sr);vf(R,Dr);}}),we&&(ut.length>0&&ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ut.push({id:"delete",label:xe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{z({taskId:R.id,taskName:R.name});}})),ut})()}),jsxRuntime.jsx(bo,{task:Bt,isOpen:!!Bt,onClose:()=>ga(null),onTaskUpdate:A=>{Bt&&(fn(Bt.id,A),ga(null));},theme:gt==="light"?"light":"dark",locale:v==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ua&&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:()=>z(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:A=>A.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Dt.bgSecondary,border:`1px solid ${Dt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Dt.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:Dt.textPrimary,fontFamily:"Inter, sans-serif"},children:[xe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Dt.textPrimary},children:['"',ua.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Dt.bgPrimary,borderTop:`1px solid ${Dt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>z(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=Dt.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{pl([ua.taskId]),z(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:A=>{A.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsxRuntime.jsx($i,{tasks:ye,theme:Dt,config:b,onTasksUpdate:E,onTaskUpdate:fn,onTaskCreate:A=>{E(R=>[...R,A]);},onTaskDelete:A=>{pl([A]);},onDependencyCreate:(A,R)=>{let j=De.findTaskById(ye,A);j&&Qc(j,R);},onDependencyDelete:Zc})]})})})});function o2(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 n2(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 l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Od=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],$d=[{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 Am({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Od,...i.filter(M=>!Od.some(V=>V.id===M.id))],f=ft[c]||ft.dark,[b,v]=react.useState(false),[T,D]=react.useState(false),[N,k]=react.useState(false),[w,F]=react.useState(false),[I,S]=react.useState({top:0,left:0}),[Y,$]=react.useState(null),[X,C]=react.useState(new Date),[G,Z]=react.useState({top:0,left:0}),[$e,B]=react.useState(false),[K,he]=react.useState([]),[Xe,H]=react.useState(false),[re,Q]=react.useState(""),Ee=react.useRef(null),Te=react.useRef(null),Ie=react.useRef(null),Be=react.useRef(null),ot=react.useRef(null),[ae,nt]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[fe,Ze]=react.useState({});react.useEffect(()=>{a?(nt({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||"#2E94FF",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)&&B(true)):(nt({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),he([]));},[a,e,x]),react.useEffect(()=>{let M=V=>{Ee.current&&!Ee.current.contains(V.target)&&v(false),Te.current&&!Te.current.contains(V.target)&&D(false),Ie.current&&!Ie.current.contains(V.target)&&k(false),Be.current&&!Be.current.contains(V.target)&&F(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);let xt=()=>{let M={};return ae.name.trim()||(M.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(M.endDate="La fecha de fin debe ser posterior a la de inicio"),Ze(M),Object.keys(M).length===0},St=async M=>{if(M.preventDefault(),!!xt())try{let V=l==="create"&&K.length>0?{...ae,pendingFiles:K}:ae;await s(V),he([]),t();}catch(V){console.error("Error submitting task:",V);}},Ce=(M,V)=>{nt(ce=>{let Ne={...ce,[M]:V};if(M==="status"){let W=V;W==="todo"?Ne.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Ne.progress=50):W==="completed"||W==="closed"?Ne.progress=100:(W==="in-review"||W==="review")&&(Ne.progress=75);}if(M==="progress"){let W=typeof V=="number"?V:parseInt(V,10);W===100&&ce.status!=="completed"?Ne.status="completed":W>0&&W<100&&ce.status==="todo"?Ne.status="in-progress":W===0&&ce.status!=="todo"&&(Ne.status="todo");}return Ne}),fe[M]&&Ze(ce=>{let Ne={...ce};return delete Ne[M],Ne});},gt=h.find(M=>M.id===ae.status)??Od[0],Tt=$d.find(M=>M.id===ae.priority)??$d[1],Qe=Zo.find(M=>M.value===ae.color)??Zo[0],O=c==="dark",ie={backgroundColor:O?"#1d1f27":f.bgSecondary,border:`1px solid ${O?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.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:O?"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:O?"#0a0a0a":f.bgPrimary,border:`1px solid ${O?"rgba(65,71,84,0.1)":f.border}`,boxShadow:O?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:M=>M.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:St,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:ae.name,onChange:M=>Ce("name",M.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),fe.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"}),fe.name]}),jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:M=>Ce("description",M.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),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:Ee,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ie,borderColor:gt.color,backgroundColor:`${gt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{style:{color:gt.color},children:gt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:gt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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:O?"#0a0a0a":f.bgPrimary,backdropFilter:O?"blur(16px)":void 0,border:`1px solid ${O?"#262626":f.border}`,boxShadow:O?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(M=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:V=>V.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:V=>V.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",M.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:M.color}}),M.title,ae.status===M.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},M.id))})})]}),jsxRuntime.jsxs("div",{ref:Te,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Tt.color}}),jsxRuntime.jsx("span",{children:Tt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&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:O?"#0a0a0a":f.bgPrimary,backdropFilter:O?"blur(16px)":void 0,border:`1px solid ${O?"#262626":f.border}`,boxShadow:O?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:$d.map(M=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:V=>V.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:V=>V.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",M.id),D(false);},children:[jsxRuntime.jsx("span",{children:M.icon}),M.label,ae.priority===M.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},M.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((M,V)=>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:M.color||f.accent,borderColor:f.bgSecondary},children:M.initials},V))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&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:O?"#0a0a0a":f.bgPrimary,backdropFilter:O?"blur(16px)":void 0,border:`1px solid ${O?"#262626":f.border}`,boxShadow:O?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(M=>{let V=ae.assignees?.some(ce=>ce.name===M.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:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=V?(ae.assignees||[]).filter(Ne=>Ne.name!==M.name):[...ae.assignees||[],{name:M.name,avatar:M.avatar,initials:M.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("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:f.accent},children:M.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:M.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},M.id)})})})]}),jsxRuntime.jsxs("div",{ref:Be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)F(false);else {if(Be.current){let M=Be.current.getBoundingClientRect(),V=window.innerHeight,ce=120,W=V-M.bottom<ce?M.top-ce-8:M.bottom+8;S({top:W,left:M.left});}F(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Qe.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>F(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:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:O?"#0a0a0a":f.bgPrimary,backdropFilter:O?"blur(16px)":void 0,border:`1px solid ${O?"#262626":f.border}`,boxShadow:O?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:M=>M.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Zo.slice(0,18).map(M=>{let V=ae.color===M.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),Ce("color",M.value),F(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:M.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:M.value,outline:V?`2px solid ${M.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},M.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(Fo,{selectedTags:ae.tags||[],availableTags:p,onChange:M=>Ce("tags",M),onCreateTag:d,theme:f,disabled:n}):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:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:O?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${O?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:ot,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(Y==="start")$(null);else {if(ot.current){let M=ot.current.getBoundingClientRect();Z({top:M.bottom+8,left:Math.max(16,M.left-40)});}$("start"),C(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ie,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(Y==="end")$(null);else {if(ot.current){let M=ot.current.getBoundingClientRect();Z({top:M.bottom+8,left:Math.max(16,M.left-40)});}$("end"),C(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ie,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&jsxRuntime.jsxs(Jt,{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:`${G.top}px`,left:`${G.left}px`,zIndex:99999,backgroundColor:O?"#0a0a0a":f.bgPrimary,border:`1px solid ${O?"#262626":f.border}`,boxShadow:O?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${O?"#262626":f.border}`},children:[(()=>{let M=new Date,V=new Date(M);V.setDate(M.getDate()+1);let ce=new Date(M);ce.setDate(M.getDate()+7);let Ne=new Date(M);return Ne.setDate(M.getDate()+14),[{label:"Hoy",date:M},{label:"Ma\xF1ana",date:V},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Ne}].map((ee,je)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ve=>ve.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ve=>ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{Y==="start"?(Ce("startDate",ee.date),(!ae.endDate||ee.date>ae.endDate)&&Ce("endDate",ee.date),$("end")):(Ce("endDate",ee.date),(!ae.startDate||ee.date<ae.startDate)&&Ce("startDate",ee.date),$(null));},children:ee.label},je))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.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:M=>M.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("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:()=>C(new Date(X.getFullYear(),X.getMonth()-1)),className:"p-1 rounded",onMouseEnter:M=>M.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:X.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>C(new Date(X.getFullYear(),X.getMonth()+1)),className:"p-1 rounded",onMouseEnter:M=>M.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((M,V)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:M},V))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let M=X.getFullYear(),V=X.getMonth(),ce=new Date(M,V,1).getDay(),Ne=new Date(M,V+1,0).getDate(),W=new Date,ee=[];for(let ve=ce-1;ve>=0;ve--)ee.push({day:new Date(M,V,-ve).getDate(),date:new Date(M,V-1,new Date(M,V,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=Ne;ve++)ee.push({day:ve,date:new Date(M,V,ve),isCurrentMonth:true});let je=42-ee.length;for(let ve=1;ve<=je;ve++)ee.push({day:ve,date:new Date(M,V+1,ve),isCurrentMonth:false});return ee.map((ve,He)=>{let Me=ve.date.toDateString()===W.toDateString(),We=ae.startDate?.toDateString()===ve.date.toDateString(),Nt=ae.endDate?.toDateString()===ve.date.toDateString(),ct=ae.startDate&&ae.endDate&&ve.date>=ae.startDate&&ve.date<=ae.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:ve.isCurrentMonth?We||Nt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:We?f.accent:Nt?"#7C3AED":ct?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Me&&!We&&!Nt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{Y==="start"?(Ce("startDate",ve.date),ae.endDate&&ve.date>ae.endDate&&Ce("endDate",ve.date),$("end")):(Ce("endDate",ve.date),ae.startDate&&ve.date<ae.startDate&&Ce("startDate",ve.date),$(null));},children:ve.day},He)})})()})]})]})]})})]}),fe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:fe.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:f.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ae.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:O?"#33343c":"#E5E7EB"},onClick:M=>{if(n)return;let V=M.currentTarget.getBoundingClientRect(),ce=Math.round((M.clientX-V.left)/V.width*100/5)*5;Ce("progress",Math.max(0,Math.min(100,ce)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ae.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${O?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!$e),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${$e?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$e&&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:f.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:f.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ae.effortMinutes?o2(ae.effortMinutes):"",onChange:M=>{let V=n2(M.target.value);Ce("effortMinutes",V);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.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:f.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:f.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ae.parentId||"",onChange:M=>Ce("parentId",M.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(M=>M.id!==a?.id).map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.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:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ae.location||"",onChange:M=>Ce("location",M.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),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:f.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ae.equipment||"",onChange:M=>Ce("equipment",M.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.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:f.textTertiary},children:["Adjuntos ",l==="create"?K.length>0&&`(${K.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(io,{cardId:"pending",attachments:K.map((M,V)=>({id:`pending-${V}`,cardId:"pending",name:M.name,size:M.size,type:M.type,url:URL.createObjectURL(M),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:M=>he(V=>[...V,...M]),onDelete:M=>{let V=parseInt(M.replace("pending-",""),10);he(ce=>ce.filter((Ne,W)=>W!==V));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(io,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?M=>g(a.id,M):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&K.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[K.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:M=>M.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:M=>Ce("isMilestone",M.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.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:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(M=>{let V=r.find(ce=>ce.id===M);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[V?.name||M.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=(ae.dependencies||[]).filter(Ne=>Ne!==M);Ce("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},M)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(!Xe),Q("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{H(false),Q("");}}),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:O?"#0a0a0a":f.bgPrimary,backdropFilter:O?"blur(16px)":void 0,border:`1px solid ${O?"#262626":f.border}`,boxShadow:O?"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 ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:re,onChange:M=>Q(M.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(M=>M.id!==a?.id).filter(M=>re===""||M.name.toLowerCase().includes(re.toLowerCase())).map(M=>{let V=ae.dependencies?.includes(M.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ce=ae.dependencies||[],Ne;V?Ne=ce.filter(W=>W!==M.id):Ne=[...ce,M.id],Ce("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:V?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{V||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=V?`${f.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:V?f.accent:"transparent",borderColor:V?f.accent:f.borderLight},children:V&&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:f.textPrimary},children:M.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:M.id.slice(0,8)})]})]},M.id)}),r.filter(M=>M.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.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 ${O?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:O?"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:f.textTertiary},onMouseEnter:M=>M.currentTarget.style.color=f.textPrimary,onMouseLeave:M=>M.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:M=>!n&&(M.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:M=>!n&&(M.currentTarget.style.filter="brightness(1)"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Lm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -406,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
406
406
 
407
407
  Always try to match task names case-insensitively and handle partial matches.
408
408
  If you can't find a task by name, search through the provided task list.
409
- If ambiguous, ask for clarification in the message field.`;function Lm(e){return `CURRENT TASKS:
410
- ${Im(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
409
+ If ambiguous, ask for clarification in the message field.`;function Im(e){return `CURRENT TASKS:
410
+ ${Bm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
411
411
  `)}
412
412
 
413
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Im(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function wo(e,t){let a=Im(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Od(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}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 m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=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(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=p[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}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),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Hd(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 Bm(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 Rm(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 i=r[1].trim(),p=r[2].trim(),d=wo(t,i),m=Od(p);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:y},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),d=wo(t,i),m=$d(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.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 i=s[1].trim(),p=s[2].trim(),d=wo(t,i),m=Hd(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=wo(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),p=l[2].trim(),d=wo(t,i),m=wo(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),p=wo(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Om(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 s2(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 i2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $i(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>$i(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 n=p=>{if(p)return typeof p=="string"?new Date(p):p},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:s2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function $m(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:i2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$i(r,e,t))}var zd={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"}},Hi={en:zd,es:Ud};function Wd(e){return Hi[e]||Hi.en}function zi(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 Vd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function zm(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 Um({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=zm(e),i=Vd[0],p=Vd.find(g=>g.value===c)??i,d=p.icon,m=g=>{switch(zm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("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(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("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:Vd.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("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===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}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 Vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=Gd.find(p=>p.value===e)??Gd[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("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:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 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),n(false);},className:u("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:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function ws(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function jd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],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-blue-500"}function _d({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{p.current&&!p.current.contains(h.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ws(x.name),color:x.color||jd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("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((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&jd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ws(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("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:x=>{x.stopPropagation(),l(!n);},className:u("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:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("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((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&jd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ws(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",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:d,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.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((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ws(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ws(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Ym({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,p]=react.useState(false),[d,m]=react.useState(o),[g,y]=react.useState(()=>{let k=o==="start"?e:t;if(k){let w=k instanceof Date?k:new Date(k);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let k=w=>{x.current&&!x.current.contains(w.target)&&p(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",v=react.useCallback(()=>{let k=g.getFullYear(),w=g.getMonth(),F=new Date(k,w,1),S=new Date(k,w+1,0).getDate(),X=F.getDay(),O=[],A=new Date(k,w,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,w-1,A-Z),isCurrentMonth:false});for(let Z=1;Z<=S;Z++)O.push({date:new Date(k,w,Z),isCurrentMonth:true});let q=42-O.length;for(let Z=1;Z<=q;Z++)O.push({date:new Date(k,w+1,Z),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),p(false);else if(d==="start"){let w=f&&k>f?k:f;a(k,w||void 0),m("end");}else {let w=h&&k<h?k:h;a(w||void 0,k),p(false);}},N=()=>{let k=new Date,w=new Date(k);w.setDate(k.getDate()+1);let F=new Date(k);F.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let S=new Date(k);S.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:F,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),p(!i);let w=o==="start"?h:f;w&&y(new Date(w.getFullYear(),w.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,w)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(k.date),children:[jsxRuntime.jsx("span",{children:k.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},w)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),p(false);},className:u("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:n==="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:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="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:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:v().map((k,w)=>{let F=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),S=f?.toDateString()===k.date.toDateString(),X=I||S,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),F&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",S&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},w)})})]})]})]})]})}function Vi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Ym,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function zn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=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:o}}function Gi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),v=Math.round(d+g*b);n(v),x===o&&(c(false),n(m));},y*x);p.current.push(h);}return i.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Xm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Qm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),{isFlashing:d,triggerFlash:m}=zn(),{displayValue:g,isAnimating:y}=Gi(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),w=Math.max(0,Math.min(100,k));w!==e&&(t(w),s&&m());},h=react.useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=react.useCallback(()=>{l(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&m());}},[c,t,e,s,m]),b=react.useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&l(false);},[f]),v=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:u("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:u("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${v}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:p,value:c,onChange:C=>i(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("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-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function tg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("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 og({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=zn(),{displayValue:h,isAnimating:f}=Gi(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}p(false);},v=C=>{C.key==="Enter"?b():C.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:C=>m(C.target.value),onBlur:b,onKeyDown:v,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:C=>{C.stopPropagation(),p(true);},className:u("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",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function ng({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("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:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),l(false);},className:u("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===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function ig({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:p}=Xm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?p():i(!e):t(!e));},m=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("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 cg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=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)),o>0&&jsxRuntime.jsxs("span",{className:u("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:["+",o]})]})}function j2(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 _2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Tr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0}){let[p,d]=react.useState(false),[m,g]=react.useState(""),y=react.useRef(null),{isFlashing:x,triggerFlash:h}=zn(),f=c==="financial"&&i>0,b=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:j2(e,r);react.useEffect(()=>{p&&y.current&&(y.current.focus(),y.current.select());},[p]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,p]);let v=()=>{let T=_2(m);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?v():T.key==="Escape"&&d(false);};if(l)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:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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 N=f?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(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):p?jsxRuntime.jsx("input",{ref:y,type:"text",value:m,onChange:T=>g(T.target.value),onBlur:v,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("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",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:b})]})}function gg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=o==="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:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),l()]})}function bg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",p=l==="financial"&&c>0,d=Z=>p?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[m,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),v=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(v/60*10)/10,k=Math.round(C/60*10)/10,w=C>0?v/C*100:0,F=w>100?Math.round((v-C)/60*10)/10:0,I=w>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let Z=Ee=>{b.current&&!b.current.contains(Ee.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let S=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Ee=>!Ee),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Ee)=>{h==="log"&&r&&Z?r(e,Z,Ee):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},$=r||o||s||n,A=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),q=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&v===0&&N===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&$&&jsxRuntime.jsx("button",{onClick:S,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:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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(Z=>jsxRuntime.jsxs("button",{onClick:Ee=>{Ee.stopPropagation(),X(Z.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:Ee=>{Ee.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ee=>{Ee.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(ro,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(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 Z=v===0,B=(C>0?v/C: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:Z?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),F>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(F)," ",i?"Excedido":"Over"]})]})})(),C>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(w,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),$&&jsxRuntime.jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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(Z=>jsxRuntime.jsxs("button",{onClick:Ee=>{Ee.stopPropagation(),X(Z.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:Ee=>{Ee.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ee=>{Ee.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(ro,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function Z2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function e1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function hg({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",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function yg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=Z2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(hg,{assignee:g,size:24,isDark:t},g.name+y))}),m>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("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:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,c=!!n&&l>0,i=c?e1(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(hg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var t1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function vg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("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,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",t1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function b1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function h1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],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 Dg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=react.useRef(null),b=r==="es"?Cg.es:Cg.en;if(react.useEffect(()=>{let k=F=>{f.current&&!f.current.contains(F.target)&&t();},w=F=>{F.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",w);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),l&&(k.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),p.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(w=>({id:`assign-${w.id}`,label:w.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:w.name.charAt(0).toUpperCase()}),onClick:()=>{let F=e.task.assignees||[],S=F.some(X=>X.name===w.name)?F.filter(X=>X.name!==w.name):[...F,{name:w.name,initials:b1(w.name),color:w.color||h1(w.name),avatar:w.avatarUrl}];l({...e.task,assignees:S}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?v():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsxRuntime.jsx(y1,{item:k,isDark:a},k.id):jsxRuntime.jsxs("button",{onClick:k.onClick,className:u("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",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function y1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Cg={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 Ig={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"})},B1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Rg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[p,d]=react.useState(null),[m,g]=react.useState(null),y=react.useRef(null),x=l==="es"?Bg.es:Bg.en;react.useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let w=y.current.parentElement;if(w){let X=w.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let F=y.current.getBoundingClientRect(),S=window.innerHeight-F.top-20;d(Math.max(300,S));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),react.useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let w=I=>{y.current&&!y.current.contains(I.target)&&t();},F=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",w),document.addEventListener("keydown",F),y._cleanup=()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",F);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=react.useMemo(()=>{let k=new Set([...B1]);return a.forEach(w=>{w.type&&w.type!=="assignees"&&k.add(w.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let w=x.columns[k];if(w)return w;let F=a.find(I=>I.type===k);return F?.label?F.label:k},b=k=>{if(k==="name")return;let w=a.map(F=>F.id===k?{...F,visible:!F.visible}:F);o(w);},v=(k,w)=>{let F=a.find(S=>S.type===k&&(!w||S.customFieldId===w));if(F){b(F.id);return}let I={id:w||k,type:k,label:w?r.find(S=>S.id===w)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:w};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:y,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"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 ${n?"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:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:k=>i(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"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:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"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:k=>k.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(k=>{let w=a.find(S=>S.type===k&&!S.customFieldId),F=w?.visible??false,I=k==="name";return jsxRuntime.jsxs("button",{onClick:()=>{I||(w?b(w.id):v(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:S=>{I||(S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:S=>{S.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:F?T:"transparent",border:F?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${T}40`:"none"},children:F&&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:F?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ig[k]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:F?500:400,color:F?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:N.map(k=>{let F=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.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:F?T:"transparent",border:F?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${T}40`:"none"},children:F&&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:F?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ig[k.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:F?500:400,color:F?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Bg={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",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 G1=[{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 Hg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,p]=react.useState([""]),d=o==="es"?$g.es:$g.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let m=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{p([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,p(b);},x=h=>{i.length>1&&p(i.filter((f,b)=>b!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("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:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:G1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/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")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("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"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("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:u("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:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var $g={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 Wg={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 Vg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),p=s==="es"?Wg.es:Wg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{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-blue-500"},{value:"todo",label:p.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Gg(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 Ds(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function jg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxRuntime.jsxs("div",{className:u("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:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("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:n?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,p=e.totalExecuted??0,d=c-i,m=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(i/c*100),120):0,y=i>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ds(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ds(i)})]}),p>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Ds(p)})]}),c>0&&jsxRuntime.jsx("div",{className:u("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(g,100)}%`,backgroundColor:x}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=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:[d>=0?`+${Ds(d)} ${n?"Disp.":"Avail."}`:`${Ds(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,p=i>0?Math.min(Math.round(c/i*100),100):0,g=(i>0?c/i:0)>1.1?"#F87171":p>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Gg(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Gg(i)})]}),i>0&&jsxRuntime.jsx("div",{className:u("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:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("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:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.jsx("div",{className:u("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:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsxRuntime.jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsxRuntime.jsx("div",{className:u("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:u("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:u("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:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,p=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!i&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{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:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("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}-${i}`)})})]})]})}var sw=[{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 Qg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Qg(r.subtasks,t+1));return a}function iw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function jn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=jn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Gn(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 lw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(n(String(e||"")),o(false));},className:u("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-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),n(String(e||"")),o(true);},className:u("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 Xg(e){if(e.length===0)return 0;let t=0,a=0,r=0,o=0;for(let c of e){let i=c.weight||0;i>0&&(t+=(c.progress||0)*i,a+=i,r+=1),o+=c.progress||0;}let s=r/e.length,l=a>=99&&s>=.95?t/a:o/e.length;return Math.round(l*10)/10}function dc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?dc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0});return t}function Zg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:v=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:w="hours",hourlyRate:F=0,rateMap:I,aggregateParentHours:S=false,showProjectTotals:X=false}=t,O=zi(d,m),$=p==="dark",A=M=>{if(!I||!M.assignees||M.assignees.length===0)return F;let se=0,xe=0;for(let ke of M.assignees){let st=ke.id?I[ke.id]:void 0;if(st==null||st<=0)continue;let ce=typeof ke.estimatedMinutes=="number"?ke.estimatedMinutes:0;ce>0&&(se+=st*ce,xe+=ce);}if(xe>0)return se/xe;let Pe=M.assignees.map(ke=>ke.id?I[ke.id]:void 0).filter(ke=>ke!=null&&ke>0);return Pe.length===0?F:Pe.reduce((ke,st)=>ke+st,0)/Pe.length},q=M=>{let se=0,xe=0,Pe=0,ke=st=>{for(let ce of st)if(ce.subtasks&&ce.subtasks.length>0){let Ve={s:se,a:xe,q:Pe};if(ke(ce.subtasks),se-Ve.s+(xe-Ve.a)+(Pe-Ve.q)===0){let wt=A(ce);se+=(ce.timeLoggedMinutes??0)/60*wt,xe+=(ce.effortMinutes??0)/60*wt,Pe+=(ce.soldEffortMinutes??0)/60*wt;}}else {let Ve=A(ce);se+=(ce.timeLoggedMinutes??0)/60*Ve,xe+=(ce.effortMinutes??0)/60*Ve,Pe+=(ce.soldEffortMinutes??0)/60*Ve;}};return M.subtasks&&ke(M.subtasks),{dollarSpent:se,dollarAllocated:xe,dollarQuoted:Pe}},Z=react.useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Ee=react.useMemo(()=>{function M(se){let xe=0,Pe=0,ke=0,st=0,ce=0,Ve=0;for(let it of se)if(it.subtasks&&it.subtasks.length>0){let wt=M(it.subtasks);if(wt.spent+wt.allocated+wt.quoted>0)xe+=wt.spent,Pe+=wt.allocated,ke+=wt.quoted,st+=wt.dollarSpent,ce+=wt.dollarAllocated,Ve+=wt.dollarQuoted;else {let St=it.timeLoggedMinutes??0,zt=it.effortMinutes??0,oa=it.soldEffortMinutes??0;xe+=St,Pe+=zt,ke+=oa;let Sa=A(it);st+=St/60*Sa,ce+=zt/60*Sa,Ve+=oa/60*Sa;}}else {let wt=it.timeLoggedMinutes??0,Ht=it.effortMinutes??0,St=it.soldEffortMinutes??0;xe+=wt,Pe+=Ht,ke+=St;let zt=A(it);st+=wt/60*zt,ce+=Ht/60*zt,Ve+=St/60*zt;}return {spent:xe,allocated:Pe,quoted:ke,dollarSpent:st,dollarAllocated:ce,dollarQuoted:Ve}}return M(e)},[e]),B=react.useMemo(()=>{let M=new Map;function se(xe){let Pe=0;for(let ke of xe)if(ke.subtasks&&ke.subtasks.length>0){let st=se(ke.subtasks);M.set(ke.id,st),Pe+=st;}else Pe+=ke.weight||0;return Pe}return se(e),M},[e]),_=react.useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Ee.spent,totalHoursAllocatedMinutes:Ee.allocated}},[k,Ee]),[he,Ye]=react.useState(true),[z,re]=react.useState(null),[J,Le]=react.useState("position"),[we,Oe]=react.useState("asc"),[Be,lt]=react.useState(""),[ee,ct]=react.useState(()=>Z().statusFilter),[pe,et]=react.useState(()=>Z().hideCompleted),[nt,Ut]=react.useState(x||sw),[Ce,mt]=react.useState(false),[Dt,Xe]=react.useState(false),[H,ne]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[D,K]=react.useState(null),[ue,Te]=react.useState(false),[V,te]=react.useState(null),[$e,Ne]=react.useState(null),[He,Fe]=react.useState(null),Ge=react.useRef(0),ht=react.useRef(false),dt=!!(a.onTaskMove||a.onTaskReparent),gt=react.useCallback((M,se)=>{dt&&(se.preventDefault(),Ge.current=se.clientY,K(M),ht.current=false,Te(false),Fe({x:se.clientX,y:se.clientY}));},[dt]),ot=react.useCallback(M=>{if(!D||(Math.abs(M.clientY-Ge.current)>5&&!ht.current&&(ht.current=true,Te(true)),Fe({x:M.clientX,y:M.clientY}),!ht.current))return;let xe=document.querySelectorAll("[data-listview-row]"),Pe=null,ke=null;xe.forEach(st=>{let ce=st.getBoundingClientRect(),Ve=st.getAttribute("data-listview-row");if(Ve&&Ve!==D&&M.clientY>=ce.top&&M.clientY<=ce.bottom){Pe=Ve;let it=M.clientY-ce.top,wt=ce.height;ke=it<wt*.25?"above":it>wt*.75?"below":"child";}}),te(Pe),Ne(ke);},[D]),jt=react.useCallback(()=>{if(ht.current&&D&&V&&$e){if($e==="child"&&a.onTaskReparent)a.onTaskReparent(D,V);else if($e==="above"||$e==="below"){let M=(Pe,ke,st=null)=>{for(let ce of Pe){if(ce.id===ke)return st;if(ce.subtasks){let Ve=M(ce.subtasks,ke,ce.id);if(Ve!==void 0)return Ve}}},se=M(e,D,null),xe=M(e,V,null);if(a.onTaskReparent){let Pe=(wt,Ht)=>{if(Ht===null)return wt;for(let St of wt){if(St.id===Ht)return St.subtasks||[];if(St.subtasks){let zt=Pe(St.subtasks,Ht);if(zt.length>0||St.subtasks.some(oa=>oa.id===Ht))return zt}}return []},ke=Pe(e,xe??null),st=ke.findIndex(wt=>wt.id===V),ce=se===xe,Ve=ce?ke.findIndex(wt=>wt.id===D):-1,it=$e==="below"?st+1:st;ce&&Ve!==-1&&Ve<st&&(it-=1),a.onTaskReparent(D,xe??null,Math.max(0,it));}}}K(null),te(null),Ne(null),Fe(null),ht.current=false,Te(false);},[D,V,$e,e,a]);react.useEffect(()=>{if(D)return document.addEventListener("mousemove",ot),document.addEventListener("mouseup",jt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",jt),document.body.style.cursor="",document.body.style.userSelect="";}},[D,ot,jt]);let[Et,Nt]=react.useState("all"),[Tt,yt]=react.useState(false),Ot=react.useRef(null),We=react.useRef(null),Re=react.useMemo(()=>{let M=0;function se(xe,Pe){for(let ke of xe)Pe>M&&(M=Pe),ke.subtasks?.length&&se(ke.subtasks,Pe+1);}return se(e,1),M},[e]);react.useEffect(()=>{if(!Tt)return;let M=se=>{Ot.current?.contains(se.target)||We.current?.contains(se.target)||yt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[Tt]),react.useEffect(()=>{if(Et==="all"){let xe=function(Pe){for(let ke of Pe)ke.subtasks?.length&&(ke.isExpanded===false&&a.onTaskToggleExpand?.(ke.id),xe(ke.subtasks));};xe(e);}else {let xe=function(Pe,ke){for(let st of Pe)if(st.subtasks?.length){let ce=ke<Et,Ve=st.isExpanded!==false;ce!==Ve&&a.onTaskToggleExpand?.(st.id),xe(st.subtasks,ke+1);}};xe(e,1);}},[Et]);let[at,ie]=react.useState(null),[me,L]=react.useState(0),[j,Y]=react.useState(0),ge=react.useRef(null),[De,Je]=react.useState(null),[_e,ze]=react.useState(null);react.useEffect(()=>{x&&Ut(M=>{if(M.length===x.length){let se=true;for(let xe=0;xe<M.length;xe++){let Pe=M[xe],ke=x[xe];if(!Pe||!ke||Pe.id!==ke.id||Pe.visible!==ke.visible||Pe.width!==ke.width||Pe.label!==ke.label){se=false;break}}if(se)return M}return x});},[x]),react.useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:ee,hideCompleted:pe}));}catch(M){console.error("Error persisting filter state:",M);}},[N,ee,pe]);let vt=react.useMemo(()=>{let M=new Set;function se(xe){for(let Pe of xe)Pe.subtasks?.length&&(Pe.isExpanded!==false&&M.add(Pe.id),se(Pe.subtasks));}return se(e),M},[e]),ut=react.useMemo(()=>nt.filter(M=>M.visible),[nt]),Wt=react.useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),ha=react.useCallback(M=>{J===M?Oe(se=>se==="asc"?"desc":"asc"):(Le(M),Oe("asc")),a.onSortChange?.({column:M,direction:we==="asc"?"desc":"asc"});},[J,we,a]),ta=react.useCallback(M=>{Ut(M),a.onColumnsChange?.(M);},[a]),U=react.useCallback(M=>{let se=nt.map(xe=>xe.id===M?{...xe,visible:false}:xe);ta(se);},[nt,ta]),Ze=react.useCallback((M,se)=>{Le(M),Oe(se);},[]),ye=react.useCallback((M,se,xe)=>{b&&(M.preventDefault(),ne({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:xe}));},[b]),E=react.useCallback(()=>{ne(M=>({...M,isOpen:false}));},[]),fe=react.useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let xe=nt.find(Pe=>Pe.id===se);xe&&(ie(se),L(M.clientX),Y(xe.width));},[nt,f]);react.useEffect(()=>{if(!at)return;let M=nt,se=Pe=>{let ke=Pe.clientX-me,st=Math.max(50,j+ke);M=M.map(ce=>ce.id===at?{...ce,width:st}:ce),Ut(M);},xe=()=>{a.onColumnsChange?.(M),ie(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",xe);}},[at,me,j,a]);let je=react.useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}Je(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),tt=react.useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Je(null),ze(null);},[]),ra=react.useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",ze(se));},[]),Vt=react.useCallback(()=>{ze(null);},[]),Ua=react.useCallback((M,se)=>{if(M.preventDefault(),!De||De===se||se==="name")return;let xe=[...nt],Pe=xe.findIndex(ce=>ce.id===De),ke=xe.findIndex(ce=>ce.id===se);if(Pe===-1||ke===-1)return;let st=xe.splice(Pe,1);st[0]&&(xe.splice(ke,0,st[0]),ta(xe),Je(null),ze(null));},[De,nt,ta]),lr=react.useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}Xe(false);},[a]),fa=react.useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),ya=react.useMemo(()=>{let M=Qg(e);if(Be.trim()){let se=Be.toLowerCase();M=M.filter(xe=>xe.name.toLowerCase().includes(se));}return ee!=="all"&&(M=M.filter(se=>fa(se)===ee)),pe&&(M=M.filter(se=>fa(se)!=="completed")),M.sort((se,xe)=>{let Pe,ke;switch(J){case "name":Pe=se.name.toLowerCase(),ke=xe.name.toLowerCase();break;case "startDate":Pe=se.startDate?.getTime()||0,ke=xe.startDate?.getTime()||0;break;case "endDate":Pe=se.endDate?.getTime()||0,ke=xe.endDate?.getTime()||0;break;case "progress":Pe=se.progress||0,ke=xe.progress||0;break;case "status":Pe=se.status||"todo",ke=xe.status||"todo";break;case "priority":let st={urgent:0,high:1,medium:2,low:3,none:4};Pe=st[se.priority]??4,ke=st[xe.priority]??4;break;case "position":return 0;default:return 0}return Pe<ke?we==="asc"?-1:1:Pe>ke?we==="asc"?1:-1:0}),M},[e,Be,ee,pe,J,we,fa]),Hr=react.useCallback((M,se)=>{let xe=st=>{a.onTaskUpdate?.({...M,...st});},Pe=st=>st?M.customFields?.find(Ve=>Ve.fieldId===st)?.value:void 0,ke=(st,ce)=>{if(!st)return;let it=[...M.customFields||[]],wt=it.findIndex(Ht=>Ht.fieldId===st);wt>=0?it[wt]={fieldId:st,value:ce}:it.push({fieldId:st,value:ce}),xe({customFields:it});};switch(se.type){case "name":return null;case "status":return jsxRuntime.jsx(Um,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:ce=>{xe({status:ce,progress:ce==="completed"?100:ce==="in-progress"?50:0});},isDark:$,locale:d,translations:O.status});case "priority":return jsxRuntime.jsx(Vm,{value:M.priority,onChange:ce=>xe({priority:ce}),isDark:$,locale:d});case "assignees":{let ce=M.hasChildren,Ve=M.assignees||[];if(ce&&M.subtasks?.length){let it=new Map,wt=Ht=>{(Ht||[]).forEach(St=>{(St.assignees||[]).forEach(zt=>{it.has(zt.name)||it.set(zt.name,zt);}),St.subtasks?.length&&wt(St.subtasks);});};wt(M.subtasks),Ve=Array.from(it.values());}else ce&&(Ve=[]);return jsxRuntime.jsx(_d,{value:Ve,availableUsers:l,onChange:it=>xe({assignees:it}),isDark:$,locale:d,disabled:ce})}case "startDate":return jsxRuntime.jsx(Vi,{value:M.startDate,onChange:ce=>xe({startDate:ce}),isDark:$,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsxRuntime.jsx(Vi,{value:M.endDate,onChange:ce=>xe({endDate:ce}),isDark:$,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let ce=!!(M.subtasks&&M.subtasks.length>0),Ve=ce?Xg(dc(M.subtasks||[])):M.progress||0;return jsxRuntime.jsx(Qm,{value:Ve,onChange:ce?void 0:it=>{let wt=it===100?"completed":it>0?"in-progress":"todo";xe({progress:it,status:wt});},isDark:$,disabled:ce})}case "tags":return jsxRuntime.jsx(cg,{value:M.tags||[],isDark:$});case "text":return jsxRuntime.jsx(tg,{value:Pe(se.customFieldId)||"",onChange:ce=>ke(se.customFieldId,ce),isDark:$});case "number":return jsxRuntime.jsx(og,{value:Pe(se.customFieldId)||0,onChange:ce=>ke(se.customFieldId,ce),isDark:$});case "date":let st=Pe(se.customFieldId);return jsxRuntime.jsx(Vi,{value:st?new Date(st):void 0,onChange:ce=>ke(se.customFieldId,ce),isDark:$,locale:d});case "dropdown":return jsxRuntime.jsx(ng,{value:Pe(se.customFieldId)||"",options:se.options||[],onChange:ce=>ke(se.customFieldId,ce),isDark:$});case "checkbox":return jsxRuntime.jsx(ig,{value:Pe(se.customFieldId)||false,onChange:ce=>ke(se.customFieldId,ce),isDark:$});case "estimatedTime":{let ce=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Tr,{value:M.estimatedTime,onChange:Ve=>xe({estimatedTime:Ve}),isDark:$,locale:d,disabled:ce,lens:w,hourlyRate:A(M)})}case "quotedTime":{let ce=M.status==="completed"||M.progress===100,Ve=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(Tr,{value:M.quotedTime,onChange:it=>xe({quotedTime:it}),isDark:$,locale:d,disabled:ce,isBlurred:Ve,lens:w,hourlyRate:A(M)})}case "elapsedTime":{let ce=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Tr,{value:M.elapsedTime,onChange:Ve=>xe({elapsedTime:Ve}),isDark:$,locale:d,disabled:ce,lens:w,hourlyRate:A(M)})}case "effortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{allocated:Ht}=jn(M);if(w==="financial"){let St=q(M),zt=Math.round(St.dollarAllocated),oa=Math.round(St.dollarQuoted),Sa=oa-zt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[zt>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",zt.toLocaleString("es-CO")]}):null,Sa!==0&&zt>0&&oa>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Sa>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Sa>0?"+":"",Math.abs(Sa)>=1e3?`$${(Sa/1e3).toFixed(1)}K`:`$${Sa}`]})]})}return jsxRuntime.jsx(Tr,{value:Ht>0?Ht:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:F})}let ce=M.status==="completed"||M.progress===100,Ve=M.effortMinutes||0,it=M.soldEffortMinutes||0,wt=A(M);if(w==="financial"&&wt&&Ve>0&&it>0){let Ht=Math.round(Ve/60*wt),zt=Math.round(it/60*wt)-Ht;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Tr,{value:Ve,onChange:oa=>xe({effortMinutes:oa}),isDark:$,locale:d,disabled:ce,lens:w,hourlyRate:A(M)}),zt!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",zt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[zt>0?"+":"",Math.abs(zt)>=1e3?`$${(zt/1e3).toFixed(1)}K`:`$${zt}`]})]})}return jsxRuntime.jsx(Tr,{value:Ve,onChange:Ht=>xe({effortMinutes:Ht}),isDark:$,locale:d,disabled:ce,lens:w,hourlyRate:A(M)})}case "timeLoggedMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{spent:Ve}=jn(M);return jsxRuntime.jsx(Tr,{value:Ve>0?Ve:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)})}let ce=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Tr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?Ve=>{a.onLogTime?.(M,Ve);}:void 0,isDark:$,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ce,lens:w,hourlyRate:A(M)})}case "soldEffortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{quoted:it}=jn(M),wt=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Tr,{value:it>0?it:void 0,isDark:$,locale:d,disabled:true,isBlurred:wt,lens:w,hourlyRate:A(M)})}let ce=M.status==="completed"||M.progress===100,Ve=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Tr,{value:M.soldEffortMinutes,onChange:it=>xe({soldEffortMinutes:it}),isDark:$,locale:d,disabled:ce,isBlurred:Ve,lens:w,hourlyRate:A(M)})}case "scheduleVariance":{let ce=M.effortMinutes||0,Ve=M.soldEffortMinutes||0,it=M.timeLoggedMinutes||0,wt=ce>0||Ve>0||it>0;return jsxRuntime.jsx(gg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:$,locale:d,hasTimeAllocated:wt})}case "hoursBar":{if(S&&M.hasChildren){let{spent:ce,allocated:Ve,quoted:it}=jn(M),wt=ce>Ve&&Ve>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",wt?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:Gn(ce)}),Ve>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:$?"text-white/60":"text-gray-600",children:Gn(Ve)})]}),it>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:Gn(it)})]})]})}return jsxRuntime.jsx(bg,{task:M,isDark:$,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:A(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsxRuntime.jsx(yg,{task:M,isDark:$,locale:d}):jsxRuntime.jsx(_d,{value:M.assignees||[],availableUsers:l,onChange:Ve=>{a.onTaskUpdate?.({...M,assignees:Ve});},isDark:$,locale:d});case "blockers":return jsxRuntime.jsx(vg,{blockers:M.blockers,isDark:$,locale:d});case "weight":{let ce=B.get(M.id);if(ce!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",ce>0?$?"text-white/50":"text-gray-400":$?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ce>0?`${Number(ce.toFixed(2))}%`:"\u2014"});let Ve=M.weight||0;return jsxRuntime.jsx(lw,{value:Ve,onChange:it=>xe({weight:it}),isDark:$})}default:return jsxRuntime.jsx("span",{className:u("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,d,l,O,S,B]),Fr=react.useCallback(M=>{let xe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof xe=="string"?xe:String(xe||M.type)},[O,d]),Go=react.useMemo(()=>{let xe=ut.reduce((ke,st)=>ke+st.width,0)+(h?48:0),Pe={};for(let ke of ut)Pe[ke.id]=`${ke.width/xe*100}%`;return Pe},[ut,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,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:u("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:ge,className:u($?"bg-[#0D0D0D]":"bg-white",at&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",$?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:[ya.length," ",O.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",$?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Be,onChange:M=>lt(M.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",$?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),y&&Re>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:Ot,onClick:()=>yt(!Tt),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",$?Tt?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Tt?"bg-blue-50 border-blue-300 text-blue-600":"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"}),Et==="all"?d==="es"?"Todos":"All":`L${Et}`]}),Tt&&jsxRuntime.jsx("div",{ref:We,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",$?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Re,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{Nt(M.value),yt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",$?Et===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Et===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:M.label}),Et===M.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsxRuntime.jsx(Vg,{value:ee,hideCompleted:pe,onChange:ct,onHideCompletedChange:et,isDark:$,locale:d}),_?.enabled&&_.data&&!he&&jsxRuntime.jsx("button",{onClick:()=>Ye(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"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:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,v&&C&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 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:O.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",$?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[dt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),ut.map(M=>{let se=M.id!=="name",xe=_e===M.id&&De!==M.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",se&&"cursor-grab",M.type!=="name"&&"justify-center",De===M.id&&"opacity-50",xe&&($?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Go[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?Pe=>je(Pe,M.id):void 0,onDragEnd:se?tt:void 0,onDragOver:se?Pe=>ra(Pe,M.id):void 0,onDragLeave:se?Vt:void 0,onDrop:se?Pe=>Ua(Pe,M.id):void 0,onContextMenu:Pe=>ye(Pe,void 0,M.id),children:[se&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ha(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Fr(M),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",J===M.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Fr(M)}),f&&M.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",at===M.id&&"bg-[#007BFF]"),onMouseDown:Pe=>fe(Pe,M.id)})]},M.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),mt(se=>!se);},className:u("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ce&&($?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Rg,{isOpen:Ce,onClose:()=>mt(false),columns:nt,customFields:c,onColumnsChange:ta,onCreateCustomField:()=>{mt(false),Xe(true);},isDark:$,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:ya.map((M,se)=>{let xe=vt.has(M.id),Pe=Math.min(se*.01,.2),ke=M.hasChildren&&M.level===0,st=M.subtasks?.length||0;if(ke){let{spent:St,allocated:zt,quoted:oa}=jn(M),Sa=iw(M);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Pe},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(M),children:[dt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),ut.map(Ea=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Ea.type!=="name"&&"justify-center"),style:{width:Go[Ea.id],minWidth:Ea.minWidth},children:Ea.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:ar=>{ar.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:ar=>{ar.stopPropagation(),Wt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:xe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:$?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",$?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",$?"text-white/30":"text-gray-500"),children:["(",st," ",d==="es"?st===1?"Tarea":"Tareas":st===1?"Item":"Items",")"]}),Sa!==null&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",Sa>=1?"text-[#32D74B] bg-[#32D74B]/10":Sa>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",Sa.toFixed(2)]})]})]}):Ea.type==="timeLoggedMinutes"?w==="financial"?(()=>{let ar=q(M),Ft=Math.round(ar.dollarSpent);return Ft>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Tr,{value:St>0?St:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)}):Ea.type==="soldEffortMinutes"?w==="financial"?(()=>{let ar=q(M),Ft=Math.round(ar.dollarQuoted);return Ft>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Tr,{value:oa>0?oa:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)}):Ea.type==="effortMinutes"?w==="financial"?(()=>{let ar=q(M),Ft=Math.round(ar.dollarAllocated),eo=Math.round(ar.dollarQuoted),mo=eo-Ft;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Ft>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("es-CO")]}):null,mo!==0&&Ft>0&&eo>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",mo>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[mo>0?"+":"",Math.abs(mo)>=1e3?`$${(mo/1e3).toFixed(1)}K`:`$${mo}`]})]})})():jsxRuntime.jsx(Tr,{value:zt>0?zt:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)}):Hr(M,Ea)},Ea.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let ce=D===M.id,Ve=V===M.id,it=Ve&&$e==="above",wt=Ve&&$e==="below",Ht=Ve&&$e==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":M.id,"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Pe},className:u("flex items-center border-b transition-colors relative group",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:ce?.4:1,backgroundColor:Ht?$?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Ht?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:St=>ye(St,M),children:[it&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),wt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),dt&&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:St=>gt(M.id,St),style:{color:$?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),ut.map(St=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",St.type!=="name"&&"justify-center"),style:{width:Go[St.id],minWidth:St.minWidth},children:St.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsxRuntime.jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:zt=>{zt.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",$?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",$?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate",M.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",M.progress===100?$?"line-through text-white/50":"line-through text-gray-400":M.hasChildren?$?"text-white":"text-gray-900":$?"text-[#D1D5DB]":"text-gray-600"),children:M.name}),M.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Hr(M,St)},St.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&ya.length>0&&(()=>{let{spent:M,allocated:se,quoted:xe}=Ee,Pe=se-M,ke=Pe<0,st=ke?`+${Gn(Math.abs(Pe))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Gn(Pe)} ${d==="es"?"AHORRADO":"SAVED"}`,ce=w==="financial"&&F>0,Ve=(Ht,St)=>{if(ce){let zt=St??Ht/60*F;return `$${Math.round(zt).toLocaleString("es-CO")}`}return Gn(Ht)},it=ce?Math.abs(Ee.dollarAllocated-Ee.dollarSpent):0,wt=ce?`${ke?"+":"-"}$${it.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ke?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:st;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",$?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:$?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[dt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),ut.map(Ht=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3",Ht.type!=="name"&&"justify-center"),style:{width:Go[Ht.id],minWidth:Ht.minWidth},children:Ht.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Ht.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:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ve(M,ce?Ee.dollarSpent:void 0)}),jsxRuntime.jsx("span",{className:u("text-[11px]",$?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",$?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ve(se,ce?Ee.dollarAllocated:void 0)})]}),se>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ce?wt:st})]}):Ht.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:xe>0?Ve(xe,ce?Ee.dollarQuoted:void 0):"\u2013"}):Ht.type==="effortMinutes"?(()=>{if(ce&&xe>0&&se>0){let St=Math.round(Ee.dollarQuoted),zt=Math.round(Ee.dollarAllocated),oa=St-zt,Sa=St>0?Math.round(oa/St*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ve(se,Ee.dollarAllocated)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",oa>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[oa>=0?"+":"",Math.abs(oa)>=1e3?`$${(oa/1e3).toFixed(1)}K`:`$${oa}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Sa,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?Ve(se,ce?Ee.dollarAllocated:void 0):"\u2013"})})():Ht.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?Ve(M,ce?Ee.dollarSpent:void 0):"\u2013"}):Ht.type==="progress"?(()=>{let St=Xg(dc(e||[]));return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",$?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[St,"%"]})})():Ht.type==="weight"?(()=>{let St=e||[],zt=[],oa=Ft=>{for(let eo of Ft)zt.push(eo),eo.subtasks?.length&&oa(eo.subtasks);};oa(St);let Ea=zt.filter(Ft=>!Ft.subtasks?.length||Ft.subtasks.length===0).reduce((Ft,eo)=>Ft+(eo.weight||0),0),ar=Math.abs(Ea-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",ar?$?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ea.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",$?"text-white/30":"text-gray-300"),children:"\u2013"})},Ht.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ya.length===0&&Be&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",$?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u($?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&he&&jsxRuntime.jsx(jg,{data:_.data,isDark:$,locale:d,onClose:()=>Ye(false),lens:t?.lens,onUnassignedTaskClick:M=>{let se=document.querySelector(`[data-task-id="${M}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),re(M),setTimeout(()=>re(null),2e3));}})]}),jsxRuntime.jsx(Dg,{state:H,onClose:E,isDark:$,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:U,onColumnSort:Ze,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),ue&&He&&D&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:He.x+12,top:He.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Se.flattenTasks(e).find(xe=>xe.id===D);return se?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:$?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${$?"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:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:$?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsxRuntime.jsx(Hg,{isOpen:Dt,onClose:()=>Xe(false),onSave:lr,isDark:$,locale:d})]})}var e0=[{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}],t0=[{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"}],a0=[{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 cc={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:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},uc={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:"#2E94FF"},pc={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"},Xi={dark:cc,light:uc,neutral:pc};function r0(e){return Xi[e]||Xi.dark}var mc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},gc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Ji={en:mc,es:gc};function Es(e){return Ji[e]||Ji.en}function Qi(e,t){let a=Es(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function o0(e){let t=Es(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function n0(e,t=0,a=true){let r=Es(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Fs(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function bc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function l0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var u0=26,bw=22,hw=10;function d0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function hc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function p0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function c0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function yw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",h=m?hc(c.effortMinutes,n,l):null,f=m?p0(c,n,l):null,b=m?c.blockers?.find(v=>v.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*u0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${bw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function m0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:v,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:w,onStopTimer:F,onDiscardTimer:I,blurFinancials:S=false,suppressDetailModal:X=false,lens:O="hours",hourlyRate:$=0}){let{theme:A="dark",locale:q="en",customTranslations:Z,showBacklog:Ee=true}=t,B=Qi(q,Z),_=A==="dark"||A==="neutral",[he,Ye]=react.useState(r||new Date),[z,re]=react.useState(null),[J,Le]=react.useState(null),[we,Oe]=react.useState(null),[Be,lt]=react.useState({}),ee=3,ct=3,pe=react.useCallback(V=>{Le(V.id),X||re(V),h?.(V.id);},[X,h]),[et,nt]=react.useState(null),Ut=react.useCallback(()=>{Ye(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),Ce=react.useCallback(()=>{Ye(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),mt=react.useCallback(()=>{Ye(new Date);},[]),Dt=react.useMemo(()=>{let V=he.getFullYear(),te=he.getMonth(),$e=new Date(V,te,1),Ne=new Date(V,te+1,0),He=$e.getDay(),Fe=Ne.getDate(),Ge=Fs(e),ht=new Date;ht.setHours(0,0,0,0);let dt=[],gt=He,ot=new Date(V,te,0).getDate();for(let Et=gt-1;Et>=0;Et--){let Nt=new Date(V,te-1,ot-Et);dt.push({date:Nt,isCurrentMonth:false,isToday:false,isWeekend:Nt.getDay()===0||Nt.getDay()===6,events:Ge.filter(Tt=>bc(Nt,Tt)).map(Tt=>({id:Tt.id,title:Tt.name,start:Tt.startDate,end:Tt.endDate,task:Tt}))});}for(let Et=1;Et<=Fe;Et++){let Nt=new Date(V,te,Et),Tt=Nt.getTime()===ht.getTime();dt.push({date:Nt,isCurrentMonth:true,isToday:Tt,isWeekend:Nt.getDay()===0||Nt.getDay()===6,events:Ge.filter(yt=>bc(Nt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}let jt=42-dt.length;for(let Et=1;Et<=jt;Et++){let Nt=new Date(V,te+1,Et);dt.push({date:Nt,isCurrentMonth:false,isToday:false,isWeekend:Nt.getDay()===0||Nt.getDay()===6,events:Ge.filter(Tt=>bc(Nt,Tt)).map(Tt=>({id:Tt.id,title:Tt.name,start:Tt.startDate,end:Tt.endDate,task:Tt}))});}return dt},[he,e]),Xe=react.useMemo(()=>Fs(e).filter(V=>!V.startDate||!V.endDate),[e]),H=react.useMemo(()=>{let V=Fs(e),te=0,$e=0,Ne=0,He=0,Fe=0;V.forEach(ot=>{ot.effortMinutes&&(te+=ot.effortMinutes),ot.soldEffortMinutes&&($e+=ot.soldEffortMinutes),ot.scheduleVariance!=null&&(Ne+=ot.scheduleVariance,He++),ot.soldEffortMinutes&&ot.effortMinutes&&(Fe+=ot.soldEffortMinutes-ot.effortMinutes);});let Ge=$e>0?Math.min(100,Math.round(te/$e*100)):0,ht=He>0?Math.round(Ne/He):0,gt=`${Fe<0?"-":"+"}${c0(Fe,O,$)}`;return {budgetUtil:Ge,avgVariance:ht,costDisplay:gt,hasCostData:$e>0}},[e,O,$]),ne=react.useMemo(()=>{let V=[0,0,0,0,0,0];return Dt.forEach((te,$e)=>{let Ne=Math.floor($e/7);te.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Fe=new Date(He.task.startDate),Ge=te.date;Fe.getFullYear()===Ge.getFullYear()&&Fe.getMonth()===Ge.getMonth()&&Fe.getDate()===Ge.getDate()&&Ne<V.length&&(V[Ne]-=He.task.soldEffortMinutes);}});}),V},[Dt]),D=react.useMemo(()=>{let V=Fs(e),te=new Map,$e=new Set,Ne=[0,0,0,0,0,0];if(Dt.length===0)return {segmentsByCell:te,multiDayTaskIds:$e,maxLanesPerRow:Ne};let He=gt=>new Date(gt.getFullYear(),gt.getMonth(),gt.getDate()),Fe=He(Dt[0].date),Ge=He(Dt[Dt.length-1].date),ht=[];for(let gt of V){if(!gt.startDate||!gt.endDate)continue;let ot=He(gt.startDate),jt=He(gt.endDate);if(ot.getTime()===jt.getTime()||jt<Fe||ot>Ge)continue;let Et=ot<Fe?Fe:ot,Nt=jt>Ge?Ge:jt,Tt=d0(Et,Fe),yt=d0(Nt,Fe);Tt<0||Tt>41||yt<0||yt>41||Tt!==yt&&($e.add(gt.id),ht.push({task:gt,startIdx:Tt,endIdx:yt}));}ht.sort((gt,ot)=>gt.startIdx!==ot.startIdx?gt.startIdx-ot.startIdx:ot.endIdx-ot.startIdx-(gt.endIdx-gt.startIdx));let dt=[[],[],[],[],[],[]];for(let{task:gt,startIdx:ot,endIdx:jt}of ht){let Et=Math.floor(ot/7),Nt=Math.floor(jt/7),Tt=He(gt.startDate),yt=He(gt.endDate),Ot=false;for(let We=Et;We<=Nt;We++){let Re=We===Et?ot%7:0,at=We===Nt?jt%7:6,ie=at-Re+1,me=0,L=dt[We]??[];for(dt[We]||(dt[We]=L);me<L.length&&(L[me]??-1)>=Re;)me++;if(me>=hw){Ot=true;break}me>=L.length?L.push(at):L[me]=at,Ne[We]=Math.max(Ne[We]??0,me+1);let j=We===Et&&Tt>=Fe,Y=We===Nt&&yt<=Ge,ge=We*7+Re,De={taskId:gt.id,task:gt,rowIndex:We,startCol:Re,endCol:at,spanCols:ie,lane:me,isStart:j,isEnd:Y};te.has(ge)||te.set(ge,[]),te.get(ge).push(De);}Ot&&($e.delete(gt.id),te.forEach((We,Re)=>{let at=We.filter(ie=>ie.taskId!==gt.id);at.length===0?te.delete(Re):te.set(Re,at);}));}return {segmentsByCell:te,multiDayTaskIds:$e,maxLanesPerRow:Ne}},[Dt,e]),K=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ue=he.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ue.charAt(0).toUpperCase()+ue.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:l,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Ut,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",_?"text-white":"text-gray-900"),children:Te}),jsxRuntime.jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:mt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:K.map(V=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:V},V))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Le(null),children:Dt.map((V,te)=>{let $e=te%7===6,Ne=te>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!$e&&(_?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?V.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":V.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",V.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",V.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",V.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":V.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(V.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(te/7),Fe=(D.maxLanesPerRow[He]??0)*u0,Ge=D.segmentsByCell.get(te);return Fe===0&&!Ge?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Fe}px`,zIndex:5},children:Ge?.map(ht=>jsxRuntime.jsx(yw,{segment:ht,isDark:_,blurFinancials:S,isSelected:J===ht.taskId,t:B,lens:O,hourlyRate:$,onClick:()=>{pe(ht.task),a.onEventClick?.({id:ht.task.id,title:ht.task.name,start:ht.task.startDate,end:ht.task.endDate,task:ht.task});}},ht.taskId))})})(),(()=>{let He=V.events.filter(Fe=>Fe.task.isMilestone&&!D.multiDayTaskIds.has(Fe.id));return He.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[He.slice(0,4).map(Fe=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Fe.title,onClick:Ge=>{Ge.stopPropagation(),pe(Fe.task);}},Fe.id)),He.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];V.events.forEach(Ge=>{Ge.task.blockers?.forEach(ht=>{(ht.severity==="warning"||ht.severity==="critical")&&He.push({taskId:Ge.id,type:ht.type,severity:ht.severity,variance:Ge.task.scheduleVariance});});});let Fe=He[0];return Fe?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Fe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Fe.type,Fe.variance?` (+${Math.abs(Fe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let He=V.events.filter(dt=>!D.multiDayTaskIds.has(dt.id)),Fe=Be[te]||ee,Ge=He.slice(0,Fe),ht=He.length-Fe;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ge.map(dt=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{pe(dt.task),a.onEventClick?.(dt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",dt.task.progress===100||dt.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?dt.task.progress===100||dt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:dt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",dt.task.isMilestone?_?"text-amber-400":"text-amber-600":dt.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:dt.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:dt.title})]},dt.id)),ht>0&&jsxRuntime.jsxs("button",{onClick:dt=>{dt.stopPropagation(),lt(gt=>({...gt,[te]:Fe+ct}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ht," ",q==="es"?"m\xE1s":"more"]}),Fe>ee&&He.length>ee&&jsxRuntime.jsx("button",{onClick:dt=>{dt.stopPropagation(),lt(gt=>({...gt,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),V.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=te>=28,Fe=te%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ge=>{Ge.stopPropagation(),nt(et===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",et===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",et===te&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et===te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>nt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",Fe?"right-0":"left-0",_?"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(Qo,{onSubmit:Ge=>{a.onTaskCreate?.({name:Ge.name,startDate:Ge.startDate||V.date,endDate:Ge.endDate||V.date,priority:Ge.priority,assignees:Ge.assignee?[Ge.assignee]:void 0}),nt(null);},onCancel:()=>nt(null),availableUsers:t.availableUsers,isDark:_,locale:q==="es"?"es":"en",defaultDate:V.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let He=Math.floor(te/7),Fe=ne[He];if(!Fe||Fe===0)return null;let Ge=c0(Fe,O,$);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Fe<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Fe<0?"-":"+",Ge]})})()]},te)})})})]}),Ee&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",_?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:Xe.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Xe.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",_?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Xe.map(V=>jsxRuntime.jsxs("button",{onClick:()=>{pe(V);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",_?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:V.name})]}),V.tags&&V.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[V.tags.slice(0,3).map(te=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),V.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",V.tags.length-3]})]}),(V.effortMinutes||V.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[hc(V.effortMinutes,O,$)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",hc(V.effortMinutes,O,$)]}),(()=>{let te=p0(V,O,$);return te?jsxRuntime.jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[V.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",V.priority==="urgent"||V.priority==="high"?"text-red-400":V.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(l0,{task:V,isDark:_})]}),V.assignees&&V.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,2).map((te,$e)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},$e))})]})]},V.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:V=>{V.key==="Enter"&&V.target.value.trim()&&(a.onTaskCreate?.({name:V.target.value.trim()}),V.target.value="");}})}),H.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!X&&jsxRuntime.jsx(bo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:V=>{a.onTaskUpdate?.(V),re(V);},theme:A==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(V=>({id:V.id,name:V.name,avatar:V.avatar,initials:V.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:z?p?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Fs(e).filter(V=>V.id!==z?.id),comments:d?.filter(V=>V.taskId===z?.id).map(V=>({...V,createdAt:V.createdAt instanceof Date?V.createdAt:new Date(V.createdAt),updatedAt:V.updatedAt instanceof Date?V.updatedAt:V.updatedAt?new Date(V.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:v,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:w,onTimerStop:F,onTimerDiscard:I,blurFinancials:S}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Oe(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:we.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Oe(null),className:u("p-1 rounded",_?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:we.events.map(V=>jsxRuntime.jsxs("button",{onClick:()=>{Oe(null),pe(V.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(l0,{task:V.task,isDark:_}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:V.title}),(V.task.priority==="high"||V.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},V.id))})]})]})})]})}var yc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},xc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},vc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},tl={dark:yc,light:xc,neutral:vc};function g0(e){return tl[e]||tl.dark}function vw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,y=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,x=p.map(f=>f.priority).filter(Boolean),h=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,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:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var b0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function As(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 Ls(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 h0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function y0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...b0,...n}),[n]),[i,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(v=>{let C=v.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(v):b.set(C,[v]);}),Array.from(b.entries()).sort((v,C)=>C[0].localeCompare(v[0])).map(([v,C])=>({date:new Date(v),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,v=new Set;return e.forEach(C=>{b.add(C.userId),v.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(v)}},[e]),x=b=>{p(v=>{let C=new Set(v);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Ls(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((v,C)=>{let N=i.has(v.id),T=s===v.id,k=h0(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ls(v.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:As(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),x(v.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([w,F])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(F.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(F.to)})]})]},w)),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([w,F])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(F)})]},w))]})]})]})]},v.id)})})]},b.date?.toISOString()||"all"))})]})}function v0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Ls(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&As(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:As(g)},g.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:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",i),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 wc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function kc(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 w0(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 k0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Dw(e,t,a,r,o,s=100){let n=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})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(m-p.y)*o.centerForce*i,n.forEach(g=>{if(p.id===g.id)return;let y=p.x-g.x,x=p.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*i/(h*h);p.vx+=y/h*f,p.vy+=x/h*f;});}),t.forEach(p=>{let d=l.get(typeof p.source=="string"?p.source:p.source.id),m=l.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,y=m.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*i;d.vx+=g*h,d.vy+=y*h,m.vx-=g*h,m.vy-=y*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function C0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,v]=react.useState(1),[C,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=Dw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=react.useCallback((O,$)=>{a.enableDragging&&($.stopPropagation(),g(O));},[a.enableDragging]),k=react.useCallback(O=>{if(!m||!i.current)return;let A=i.current.getBoundingClientRect(),q=(O.clientX-A.left-C.x)/b,Z=(O.clientY-A.top-C.y)/b;d(Ee=>Ee.map(B=>B.id===m?{...B,x:q,y:Z,fx:q,fy:Z}:B));},[m,b,C]),w=react.useCallback(()=>{g(null);},[]),F=react.useCallback((O,$)=>{$.stopPropagation(),l?.({type:"node-click",node:O,position:{x:$.clientX,y:$.clientY}});},[l]),I=react.useCallback((O,$)=>{$.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:$.clientX,y:$.clientY}});},[l]),S=react.useCallback(O=>{let $=p.find(A=>A.id===O);return $?{x:$.x,y:$.y}:{x:0,y:0}},[p]),X=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=O.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("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:u("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:n.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:n.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:()=>v(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),N({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:wc(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[w0(O)," ",kc(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let $=S(typeof O.source=="string"?O.source:O.source.id),A=S(typeof O.target=="string"?O.target:O.target.id),q=k0(O.type),Z=h===O.id,Ee=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Ee&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>I(O,B),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:A.x,y2:A.y,stroke:wc(O.type),strokeWidth:Ee?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsxRuntime.jsx("text",{x:($.x+A.x)/2,y:($.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:kc(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(O=>{let $=y===O.id,A=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",$&&"hovered",A&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>T(O.id,q),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:q=>F(O,q),children:[jsxRuntime.jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:$?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 D0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),y=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=v=>{v.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),p(null),m(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),p(null),m(null);try{let b=await r(s.trim());m(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,v)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},v)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,v)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Cc={"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 Ew={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mw={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 Fw(e,t,a){let r=Cc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Is(e){return `$${e.toFixed(4)}`}var Tc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Fw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},dn=new Tc;function M0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(dn.getStats()),[s,n]=react.useState(dn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(dn.getStats()),n(dn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=dn.getRecentOperations(5);return jsxRuntime.jsxs(Jt,{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-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[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:Is(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?i/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:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Is(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Is(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 A0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,v]=react.useState(null),C=react.useRef(null),N=m||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let I=S=>{S.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(l(""),i(""),d(""),x(null),f(null),v(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),v(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f(I.tasks.tasks),v({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},w=()=>{h&&(a(h),T());};if(!e)return null;let F=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Jt,{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:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:T,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.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"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",F,"% 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:[b?.tokens_used||0," tokens"]}),b?.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:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((I,S)=>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:["#",S+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:C,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),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:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),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:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,S)=>jsxRuntime.jsx("button",{onClick:()=>l(I),disabled:N,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:I},S))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function ol({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&js(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,v)=>{console.warn(`Retry attempt ${b} after ${v}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(v=>{let C=v.cards.find(I=>I.id===h);if(!C)return v;let N=C.columnId,T={...C,columnId:f,position:b},k=v.cards.map(I=>I.id===h?T:I),w=v.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(S=>S!==h)};if(I.id===f){let S=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:S.map(X=>X.id)}}return I}),F={...v,cards:k,columns:w};return o(F),F});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let v=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:v};return o(C),C});},[o]),l=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,v],columns:C};return o(N),N});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let v=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:v,columns:C};return o(N),N});},[o]),i=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,v]};return o(C),C});},[o]),p=react.useCallback(async(h,f)=>{r(b=>{let v=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:v};return o(C),C});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),v=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:v};return o(C),C});},[o]),m=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function I0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ol({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,p={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Bs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},R0={by:"none",order:"asc"};function O0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Bs,...e}),[s,n]=react.useState({...R0,...t}),l=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),i=react.useCallback(()=>{o(Bs),n(R0);},[]),p=react.useCallback(()=>{a&&o({...Bs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Bs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...Bs,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),v=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${v}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let F=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),S=String(k.getUTCDate()).padStart(2,"0");w=`${F}-${I}-${S}`;}switch(r.dateFilter){case "overdue":return w<N;case "today":return w===N;case "this-week":let F=new Date(N+"T00:00:00"),I=new Date(w+"T00:00:00"),S=new Date(F);return S.setDate(S.getDate()+7),I>=F&&I<=S;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let v=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;v=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],w=T[b.priority||"LOW"];v=k-w;break;case "dueDate":let F=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!F)return 1;if(!I)return -1;let S=typeof F=="string"?new Date(F).getTime():F.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();v=S-X;break;case "title":v=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,$=b.estimatedTime||0;v=O-$;break;default:v=0;}return s.order==="asc"?v:-v}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var H0,z0;if(typeof window<"u")try{let e=Ws("ai");H0=e.generateObject,z0=e.generateText;}catch{}function U0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(H0&&z0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Dc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function W0(e){let{cards:t}=e,[a,r]=Dc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(w=>w.columnId===x.columnId).sort((w,F)=>w.position-F.position),b=f.findIndex(w=>w.id===a.lastSelectedCardId),v=f.findIndex(w=>w.id===d),[C,N]=b<v?[b,v]:[v,b],T=f.slice(C,N+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:p}}var V0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function G0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...V0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((x,h,f,b,v)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:v,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),i=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let v=b.cardIds.filter(C=>C!==h);return v.length<o.minCardsPerStack?null:{...b,cardIds:v}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),m=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let v=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{v.has(T)||v.set(T,[]),v.get(T).push(N);});}),v.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(w=>w.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[N.id,...k.map(I=>I.card.id)],F=k.reduce((I,S)=>I+S.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:w,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:F});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var j0=react.createContext(null);function _0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=Ws("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Ws("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Ws("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(j0.Provider,{value:{store:o},children:e})}function nl(){let e=react.useContext(j0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Os(){let e=nl(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),i=react.useCallback((b,v)=>{e.updateColumn(b,v);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),m=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,v)=>{e.updateCard(b,v);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,v,C)=>{e.moveCard(b,v,C);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function q0(e){let{cards:t}=Os();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!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(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Y0(e="position",t="asc"){let{cards:a}=Os();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var sl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=iu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Kw=new sl;function J0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Q0(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 ef({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:l}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:m.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function tf(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 af(e,t=10){return e>t}var Fc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ac={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ic={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Bc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Rc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Oc={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)"},$c={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)"},Hc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zc={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}},Uc={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}},il={spacing:Fc,borderRadius:Pc,fontSize:Ac,fontWeight:Lc,lineHeight:Ic,zIndex:Bc,duration:Rc,easing:Oc,shadows:$c,opacity:Hc,kanban:zc,gantt:Uc};function rf(e,t,a){return e[t]??a}function Wc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Wc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Xw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vc(e="asakaa"){let t=Wc(il),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Xw(o);a.push(` ${s}: ${n};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function wo(e,t){let a=Bm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Hd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}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 m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=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(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=p[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function zd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Ud(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 Rm(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 Om(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 i=r[1].trim(),p=r[2].trim(),d=wo(t,i),m=Hd(p);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:y},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),d=wo(t,i),m=zd(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.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 i=s[1].trim(),p=s[2].trim(),d=wo(t,i),m=Ud(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=wo(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),p=l[2].trim(),d=wo(t,i),m=wo(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),p=wo(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function $m(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 s2(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 i2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ui(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ui(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 n=p=>{if(p)return typeof p=="string"?new Date(p):p},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:s2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Hm(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:i2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function zm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ui(r,e,t))}var Wd={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"}},Vd={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"}},Wi={en:Wd,es:Vd};function Gd(e){return Wi[e]||Wi.en}function Vi(e,t){let a=Gd(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 jd=[{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 Um(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 Wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Um(e),i=jd[0],p=jd.find(g=>g.value===c)??i,d=p.icon,m=g=>{switch(Um(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("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(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("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:jd.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("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===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var _d=[{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 Gm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=_d.find(p=>p.value===e)??_d[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("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:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:_d.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("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:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function Ts(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Kd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],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-blue-500"}function qd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{p.current&&!p.current.contains(h.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:Ts(x.name),color:x.color||Kd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("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((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ts(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("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:x=>{x.stopPropagation(),l(!n);},className:u("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:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("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((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ts(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",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:d,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.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((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ts(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Ts(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Xm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,p]=react.useState(false),[d,m]=react.useState(o),[g,y]=react.useState(()=>{let k=o==="start"?e:t;if(k){let w=k instanceof Date?k:new Date(k);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let k=w=>{x.current&&!x.current.contains(w.target)&&p(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",v=react.useCallback(()=>{let k=g.getFullYear(),w=g.getMonth(),F=new Date(k,w,1),S=new Date(k,w+1,0).getDate(),Y=F.getDay(),$=[],C=new Date(k,w,0).getDate();for(let Z=Y-1;Z>=0;Z--)$.push({date:new Date(k,w-1,C-Z),isCurrentMonth:false});for(let Z=1;Z<=S;Z++)$.push({date:new Date(k,w,Z),isCurrentMonth:true});let G=42-$.length;for(let Z=1;Z<=G;Z++)$.push({date:new Date(k,w+1,Z),isCurrentMonth:false});return $},[g]),T=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),p(false);else if(d==="start"){let w=f&&k>f?k:f;a(k,w||void 0),m("end");}else {let w=h&&k<h?k:h;a(w||void 0,k),p(false);}},D=()=>{let k=new Date,w=new Date(k);w.setDate(k.getDate()+1);let F=new Date(k);F.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let S=new Date(k);S.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let Y=new Date(k);Y.setDate(k.getDate()+14);let $=new Date(k);return $.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:F,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:$,display:$.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let N=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),p(!i);let w=o==="start"?h:f;w&&y(new Date(w.getFullYear(),w.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(N)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((k,w)=>jsxRuntime.jsxs("button",{className:u("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(k.date),children:[jsxRuntime.jsx("span",{children:k.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},w)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),p(false);},className:u("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:n==="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:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="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:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:v().map((k,w)=>{let F=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),S=f?.toDateString()===k.date.toDateString(),Y=I||S,$=!r&&h&&f&&k.date>=h&&k.date<=f;return jsxRuntime.jsx("button",{onClick:()=>T(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),F&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",S&&!I&&"bg-[#7C3AED] text-white",$&&!Y&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Y&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},w)})})]})]})]})]})}function _i({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Xm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Wn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=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:o}}function Ki(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),v=Math.round(d+g*b);n(v),x===o&&(c(false),n(m));},y*x);p.current.push(h);}return i.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Jm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Zm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),{isFlashing:d,triggerFlash:m}=Wn(),{displayValue:g,isAnimating:y}=Ki(e,{enabled:o,duration:300,steps:6}),x=T=>{if(r||!t)return;T.stopPropagation();let D=T.currentTarget.getBoundingClientRect(),N=T.clientX-D.left,k=Math.round(N/D.width*100),w=Math.max(0,Math.min(100,k));w!==e&&(t(w),s&&m());},h=react.useCallback(T=>{r||!t||(T.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=react.useCallback(()=>{l(false);let T=parseInt(c,10);if(!isNaN(T)&&t){let D=Math.max(0,Math.min(100,T));D!==e&&(t(D),s&&m());}},[c,t,e,s,m]),b=react.useCallback(T=>{T.key==="Enter"&&f(),T.key==="Escape"&&l(false);},[f]),v=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:u("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:u("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${v}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:p,value:c,onChange:T=>i(T.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("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-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function ag({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("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 ng({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=Wn(),{displayValue:h,isAnimating:f}=Ki(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let b=()=>{let T=parseFloat(d);if(!isNaN(T)){let D=T;o!==void 0&&(D=Math.max(o,D)),s!==void 0&&(D=Math.min(s,D)),D!==e&&(t?.(D),c&&x());}p(false);},v=T=>{T.key==="Enter"?b():T.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:T=>m(T.target.value),onBlur:b,onKeyDown:v,onClick:T=>T.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:T=>{T.stopPropagation(),p(true);},className:u("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",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function sg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("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:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),l(false);},className:u("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===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function lg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:p}=Jm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?p():i(!e):t(!e));},m=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("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 ug({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=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)),o>0&&jsxRuntime.jsxs("span",{className:u("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:["+",o]})]})}function j2(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 _2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Tr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0}){let[p,d]=react.useState(false),[m,g]=react.useState(""),y=react.useRef(null),{isFlashing:x,triggerFlash:h}=Wn(),f=c==="financial"&&i>0,b=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:j2(e,r);react.useEffect(()=>{p&&y.current&&(y.current.focus(),y.current.select());},[p]),react.useEffect(()=>{if(e){let N=Math.floor(e/60),k=e%60;N>0&&k>0?g(`${N}h ${k}m`):N>0?g(`${N}h`):g(`${k}m`);}else g("");},[e,p]);let v=()=>{let N=_2(m);N!==e&&(t?.(N),n&&h()),d(false);},T=N=>{N.key==="Enter"?v():N.key==="Escape"&&d(false);};if(l)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:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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 D=f?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(D,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):p?jsxRuntime.jsx("input",{ref:y,type:"text",value:m,onChange:N=>g(N.target.value),onBlur:v,onKeyDown:T,onClick:N=>N.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:N=>{N.stopPropagation(),d(true);},className:u("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",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(D,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:b})]})}function fg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=o==="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:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),l()]})}function hg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",p=l==="financial"&&c>0,d=Z=>p?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[m,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),v=e.timeLoggedMinutes||0,T=e.effortMinutes||0,D=e.soldEffortMinutes||0,N=Math.round(v/60*10)/10,k=Math.round(T/60*10)/10,w=T>0?v/T*100:0,F=w>100?Math.round((v-T)/60*10)/10:0,I=w>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let Z=$e=>{b.current&&!b.current.contains($e.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let S=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x($e=>!$e),f(null);return}n&&n(e);},Y=Z=>{x(false),f(Z);},$=async(Z,$e)=>{h==="log"&&r&&Z?r(e,Z,$e):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},X=r||o||s||n,C=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),G=h==="estimate"?T:h==="quoted"?D:void 0;return T===0&&v===0&&D===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&X&&jsxRuntime.jsx("button",{onClick:S,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:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:C.map(Z=>jsxRuntime.jsxs("button",{onClick:$e=>{$e.stopPropagation(),Y(Z.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:$e=>{$e.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:$e=>{$e.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(oo,{mode:h,locale:a,isDark:t,currentValue:G||void 0,onSave:$,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(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 Z=v===0,B=(T>0?v/T: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:Z?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:d(N)}),T>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),F>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(F)," ",i?"Excedido":"Over"]})]})})(),T>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(w,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),X&&jsxRuntime.jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:C.map(Z=>jsxRuntime.jsxs("button",{onClick:$e=>{$e.stopPropagation(),Y(Z.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:$e=>{$e.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:$e=>{$e.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(oo,{mode:h,locale:a,isDark:t,currentValue:G||void 0,onSave:$,onClose:()=>f(null)})})})})]})}function Z2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function e1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function yg({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",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function xg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=Z2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(yg,{assignee:g,size:24,isDark:t},g.name+y))}),m>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("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:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,c=!!n&&l>0,i=c?e1(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(yg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var t1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function wg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("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,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",t1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function b1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function h1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],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 Sg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=react.useRef(null),b=r==="es"?Tg.es:Tg.en;if(react.useEffect(()=>{let k=F=>{f.current&&!f.current.contains(F.target)&&t();},w=F=>{F.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",w);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),l&&(k.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),p.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(w=>({id:`assign-${w.id}`,label:w.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:w.name.charAt(0).toUpperCase()}),onClick:()=>{let F=e.task.assignees||[],S=F.some(Y=>Y.name===w.name)?F.filter(Y=>Y.name!==w.name):[...F,{name:w.name,initials:b1(w.name),color:w.color||h1(w.name),avatar:w.avatarUrl}];l({...e.task,assignees:S}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},T=()=>{if(!e.columnId)return [];let k=[];return i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},D=e.type==="task"?v():T(),N={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:f,style:N,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:D.map(k=>k.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsxRuntime.jsx(y1,{item:k,isDark:a},k.id):jsxRuntime.jsxs("button",{onClick:k.onClick,className:u("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",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function y1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Tg={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 Bg={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"})},B1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Og({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[p,d]=react.useState(null),[m,g]=react.useState(null),y=react.useRef(null),x=l==="es"?Rg.es:Rg.en;react.useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let w=y.current.parentElement;if(w){let Y=w.getBoundingClientRect();g({top:Y.bottom+4,right:window.innerWidth-Y.right});}let F=y.current.getBoundingClientRect(),S=window.innerHeight-F.top-20;d(Math.max(300,S));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),react.useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let w=I=>{y.current&&!y.current.contains(I.target)&&t();},F=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",w),document.addEventListener("keydown",F),y._cleanup=()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",F);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=react.useMemo(()=>{let k=new Set([...B1]);return a.forEach(w=>{w.type&&w.type!=="assignees"&&k.add(w.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let w=x.columns[k];if(w)return w;let F=a.find(I=>I.type===k);return F?.label?F.label:k},b=k=>{if(k==="name")return;let w=a.map(F=>F.id===k?{...F,visible:!F.visible}:F);o(w);},v=(k,w)=>{let F=a.find(S=>S.type===k&&(!w||S.customFieldId===w));if(F){b(F.id);return}let I={id:w||k,type:k,label:w?r.find(S=>S.id===w)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:w};o([...a,I]);},T=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),D=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),N=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:y,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"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 ${n?"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:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:k=>i(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"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:k=>{k&&k.style.setProperty("--focus-border",N);},onFocus:k=>{k.currentTarget.style.borderColor=N,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"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:k=>k.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:T.map(k=>{let w=a.find(S=>S.type===k&&!S.customFieldId),F=w?.visible??false,I=k==="name";return jsxRuntime.jsxs("button",{onClick:()=>{I||(w?b(w.id):v(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:S=>{I||(S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:S=>{S.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:F?N:"transparent",border:F?`1.5px solid ${N}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${N}40`:"none"},children:F&&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:F?N:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Bg[k]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:F?500:400,color:F?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),D.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:D.map(k=>{let F=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.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:F?N:"transparent",border:F?`1.5px solid ${N}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${N}40`:"none"},children:F&&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:F?N:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Bg[k.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:F?500:400,color:F?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Rg={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",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 G1=[{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 zg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,p]=react.useState([""]),d=o==="es"?Hg.es:Hg.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let m=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{p([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,p(b);},x=h=>{i.length>1&&p(i.filter((f,b)=>b!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("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:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:G1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/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")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("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"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("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:u("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:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Hg={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 Vg={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 Gg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),p=s==="es"?Vg.es:Vg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{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-blue-500"},{value:"todo",label:p.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function jg(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 Ms(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function _g({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxRuntime.jsxs("div",{className:u("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:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("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:n?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,p=e.totalExecuted??0,d=c-i,m=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(i/c*100),120):0,y=i>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ms(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ms(i)})]}),p>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Ms(p)})]}),c>0&&jsxRuntime.jsx("div",{className:u("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(g,100)}%`,backgroundColor:x}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=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:[d>=0?`+${Ms(d)} ${n?"Disp.":"Avail."}`:`${Ms(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,p=i>0?Math.min(Math.round(c/i*100),100):0,g=(i>0?c/i:0)>1.1?"#F87171":p>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:jg(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:jg(i)})]}),i>0&&jsxRuntime.jsx("div",{className:u("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:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("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:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.jsx("div",{className:u("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:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsxRuntime.jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsxRuntime.jsx("div",{className:u("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:u("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:u("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:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,p=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!i&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{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:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("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}-${i}`)})})]})]})}var sw=[{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 Zg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Zg(r.subtasks,t+1));return a}function iw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function Kn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Kn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function _n(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 lw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(n(String(e||"")),o(false));},className:u("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-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),n(String(e||"")),o(true);},className:u("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 Jg(e){if(e.length===0)return 0;let t=0,a=0,r=0,o=0;for(let c of e){let i=c.weight||0;i>0&&(t+=(c.progress||0)*i,a+=i,r+=1),o+=c.progress||0;}let s=r/e.length,l=a>=99&&s>=.95?t/a:o/e.length;return Math.round(l*10)/10}function uc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0});return t}function e0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:v=false,onCreateTask:T,persistFilter:D=false,financialBlur:N,healthSidebar:k,lens:w="hours",hourlyRate:F=0,rateMap:I,aggregateParentHours:S=false,showProjectTotals:Y=false,totalsDollarOverride:$}=t,X=Vi(d,m),C=p==="dark",G=P=>{if(!I||!P.assignees||P.assignees.length===0)return F;let oe=0,ke=0;for(let Le of P.assignees){let tt=Le.id?I[Le.id]:void 0;if(tt==null||tt<=0)continue;let ge=typeof Le.estimatedMinutes=="number"?Le.estimatedMinutes:0;ge>0&&(oe+=tt*ge,ke+=ge);}if(ke>0)return oe/ke;let xe=P.assignees.map(Le=>Le.id?I[Le.id]:void 0).filter(Le=>Le!=null&&Le>0);return xe.length===0?F:xe.reduce((Le,tt)=>Le+tt,0)/xe.length},Z=P=>{let oe=0,ke=0,xe=0,Le=tt=>{for(let ge of tt)if(ge.subtasks&&ge.subtasks.length>0){let Ge={s:oe,a:ke,q:xe};if(Le(ge.subtasks),oe-Ge.s+(ke-Ge.a)+(xe-Ge.q)===0){let vt=G(ge);oe+=(ge.timeLoggedMinutes??0)/60*vt,ke+=(ge.effortMinutes??0)/60*vt,xe+=(ge.soldEffortMinutes??0)/60*vt;}}else {let Ge=G(ge);oe+=(ge.timeLoggedMinutes??0)/60*Ge,ke+=(ge.effortMinutes??0)/60*Ge,xe+=(ge.soldEffortMinutes??0)/60*Ge;}};return P.subtasks&&Le(P.subtasks),{dollarSpent:oe,dollarAllocated:ke,dollarQuoted:xe}},$e=react.useCallback(()=>{if(!D||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(D);if(P){let oe=JSON.parse(P);return {statusFilter:oe.statusFilter||"all",hideCompleted:oe.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[D]),B=react.useMemo(()=>{function P(oe){let ke=0,xe=0,Le=0,tt=0,ge=0,Ge=0;for(let st of oe)if(st.subtasks&&st.subtasks.length>0){let vt=P(st.subtasks);if(vt.spent+vt.allocated+vt.quoted>0)ke+=vt.spent,xe+=vt.allocated,Le+=vt.quoted,tt+=vt.dollarSpent,ge+=vt.dollarAllocated,Ge+=vt.dollarQuoted;else {let Gt=st.timeLoggedMinutes??0,$t=st.effortMinutes??0,aa=st.soldEffortMinutes??0;ke+=Gt,xe+=$t,Le+=aa;let jt=G(st);tt+=Gt/60*jt,ge+=$t/60*jt,Ge+=aa/60*jt;}}else {let vt=st.timeLoggedMinutes??0,ta=st.effortMinutes??0,Gt=st.soldEffortMinutes??0;ke+=vt,xe+=ta,Le+=Gt;let $t=G(st);tt+=vt/60*$t,ge+=ta/60*$t,Ge+=Gt/60*$t;}return {spent:ke,allocated:xe,quoted:Le,dollarSpent:tt,dollarAllocated:ge,dollarQuoted:Ge}}return P(e)},[e]),K=react.useMemo(()=>{let P=new Map;function oe(ke){let xe=0;for(let Le of ke)if(Le.subtasks&&Le.subtasks.length>0){let tt=oe(Le.subtasks);P.set(Le.id,tt),xe+=tt;}else xe+=Le.weight||0;return xe}return oe(e),P},[e]),he=react.useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:B.spent,totalHoursAllocatedMinutes:B.allocated}},[k,B]),[Xe,H]=react.useState(true),[re,Q]=react.useState(null),[Ee,Te]=react.useState("position"),[Ie,Be]=react.useState("asc"),[ot,ae]=react.useState(""),[nt,fe]=react.useState(()=>$e().statusFilter),[Ze,xt]=react.useState(()=>$e().hideCompleted),[St,Ce]=react.useState(x||sw),[gt,Tt]=react.useState(false),[Qe,O]=react.useState(false),[ie,M]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[V,ce]=react.useState(null),[Ne,W]=react.useState(false),[ee,je]=react.useState(null),[ve,He]=react.useState(null),[Me,We]=react.useState(null),Nt=react.useRef(0),ct=react.useRef(false),it=!!(a.onTaskMove||a.onTaskReparent),lt=react.useCallback((P,oe)=>{it&&(oe.preventDefault(),Nt.current=oe.clientY,ce(P),ct.current=false,W(false),We({x:oe.clientX,y:oe.clientY}));},[it]),Vt=react.useCallback(P=>{if(!V||(Math.abs(P.clientY-Nt.current)>5&&!ct.current&&(ct.current=true,W(true)),We({x:P.clientX,y:P.clientY}),!ct.current))return;let ke=document.querySelectorAll("[data-listview-row]"),xe=null,Le=null;ke.forEach(tt=>{let ge=tt.getBoundingClientRect(),Ge=tt.getAttribute("data-listview-row");if(Ge&&Ge!==V&&P.clientY>=ge.top&&P.clientY<=ge.bottom){xe=Ge;let st=P.clientY-ge.top,vt=ge.height;Le=st<vt*.25?"above":st>vt*.75?"below":"child";}}),je(xe),He(Le);},[V]),zt=react.useCallback(()=>{if(ct.current&&V&&ee&&ve){if(ve==="child"&&a.onTaskReparent)a.onTaskReparent(V,ee);else if(ve==="above"||ve==="below"){let P=(xe,Le,tt=null)=>{for(let ge of xe){if(ge.id===Le)return tt;if(ge.subtasks){let Ge=P(ge.subtasks,Le,ge.id);if(Ge!==void 0)return Ge}}},oe=P(e,V,null),ke=P(e,ee,null);if(a.onTaskReparent){let xe=(vt,ta)=>{if(ta===null)return vt;for(let Gt of vt){if(Gt.id===ta)return Gt.subtasks||[];if(Gt.subtasks){let $t=xe(Gt.subtasks,ta);if($t.length>0||Gt.subtasks.some(aa=>aa.id===ta))return $t}}return []},Le=xe(e,ke??null),tt=Le.findIndex(vt=>vt.id===ee),ge=oe===ke,Ge=ge?Le.findIndex(vt=>vt.id===V):-1,st=ve==="below"?tt+1:tt;ge&&Ge!==-1&&Ge<tt&&(st-=1),a.onTaskReparent(V,ke??null,Math.max(0,st));}}}ce(null),je(null),He(null),We(null),ct.current=false,W(false);},[V,ee,ve,e,a]);react.useEffect(()=>{if(V)return document.addEventListener("mousemove",Vt),document.addEventListener("mouseup",zt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Vt),document.removeEventListener("mouseup",zt),document.body.style.cursor="",document.body.style.userSelect="";}},[V,Vt,zt]);let[pt,Et]=react.useState("all"),[mt,It]=react.useState(false),Ue=react.useRef(null),Re=react.useRef(null),dt=react.useMemo(()=>{let P=0;function oe(ke,xe){for(let Le of ke)xe>P&&(P=xe),Le.subtasks?.length&&oe(Le.subtasks,xe+1);}return oe(e,1),P},[e]);react.useEffect(()=>{if(!mt)return;let P=oe=>{Ue.current?.contains(oe.target)||Re.current?.contains(oe.target)||It(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[mt]),react.useEffect(()=>{if(pt==="all"){let ke=function(xe){for(let Le of xe)Le.subtasks?.length&&(Le.isExpanded===false&&a.onTaskToggleExpand?.(Le.id),ke(Le.subtasks));};ke(e);}else {let ke=function(xe,Le){for(let tt of xe)if(tt.subtasks?.length){let ge=Le<pt,Ge=tt.isExpanded!==false;ge!==Ge&&a.onTaskToggleExpand?.(tt.id),ke(tt.subtasks,Le+1);}};ke(e,1);}},[pt]);let[se,ue]=react.useState(null),[L,_]=react.useState(0),[q,pe]=react.useState(0),Fe=react.useRef(null),[Ke,Ve]=react.useState(null),[ze,ht]=react.useState(null);react.useEffect(()=>{x&&Ce(P=>{if(P.length===x.length){let oe=true;for(let ke=0;ke<P.length;ke++){let xe=P[ke],Le=x[ke];if(!xe||!Le||xe.id!==Le.id||xe.visible!==Le.visible||xe.width!==Le.width||xe.label!==Le.label){oe=false;break}}if(oe)return P}return x});},[x]),react.useEffect(()=>{if(!(!D||typeof window>"u"))try{localStorage.setItem(D,JSON.stringify({statusFilter:nt,hideCompleted:Ze}));}catch(P){console.error("Error persisting filter state:",P);}},[D,nt,Ze]);let wt=react.useMemo(()=>{let P=new Set;function oe(ke){for(let xe of ke)xe.subtasks?.length&&(xe.isExpanded!==false&&P.add(xe.id),oe(xe.subtasks));}return oe(e),P},[e]),Bt=react.useMemo(()=>St.filter(P=>P.visible),[St]),ga=react.useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),ua=react.useCallback(P=>{Ee===P?Be(oe=>oe==="asc"?"desc":"asc"):(Te(P),Be("asc")),a.onSortChange?.({column:P,direction:Ie==="asc"?"desc":"asc"});},[Ee,Ie,a]),z=react.useCallback(P=>{Ce(P),a.onColumnsChange?.(P);},[a]),et=react.useCallback(P=>{let oe=St.map(ke=>ke.id===P?{...ke,visible:false}:ke);z(oe);},[St,z]),ye=react.useCallback((P,oe)=>{Te(P),Be(oe);},[]),E=react.useCallback((P,oe,ke)=>{b&&(P.preventDefault(),M({isOpen:true,x:P.clientX,y:P.clientY,type:oe?"task":"header",task:oe,columnId:ke}));},[b]),me=react.useCallback(()=>{M(P=>({...P,isOpen:false}));},[]),_e=react.useCallback((P,oe)=>{if(!f)return;P.preventDefault(),P.stopPropagation();let ke=St.find(xe=>xe.id===oe);ke&&(ue(oe),_(P.clientX),pe(ke.width));},[St,f]);react.useEffect(()=>{if(!se)return;let P=St,oe=xe=>{let Le=xe.clientX-L,tt=Math.max(50,q+Le);P=P.map(ge=>ge.id===se?{...ge,width:tt}:ge),Ce(P);},ke=()=>{a.onColumnsChange?.(P),ue(null);};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ke),()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ke);}},[se,L,q,a]);let at=react.useCallback((P,oe)=>{if(oe==="name"){P.preventDefault();return}Ve(oe),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",oe),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),oa=react.useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),Ve(null),ht(null);},[]),Ut=react.useCallback((P,oe)=>{P.preventDefault(),oe!=="name"&&(P.dataTransfer.dropEffect="move",ht(oe));},[]),Ua=react.useCallback(()=>{ht(null);},[]),ir=react.useCallback((P,oe)=>{if(P.preventDefault(),!Ke||Ke===oe||oe==="name")return;let ke=[...St],xe=ke.findIndex(ge=>ge.id===Ke),Le=ke.findIndex(ge=>ge.id===oe);if(xe===-1||Le===-1)return;let tt=ke.splice(xe,1);tt[0]&&(ke.splice(Le,0,tt[0]),z(ke),Ve(null),ht(null));},[Ke,St,z]),Ta=react.useCallback(async P=>{if(a.onCreateCustomField){let oe={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(oe);}O(false);},[a]),Na=react.useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Nr=react.useMemo(()=>{let P=Zg(e);if(ot.trim()){let oe=ot.toLowerCase();P=P.filter(ke=>ke.name.toLowerCase().includes(oe));}return nt!=="all"&&(P=P.filter(oe=>Na(oe)===nt)),Ze&&(P=P.filter(oe=>Na(oe)!=="completed")),P.sort((oe,ke)=>{let xe,Le;switch(Ee){case "name":xe=oe.name.toLowerCase(),Le=ke.name.toLowerCase();break;case "startDate":xe=oe.startDate?.getTime()||0,Le=ke.startDate?.getTime()||0;break;case "endDate":xe=oe.endDate?.getTime()||0,Le=ke.endDate?.getTime()||0;break;case "progress":xe=oe.progress||0,Le=ke.progress||0;break;case "status":xe=oe.status||"todo",Le=ke.status||"todo";break;case "priority":let tt={urgent:0,high:1,medium:2,low:3,none:4};xe=tt[oe.priority]??4,Le=tt[ke.priority]??4;break;case "position":return 0;default:return 0}return xe<Le?Ie==="asc"?-1:1:xe>Le?Ie==="asc"?1:-1:0}),P},[e,ot,nt,Ze,Ee,Ie,Na]),Pr=react.useCallback((P,oe)=>{let ke=tt=>{a.onTaskUpdate?.({...P,...tt});},xe=tt=>tt?P.customFields?.find(Ge=>Ge.fieldId===tt)?.value:void 0,Le=(tt,ge)=>{if(!tt)return;let st=[...P.customFields||[]],vt=st.findIndex(ta=>ta.fieldId===tt);vt>=0?st[vt]={fieldId:tt,value:ge}:st.push({fieldId:tt,value:ge}),ke({customFields:st});};switch(oe.type){case "name":return null;case "status":return jsxRuntime.jsx(Wm,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:ge=>{ke({status:ge,progress:ge==="completed"?100:ge==="in-progress"?50:0});},isDark:C,locale:d,translations:X.status});case "priority":return jsxRuntime.jsx(Gm,{value:P.priority,onChange:ge=>ke({priority:ge}),isDark:C,locale:d});case "assignees":{let ge=P.hasChildren,Ge=P.assignees||[];if(ge&&P.subtasks?.length){let st=new Map,vt=ta=>{(ta||[]).forEach(Gt=>{(Gt.assignees||[]).forEach($t=>{st.has($t.name)||st.set($t.name,$t);}),Gt.subtasks?.length&&vt(Gt.subtasks);});};vt(P.subtasks),Ge=Array.from(st.values());}else ge&&(Ge=[]);return jsxRuntime.jsx(qd,{value:Ge,availableUsers:l,onChange:st=>ke({assignees:st}),isDark:C,locale:d,disabled:ge})}case "startDate":return jsxRuntime.jsx(_i,{value:P.startDate,onChange:ge=>ke({startDate:ge}),isDark:C,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsxRuntime.jsx(_i,{value:P.endDate,onChange:ge=>ke({endDate:ge}),isDark:C,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":{let ge=!!(P.subtasks&&P.subtasks.length>0),Ge=ge?Jg(uc(P.subtasks||[])):P.progress||0;return jsxRuntime.jsx(Zm,{value:Ge,onChange:ge?void 0:st=>{let vt=st===100?"completed":st>0?"in-progress":"todo";ke({progress:st,status:vt});},isDark:C,disabled:ge})}case "tags":return jsxRuntime.jsx(ug,{value:P.tags||[],isDark:C});case "text":return jsxRuntime.jsx(ag,{value:xe(oe.customFieldId)||"",onChange:ge=>Le(oe.customFieldId,ge),isDark:C});case "number":return jsxRuntime.jsx(ng,{value:xe(oe.customFieldId)||0,onChange:ge=>Le(oe.customFieldId,ge),isDark:C});case "date":let tt=xe(oe.customFieldId);return jsxRuntime.jsx(_i,{value:tt?new Date(tt):void 0,onChange:ge=>Le(oe.customFieldId,ge),isDark:C,locale:d});case "dropdown":return jsxRuntime.jsx(sg,{value:xe(oe.customFieldId)||"",options:oe.options||[],onChange:ge=>Le(oe.customFieldId,ge),isDark:C});case "checkbox":return jsxRuntime.jsx(lg,{value:xe(oe.customFieldId)||false,onChange:ge=>Le(oe.customFieldId,ge),isDark:C});case "estimatedTime":{let ge=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(Tr,{value:P.estimatedTime,onChange:Ge=>ke({estimatedTime:Ge}),isDark:C,locale:d,disabled:ge,lens:w,hourlyRate:G(P)})}case "quotedTime":{let ge=P.status==="completed"||P.progress===100,Ge=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsxRuntime.jsx(Tr,{value:P.quotedTime,onChange:st=>ke({quotedTime:st}),isDark:C,locale:d,disabled:ge,isBlurred:Ge,lens:w,hourlyRate:G(P)})}case "elapsedTime":{let ge=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(Tr,{value:P.elapsedTime,onChange:Ge=>ke({elapsedTime:Ge}),isDark:C,locale:d,disabled:ge,lens:w,hourlyRate:G(P)})}case "effortMinutes":{if(S&&P.subtasks&&P.subtasks.length>0){let{allocated:ta}=Kn(P);if(w==="financial"){let Gt=Z(P),$t=Math.round(Gt.dollarAllocated),aa=Math.round(Gt.dollarQuoted),jt=aa-$t;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[$t>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",C?"text-white/60":"text-gray-500"),children:["$",$t.toLocaleString("es-CO")]}):null,jt!==0&&$t>0&&aa>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",jt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[jt>0?"+":"",Math.abs(jt)>=1e3?`$${(jt/1e3).toFixed(1)}K`:`$${jt}`]})]})}return jsxRuntime.jsx(Tr,{value:ta>0?ta:void 0,isDark:C,locale:d,disabled:true,lens:w,hourlyRate:F})}let ge=P.status==="completed"||P.progress===100,Ge=P.effortMinutes||0,st=P.soldEffortMinutes||0,vt=G(P);if(w==="financial"&&vt&&Ge>0&&st>0){let ta=Math.round(Ge/60*vt),$t=Math.round(st/60*vt)-ta;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Tr,{value:Ge,onChange:aa=>ke({effortMinutes:aa}),isDark:C,locale:d,disabled:ge,lens:w,hourlyRate:G(P)}),$t!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",$t>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[$t>0?"+":"",Math.abs($t)>=1e3?`$${($t/1e3).toFixed(1)}K`:`$${$t}`]})]})}return jsxRuntime.jsx(Tr,{value:Ge,onChange:ta=>ke({effortMinutes:ta}),isDark:C,locale:d,disabled:ge,lens:w,hourlyRate:G(P)})}case "timeLoggedMinutes":{if(S&&P.subtasks&&P.subtasks.length>0){let{spent:Ge}=Kn(P);return jsxRuntime.jsx(Tr,{value:Ge>0?Ge:void 0,isDark:C,locale:d,disabled:true,lens:w,hourlyRate:G(P)})}let ge=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(Tr,{value:P.timeLoggedMinutes,onChange:a.onLogTime?Ge=>{a.onLogTime?.(P,Ge);}:void 0,isDark:C,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ge,lens:w,hourlyRate:G(P)})}case "soldEffortMinutes":{if(S&&P.subtasks&&P.subtasks.length>0){let{quoted:st}=Kn(P),vt=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Tr,{value:st>0?st:void 0,isDark:C,locale:d,disabled:true,isBlurred:vt,lens:w,hourlyRate:G(P)})}let ge=P.status==="completed"||P.progress===100,Ge=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Tr,{value:P.soldEffortMinutes,onChange:st=>ke({soldEffortMinutes:st}),isDark:C,locale:d,disabled:ge,isBlurred:Ge,lens:w,hourlyRate:G(P)})}case "scheduleVariance":{let ge=P.effortMinutes||0,Ge=P.soldEffortMinutes||0,st=P.timeLoggedMinutes||0,vt=ge>0||Ge>0||st>0;return jsxRuntime.jsx(fg,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:C,locale:d,hasTimeAllocated:vt})}case "hoursBar":{if(S&&P.hasChildren){let{spent:ge,allocated:Ge,quoted:st}=Kn(P),vt=ge>Ge&&Ge>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",C?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",vt?"text-[#FF453A]":C?"text-white/80":"text-gray-800"),children:_n(ge)}),Ge>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:C?"text-white/60":"text-gray-600",children:_n(Ge)})]}),st>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:C?"text-amber-400/70":"text-amber-600",children:_n(st)})]})]})}return jsxRuntime.jsx(hg,{task:P,isDark:C,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:G(P)})}case "teamLoad":return P.hasChildren||P.subtasks&&P.subtasks.length>0?jsxRuntime.jsx(xg,{task:P,isDark:C,locale:d}):jsxRuntime.jsx(qd,{value:P.assignees||[],availableUsers:l,onChange:Ge=>{a.onTaskUpdate?.({...P,assignees:Ge});},isDark:C,locale:d});case "blockers":return jsxRuntime.jsx(wg,{blockers:P.blockers,isDark:C,locale:d});case "weight":{let ge=K.get(P.id);if(ge!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",ge>0?C?"text-white/50":"text-gray-400":C?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ge>0?`${Number(ge.toFixed(2))}%`:"\u2014"});let Ge=P.weight||0;return jsxRuntime.jsx(lw,{value:Ge,onChange:st=>ke({weight:st}),isDark:C})}default:return jsxRuntime.jsx("span",{className:u("text-sm",C?"text-white/60":"text-gray-500"),children:"-"})}},[a,C,d,l,X,S,K]),Xn=react.useCallback(P=>{let ke={name:X.columns.name,status:X.columns.status,priority:X.columns.priority,assignees:X.columns.assignees,startDate:X.columns.startDate,endDate:X.columns.endDate,progress:X.columns.progress,tags:X.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:X.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:X.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:X.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:X.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:X.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:X.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:X.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:X.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:X.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:X.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:X.columns.weight||(d==="es"?"Peso":"Weight")}[P.type]||P.label;return typeof ke=="string"?ke:String(ke||P.type)},[X,d]),Ur=react.useMemo(()=>{let ke=Bt.reduce((Le,tt)=>Le+tt.width,0)+(h?48:0),xe={};for(let Le of Bt)xe[Le.id]=`${Le.width/ke*100}%`;return xe},[Bt,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",C?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",C?"text-white/60":"text-gray-600"),children:[X.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",C?"bg-[#0D0D0D]":"bg-white",s),style:n,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:u("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",C?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",C?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:X.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",C?"text-white/60":"text-gray-600"),children:X.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Fe,className:u(C?"bg-[#0D0D0D]":"bg-white",se&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",C?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",C?"text-white/60":"text-gray-600"),children:[Nr.length," ",X.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",C?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:ot,onChange:P=>ae(P.target.value),placeholder:X.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",C?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),y&&dt>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:Ue,onClick:()=>It(!mt),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",C?mt?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":mt?"bg-blue-50 border-blue-300 text-blue-600":"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"}),pt==="all"?d==="es"?"Todos":"All":`L${pt}`]}),mt&&jsxRuntime.jsx("div",{ref:Re,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",C?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(dt,5)},(P,oe)=>({value:oe+1,label:`L${oe+1}`}))].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{Et(P.value),It(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",C?pt===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":pt===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:P.label}),pt===P.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsxRuntime.jsx(Gg,{value:nt,hideCompleted:Ze,onChange:fe,onHideCompletedChange:xt,isDark:C,locale:d}),he?.enabled&&he.data&&!Xe&&jsxRuntime.jsx("button",{onClick:()=>H(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",C?"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:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,v&&T&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:T,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 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:X.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",C?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[it&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Bt.map(P=>{let oe=P.id!=="name",ke=ze===P.id&&Ke!==P.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",C?"text-white/60":"text-gray-500",oe&&"cursor-grab",P.type!=="name"&&"justify-center",Ke===P.id&&"opacity-50",ke&&(C?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Ur[P.id],minWidth:P.minWidth},draggable:oe,onDragStart:oe?xe=>at(xe,P.id):void 0,onDragEnd:oe?oa:void 0,onDragOver:oe?xe=>Ut(xe,P.id):void 0,onDragLeave:oe?Ua:void 0,onDrop:oe?xe=>ir(xe,P.id):void 0,onContextMenu:xe=>E(xe,void 0,P.id),children:[oe&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",C?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),P.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ua(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Xn(P),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",Ee===P.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Xn(P)}),f&&P.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",se===P.id&&"bg-[#007BFF]"),onMouseDown:xe=>_e(xe,P.id)})]},P.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),Tt(oe=>!oe);},className:u("p-0.5 rounded transition-colors",C?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",gt&&(C?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Og,{isOpen:gt,onClose:()=>Tt(false),columns:St,customFields:c,onColumnsChange:z,onCreateCustomField:()=>{Tt(false),O(true);},isDark:C,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Nr.map((P,oe)=>{let ke=wt.has(P.id),xe=Math.min(oe*.01,.2),Le=P.hasChildren&&P.level===0,tt=P.subtasks?.length||0;if(Le){let{spent:Gt,allocated:$t,quoted:aa}=Kn(P),jt=iw(P);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":P.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:xe},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",C?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",re===P.id&&(C?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(P),children:[it&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Bt.map(Ia=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Ia.type!=="name"&&"justify-center"),style:{width:Ur[Ia.id],minWidth:Ia.minWidth},children:Ia.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Dt=>{Dt.stopPropagation(),ga(P.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",C?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ke?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",C?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",C?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Dt=>{Dt.stopPropagation(),ga(P.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ke?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:C?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:C?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:C?"#FFD60A":"#B45309"},children:P.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",C?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:P.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",C?"text-white/30":"text-gray-500"),children:["(",tt," ",d==="es"?tt===1?"Tarea":"Tareas":tt===1?"Item":"Items",")"]}),jt!==null&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",jt>=1?"text-[#32D74B] bg-[#32D74B]/10":jt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",jt.toFixed(2)]})]})]}):Ia.type==="timeLoggedMinutes"?w==="financial"?(()=>{let Dt=Z(P),ur=Math.round(Dt.dollarSpent);return ur>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",C?"text-white/60":"text-gray-500"),children:["$",ur.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Tr,{value:Gt>0?Gt:void 0,isDark:C,locale:d,disabled:true,lens:w,hourlyRate:G(P)}):Ia.type==="soldEffortMinutes"?w==="financial"?(()=>{let Dt=Z(P),ur=Math.round(Dt.dollarQuoted);return ur>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",C?"text-white/60":"text-gray-500"),children:["$",ur.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Tr,{value:aa>0?aa:void 0,isDark:C,locale:d,disabled:true,lens:w,hourlyRate:G(P)}):Ia.type==="effortMinutes"?w==="financial"?(()=>{let Dt=Z(P),ur=Math.round(Dt.dollarAllocated),Co=Math.round(Dt.dollarQuoted),Ar=Co-ur;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[ur>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",C?"text-white/60":"text-gray-500"),children:["$",ur.toLocaleString("es-CO")]}):null,Ar!==0&&ur>0&&Co>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ar>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ar>0?"+":"",Math.abs(Ar)>=1e3?`$${(Ar/1e3).toFixed(1)}K`:`$${Ar}`]})]})})():jsxRuntime.jsx(Tr,{value:$t>0?$t:void 0,isDark:C,locale:d,disabled:true,lens:w,hourlyRate:G(P)}):Pr(P,Ia)},Ia.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)}let ge=V===P.id,Ge=ee===P.id,st=Ge&&ve==="above",vt=Ge&&ve==="below",ta=Ge&&ve==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":P.id,"data-listview-row":P.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:xe},className:u("flex items-center border-b transition-colors relative group",C?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",re===P.id&&(C?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:ge?.4:1,backgroundColor:ta?C?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:ta?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:Gt=>E(Gt,P),children:[st&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),vt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),it&&jsxRuntime.jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:Gt=>lt(P.id,Gt),style:{color:C?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Bt.map(Gt=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Gt.type!=="name"&&"justify-center"),style:{width:Ur[Gt.id],minWidth:Gt.minWidth},children:Gt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsxRuntime.jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsxRuntime.jsx("button",{onClick:$t=>{$t.stopPropagation(),ga(P.id);},className:u("p-0.5 rounded flex-shrink-0",C?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ke?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",C?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",C?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",C?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",C?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate",P.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",P.progress===100?C?"line-through text-white/50":"line-through text-gray-400":P.hasChildren?C?"text-white":"text-gray-900":C?"text-[#D1D5DB]":"text-gray-600"),children:P.name}),P.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Pr(P,Gt)},Gt.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),Y&&Nr.length>0&&(()=>{let{spent:P,allocated:oe,quoted:ke}=B,xe=oe-P,Le=xe<0,tt=Le?`+${_n(Math.abs(xe))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${_n(xe)} ${d==="es"?"AHORRADO":"SAVED"}`,ge=w==="financial"&&F>0,Ge=$?.spent!=null?$.spent:B.dollarSpent,st=$?.allocated!=null?$.allocated:B.dollarAllocated,vt=$?.quoted!=null?$.quoted:B.dollarQuoted,ta=(aa,jt)=>{if(ge){let Ia=jt??aa/60*F;return `$${Math.round(Ia).toLocaleString("es-CO")}`}return _n(aa)},Gt=ge?Math.abs(st-Ge):0,$t=ge?`${Le?"+":"-"}$${Gt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Le?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:tt;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",C?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:C?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[it&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Bt.map(aa=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3",aa.type!=="name"&&"justify-center"),style:{width:Ur[aa.id],minWidth:aa.minWidth},children:aa.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",C?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):aa.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:u("text-[12px] font-bold",C?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ta(P,ge?Ge:void 0)}),jsxRuntime.jsx("span",{className:u("text-[11px]",C?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",C?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ta(oe,ge?st:void 0)})]}),oe>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Le?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ge?$t:tt})]}):aa.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",C?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ke>0?ta(ke,ge?vt:void 0):"\u2013"}):aa.type==="effortMinutes"?(()=>{if(ge&&ke>0&&oe>0){let jt=Math.round(vt),Ia=Math.round(st),Dt=jt-Ia,ur=jt>0?Math.round(Dt/jt*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",C?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ta(oe,st)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Dt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Dt>=0?"+":"",Math.abs(Dt)>=1e3?`$${(Dt/1e3).toFixed(1)}K`:`$${Dt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",ur,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",C?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe>0?ta(oe,ge?st:void 0):"\u2013"})})():aa.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",C?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?ta(P,ge?Ge:void 0):"\u2013"}):aa.type==="progress"?(()=>{let jt=Jg(uc(e||[]));return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",C?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[jt,"%"]})})():aa.type==="weight"?(()=>{let jt=e||[],Ia=[],Dt=To=>{for(let No of To)Ia.push(No),No.subtasks?.length&&Dt(No.subtasks);};Dt(jt);let Co=Ia.filter(To=>!To.subtasks?.length||To.subtasks.length===0).reduce((To,No)=>To+(No.weight||0),0),Ar=Math.abs(Co-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",Ar?C?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Co.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",C?"text-white/30":"text-gray-300"),children:"\u2013"})},aa.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Nr.length===0&&ot&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",C?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(C?"text-white/60":"text-gray-600"),children:X.empty.noResults})]})})]})}),he?.enabled&&he.data&&Xe&&jsxRuntime.jsx(_g,{data:he.data,isDark:C,locale:d,onClose:()=>H(false),lens:t?.lens,onUnassignedTaskClick:P=>{let oe=document.querySelector(`[data-task-id="${P}"]`);oe&&(oe.scrollIntoView({behavior:"smooth",block:"center"}),Q(P),setTimeout(()=>Q(null),2e3));}})]}),jsxRuntime.jsx(Sg,{state:ie,onClose:me,isDark:C,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:et,onColumnSort:ye,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ne&&Me&&V&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Me.x+12,top:Me.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=De.flattenTasks(e).find(ke=>ke.id===V);return oe?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:C?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${C?"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:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:C?"#e6edf3":"#111827"},children:oe.name})]}):null})()}),document.body),jsxRuntime.jsx(zg,{isOpen:Qe,onClose:()=>O(false),onSave:Ta,isDark:C,locale:d})]})}var t0=[{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}],a0=[{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"}],r0=[{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 pc={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:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},mc={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:"#2E94FF"},gc={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"},Zi={dark:pc,light:mc,neutral:gc};function o0(e){return Zi[e]||Zi.dark}var fc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},bc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},el={en:fc,es:bc};function Ps(e){return el[e]||el.en}function tl(e,t){let a=Ps(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function n0(e){let t=Ps(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function s0(e,t=0,a=true){let r=Ps(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Ls(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function yc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function d0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var p0=26,bw=22,hw=10;function c0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function xc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function m0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function u0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function yw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",h=m?xc(c.effortMinutes,n,l):null,f=m?m0(c,n,l):null,b=m?c.blockers?.find(v=>v.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*p0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${bw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function g0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:v,timerState:T,onLogTime:D,onUpdateEstimate:N,onUpdateSoldEffort:k,onStartTimer:w,onStopTimer:F,onDiscardTimer:I,blurFinancials:S=false,suppressDetailModal:Y=false,lens:$="hours",hourlyRate:X=0}){let{theme:C="dark",locale:G="en",customTranslations:Z,showBacklog:$e=true}=t,B=tl(G,Z),K=C==="dark"||C==="neutral",[he,Xe]=react.useState(r||new Date),[H,re]=react.useState(null),[Q,Ee]=react.useState(null),[Te,Ie]=react.useState(null),[Be,ot]=react.useState({}),ae=3,nt=3,fe=react.useCallback(W=>{Ee(W.id),Y||re(W),h?.(W.id);},[Y,h]),[Ze,xt]=react.useState(null),St=react.useCallback(()=>{Xe(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),Ce=react.useCallback(()=>{Xe(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),gt=react.useCallback(()=>{Xe(new Date);},[]),Tt=react.useMemo(()=>{let W=he.getFullYear(),ee=he.getMonth(),je=new Date(W,ee,1),ve=new Date(W,ee+1,0),He=je.getDay(),Me=ve.getDate(),We=Ls(e),Nt=new Date;Nt.setHours(0,0,0,0);let ct=[],it=He,lt=new Date(W,ee,0).getDate();for(let zt=it-1;zt>=0;zt--){let pt=new Date(W,ee-1,lt-zt);ct.push({date:pt,isCurrentMonth:false,isToday:false,isWeekend:pt.getDay()===0||pt.getDay()===6,events:We.filter(Et=>yc(pt,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}for(let zt=1;zt<=Me;zt++){let pt=new Date(W,ee,zt),Et=pt.getTime()===Nt.getTime();ct.push({date:pt,isCurrentMonth:true,isToday:Et,isWeekend:pt.getDay()===0||pt.getDay()===6,events:We.filter(mt=>yc(pt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}let Vt=42-ct.length;for(let zt=1;zt<=Vt;zt++){let pt=new Date(W,ee+1,zt);ct.push({date:pt,isCurrentMonth:false,isToday:false,isWeekend:pt.getDay()===0||pt.getDay()===6,events:We.filter(Et=>yc(pt,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}return ct},[he,e]),Qe=react.useMemo(()=>Ls(e).filter(W=>!W.startDate||!W.endDate),[e]),O=react.useMemo(()=>{let W=Ls(e),ee=0,je=0,ve=0,He=0,Me=0;W.forEach(lt=>{lt.effortMinutes&&(ee+=lt.effortMinutes),lt.soldEffortMinutes&&(je+=lt.soldEffortMinutes),lt.scheduleVariance!=null&&(ve+=lt.scheduleVariance,He++),lt.soldEffortMinutes&&lt.effortMinutes&&(Me+=lt.soldEffortMinutes-lt.effortMinutes);});let We=je>0?Math.min(100,Math.round(ee/je*100)):0,Nt=He>0?Math.round(ve/He):0,it=`${Me<0?"-":"+"}${u0(Me,$,X)}`;return {budgetUtil:We,avgVariance:Nt,costDisplay:it,hasCostData:je>0}},[e,$,X]),ie=react.useMemo(()=>{let W=[0,0,0,0,0,0];return Tt.forEach((ee,je)=>{let ve=Math.floor(je/7);ee.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Me=new Date(He.task.startDate),We=ee.date;Me.getFullYear()===We.getFullYear()&&Me.getMonth()===We.getMonth()&&Me.getDate()===We.getDate()&&ve<W.length&&(W[ve]-=He.task.soldEffortMinutes);}});}),W},[Tt]),M=react.useMemo(()=>{let W=Ls(e),ee=new Map,je=new Set,ve=[0,0,0,0,0,0];if(Tt.length===0)return {segmentsByCell:ee,multiDayTaskIds:je,maxLanesPerRow:ve};let He=it=>new Date(it.getFullYear(),it.getMonth(),it.getDate()),Me=He(Tt[0].date),We=He(Tt[Tt.length-1].date),Nt=[];for(let it of W){if(!it.startDate||!it.endDate)continue;let lt=He(it.startDate),Vt=He(it.endDate);if(lt.getTime()===Vt.getTime()||Vt<Me||lt>We)continue;let zt=lt<Me?Me:lt,pt=Vt>We?We:Vt,Et=c0(zt,Me),mt=c0(pt,Me);Et<0||Et>41||mt<0||mt>41||Et!==mt&&(je.add(it.id),Nt.push({task:it,startIdx:Et,endIdx:mt}));}Nt.sort((it,lt)=>it.startIdx!==lt.startIdx?it.startIdx-lt.startIdx:lt.endIdx-lt.startIdx-(it.endIdx-it.startIdx));let ct=[[],[],[],[],[],[]];for(let{task:it,startIdx:lt,endIdx:Vt}of Nt){let zt=Math.floor(lt/7),pt=Math.floor(Vt/7),Et=He(it.startDate),mt=He(it.endDate),It=false;for(let Ue=zt;Ue<=pt;Ue++){let Re=Ue===zt?lt%7:0,dt=Ue===pt?Vt%7:6,se=dt-Re+1,ue=0,L=ct[Ue]??[];for(ct[Ue]||(ct[Ue]=L);ue<L.length&&(L[ue]??-1)>=Re;)ue++;if(ue>=hw){It=true;break}ue>=L.length?L.push(dt):L[ue]=dt,ve[Ue]=Math.max(ve[Ue]??0,ue+1);let _=Ue===zt&&Et>=Me,q=Ue===pt&&mt<=We,pe=Ue*7+Re,Fe={taskId:it.id,task:it,rowIndex:Ue,startCol:Re,endCol:dt,spanCols:se,lane:ue,isStart:_,isEnd:q};ee.has(pe)||ee.set(pe,[]),ee.get(pe).push(Fe);}It&&(je.delete(it.id),ee.forEach((Ue,Re)=>{let dt=Ue.filter(se=>se.taskId!==it.id);dt.length===0?ee.delete(Re):ee.set(Re,dt);}));}return {segmentsByCell:ee,multiDayTaskIds:je,maxLanesPerRow:ve}},[Tt,e]),V=G==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=he.toLocaleDateString(G==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ne=ce.charAt(0).toUpperCase()+ce.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",K?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",K?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",K?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",K?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",K?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",K?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",K?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",K?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",K?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",K?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",K?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",K?"bg-[#050505]":"bg-white",n),style:l,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",K?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",K?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",K?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",K?"text-white":"text-gray-900"),children:G==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",K?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:St,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",K?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",K?"text-white":"text-gray-900"),children:Ne}),jsxRuntime.jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",K?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",K?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:gt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",K?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",K?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:V.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",K?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",K?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:Tt.map((W,ee)=>{let je=ee%7===6,ve=ee>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!je&&(K?"border-r border-[#222]":"border-r border-gray-200"),!ve&&(K?"border-b border-[#222]":"border-b border-gray-200"),K?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&K&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!K&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?K?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?K?"text-white/60":"text-gray-900":K?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(ee/7),Me=(M.maxLanesPerRow[He]??0)*p0,We=M.segmentsByCell.get(ee);return Me===0&&!We?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Me}px`,zIndex:5},children:We?.map(Nt=>jsxRuntime.jsx(yw,{segment:Nt,isDark:K,blurFinancials:S,isSelected:Q===Nt.taskId,t:B,lens:$,hourlyRate:X,onClick:()=>{fe(Nt.task),a.onEventClick?.({id:Nt.task.id,title:Nt.task.name,start:Nt.task.startDate,end:Nt.task.endDate,task:Nt.task});}},Nt.taskId))})})(),(()=>{let He=W.events.filter(Me=>Me.task.isMilestone&&!M.multiDayTaskIds.has(Me.id));return He.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[He.slice(0,4).map(Me=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Me.title,onClick:We=>{We.stopPropagation(),fe(Me.task);}},Me.id)),He.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",K?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];W.events.forEach(We=>{We.task.blockers?.forEach(Nt=>{(Nt.severity==="warning"||Nt.severity==="critical")&&He.push({taskId:We.id,type:Nt.type,severity:Nt.severity,variance:We.task.scheduleVariance});});});let Me=He[0];return Me?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Me.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Me.type,Me.variance?` (+${Math.abs(Me.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let He=W.events.filter(ct=>!M.multiDayTaskIds.has(ct.id)),Me=Be[ee]||ae,We=He.slice(0,Me),Nt=He.length-Me;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[We.map(ct=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{fe(ct.task),a.onEventClick?.(ct);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ct.task.progress===100||ct.task.status==="completed"?K?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":K?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:K?ct.task.progress===100||ct.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ct.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",ct.task.isMilestone?K?"text-amber-400":"text-amber-600":ct.task.isCriticalPath?"text-red-400":K?"text-[#1264FF]":"text-gray-400"),children:ct.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ct.title})]},ct.id)),Nt>0&&jsxRuntime.jsxs("button",{onClick:ct=>{ct.stopPropagation(),ot(it=>({...it,[ee]:Me+nt}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",K?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",Nt," ",G==="es"?"m\xE1s":"more"]}),Me>ae&&He.length>ae&&jsxRuntime.jsx("button",{onClick:ct=>{ct.stopPropagation(),ot(it=>({...it,[ee]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",K?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:G==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=ee>=28,Me=ee%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:We=>{We.stopPropagation(),xt(Ze===ee?null:ee);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",Ze===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",K?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",Ze===ee&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze===ee&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>xt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",Me?"right-0":"left-0",K?"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(en,{onSubmit:We=>{a.onTaskCreate?.({name:We.name,startDate:We.startDate||W.date,endDate:We.endDate||W.date,priority:We.priority,assignees:We.assignee?[We.assignee]:void 0}),xt(null);},onCancel:()=>xt(null),availableUsers:t.availableUsers,isDark:K,locale:G==="es"?"es":"en",defaultDate:W.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let He=Math.floor(ee/7),Me=ie[He];if(!Me||Me===0)return null;let We=u0(Me,$,X);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Me<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Me<0?"-":"+",We]})})()]},ee)})})})]}),$e&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",K?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",K?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",K?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",K?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",K?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",K?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",K?"text-white/20":"text-gray-400"),children:G==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{fe(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",K?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",K?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",K?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(ee=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",K?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",K?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[xc(W.effortMinutes,$,X)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",xc(W.effortMinutes,$,X)]}),(()=>{let ee=m0(W,$,X);return ee?jsxRuntime.jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(d0,{task:W,isDark:K})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((ee,je)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},je))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",K?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",K?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),O.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",K?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",K?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",K?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",K?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[O.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",K?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${O.budgetUtil}%`,background:O.budgetUtil>90?"#EF4444":O.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",K?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",K?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",O.avgVariance>0?"text-emerald-400":O.avgVariance<0?"text-red-400":K?"text-white/50":"text-gray-600"),children:[O.avgVariance>0?"+":"",O.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",K?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",K?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",O.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:O.costDisplay})]})]})]})]})]}),!Y&&jsxRuntime.jsx(bo,{task:H,isOpen:!!H,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:C==="dark"?"dark":"light",locale:G,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:H?p?.get(H.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Ls(e).filter(W=>W.id!==H?.id),comments:d?.filter(W=>W.taskId===H?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:v,isTimerRunning:T?.isRunning,timerElapsedSeconds:T?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onSoldEffortUpdate:k,onTimerStart:w,onTimerStop:F,onTimerDiscard:I,blurFinancials:S}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",K?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",K?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",K?"text-white/90":"text-gray-900"),children:Te.date.toLocaleDateString(G==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",K?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Te.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(null),fe(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",K?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(d0,{task:W.task,isDark:K}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",K?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var vc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},wc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},kc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},ol={dark:vc,light:wc,neutral:kc};function f0(e){return ol[e]||ol.dark}function vw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,y=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,x=p.map(f=>f.priority).filter(Boolean),h=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,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:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var h0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Bs(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 Rs(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 y0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function x0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...h0,...n}),[n]),[i,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(v=>{let T=v.timestamp.toISOString().split("T")[0],D=b.get(T);D?D.push(v):b.set(T,[v]);}),Array.from(b.entries()).sort((v,T)=>T[0].localeCompare(v[0])).map(([v,T])=>({date:new Date(v),events:T.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,v=new Set;return e.forEach(T=>{b.add(T.userId),v.add(T.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(v)}},[e]),x=b=>{p(v=>{let T=new Set(v);return T.has(b)?T.delete(b):T.add(b),T});},h=b=>{let T=new Date().getTime()-b.getTime(),D=Math.floor(T/6e4),N=Math.floor(T/36e5),k=Math.floor(T/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Rs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((v,T)=>{let D=i.has(v.id),N=s===v.id,k=y0(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:u("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Rs(v.type)})}),T<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Bs(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),x(v.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([w,F])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(F.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(F.to)})]})]},w)),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([w,F])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(F)})]},w))]})]})]})]},v.id)})})]},b.date?.toISOString()||"all"))})]})}function w0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Rs(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Bs(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:Bs(g)},g.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:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",i),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 Cc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Tc(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 k0(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 C0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Dw(e,t,a,r,o,s=100){let n=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})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(m-p.y)*o.centerForce*i,n.forEach(g=>{if(p.id===g.id)return;let y=p.x-g.x,x=p.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*i/(h*h);p.vx+=y/h*f,p.vy+=x/h*f;});}),t.forEach(p=>{let d=l.get(typeof p.source=="string"?p.source:p.source.id),m=l.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,y=m.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*i;d.vx+=g*h,d.vy+=y*h,m.vx-=g*h,m.vy-=y*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function T0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,v]=react.useState(1),[T,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=Dw(e,t,a.width,a.height,a,150);d($);},[e,t,a]);let N=react.useCallback(($,X)=>{a.enableDragging&&(X.stopPropagation(),g($));},[a.enableDragging]),k=react.useCallback($=>{if(!m||!i.current)return;let C=i.current.getBoundingClientRect(),G=($.clientX-C.left-T.x)/b,Z=($.clientY-C.top-T.y)/b;d($e=>$e.map(B=>B.id===m?{...B,x:G,y:Z,fx:G,fy:Z}:B));},[m,b,T]),w=react.useCallback(()=>{g(null);},[]),F=react.useCallback(($,X)=>{X.stopPropagation(),l?.({type:"node-click",node:$,position:{x:X.clientX,y:X.clientY}});},[l]),I=react.useCallback(($,X)=>{X.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:X.clientX,y:X.clientY}});},[l]),S=react.useCallback($=>{let X=p.find(C=>C.id===$);return X?{x:X.x,y:X.y}:{x:0,y:0}},[p]),Y=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let X=$.card.priority;return X==="URGENT"?"#ef4444":X==="HIGH"?"#f59e0b":X==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("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:u("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:n.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:n.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:()=>v($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),D({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:Cc($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[k0($)," ",Tc($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let X=S(typeof $.source=="string"?$.source:$.source.id),C=S(typeof $.target=="string"?$.target:$.target.id),G=C0($.type),Z=h===$.id,$e=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",$e&&"critical"),onMouseEnter:()=>f($.id),onMouseLeave:()=>f(null),onClick:B=>I($,B),children:[jsxRuntime.jsx("line",{x1:X.x,y1:X.y,x2:C.x,y2:C.y,stroke:Cc($.type),strokeWidth:$e?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:G?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsxRuntime.jsx("text",{x:(X.x+C.x)/2,y:(X.y+C.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Tc($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let X=y===$.id,C=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",X&&"hovered",C&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:G=>N($.id,G),onMouseEnter:()=>x($.id),onMouseLeave:()=>x(null),onClick:G=>F($,G),children:[jsxRuntime.jsx("circle",{r:C?a.nodeSize*1.2:a.nodeSize,fill:Y($),stroke:C?"#fbbf24":"#ffffff",strokeWidth:C?3:2,opacity:X?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 S0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),y=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=v=>{v.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),p(null),m(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),p(null),m(null);try{let b=await r(s.trim());m(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,v)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},v)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,v)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Nc={"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 Ew={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mw={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 Fw(e,t,a){let r=Nc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Os(e){return `$${e.toFixed(4)}`}var Dc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Fw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},un=new Dc;function F0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(un.getStats()),[s,n]=react.useState(un.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(un.getStats()),n(un.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=un.getRecentOperations(5);return jsxRuntime.jsxs(Jt,{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-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[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:Os(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?i/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:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Os(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Os(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 L0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,v]=react.useState(null),T=react.useRef(null),D=m||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let I=S=>{S.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),x(null),f(null),v(null),t());},k=async()=>{if(!(!n.trim()||D)){g(true),x(null),f(null),v(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f(I.tasks.tasks),v({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},w=()=>{h&&(a(h),N());};if(!e)return null;let F=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.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"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",F,"% 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:[b?.tokens_used||0," tokens"]}),b?.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:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((I,S)=>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:["#",S+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:T,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),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:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),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:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,S)=>jsxRuntime.jsx("button",{onClick:()=>l(I),disabled:D,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:I},S))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function il({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&qs(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,v)=>{console.warn(`Retry attempt ${b} after ${v}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(v=>{let T=v.cards.find(I=>I.id===h);if(!T)return v;let D=T.columnId,N={...T,columnId:f,position:b},k=v.cards.map(I=>I.id===h?N:I),w=v.columns.map(I=>{if(I.id===D)return {...I,cardIds:I.cardIds.filter(S=>S!==h)};if(I.id===f){let S=k.filter(Y=>Y.columnId===f).sort((Y,$)=>Y.position-$.position);return {...I,cardIds:S.map(Y=>Y.id)}}return I}),F={...v,cards:k,columns:w};return o(F),F});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let v=b.cards.map(D=>D.id===h?{...D,...f}:D),T={...b,cards:v};return o(T),T});},[o]),l=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...h,id:f},T=b.columns.map(N=>N.id===h.columnId?{...N,cardIds:[...N.cardIds,f]}:N),D={...b,cards:[...b.cards,v],columns:T};return o(D),D});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(N=>N.id===h);if(!b)return f;let v=f.cards.filter(N=>N.id!==h),T=f.columns.map(N=>N.id===b.columnId?{...N,cardIds:N.cardIds.filter(k=>k!==h)}:N),D={...f,cards:v,columns:T};return o(D),D});},[o]),i=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...h,id:f,cardIds:[]},T={...b,columns:[...b.columns,v]};return o(T),T});},[o]),p=react.useCallback(async(h,f)=>{r(b=>{let v=b.columns.map(D=>D.id===h?{...D,...f}:D),T={...b,columns:v};return o(T),T});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(D=>D.columnId!==h),v=f.columns.filter(D=>D.id!==h),T={...f,cards:b,columns:v};return o(T),T});},[o]),m=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function B0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=il({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,p={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var $s={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},O0={by:"none",order:"asc"};function $0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...$s,...e}),[s,n]=react.useState({...O0,...t}),l=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),i=react.useCallback(()=>{o($s),n(O0);},[]),p=react.useCallback(()=>{a&&o({...$s,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...$s,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...$s,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),v=String(f.getMonth()+1).padStart(2,"0"),T=String(f.getDate()).padStart(2,"0"),D=`${b}-${v}-${T}`;h=h.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let k=N.endDate||N.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let F=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),S=String(k.getUTCDate()).padStart(2,"0");w=`${F}-${I}-${S}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let F=new Date(D+"T00:00:00"),I=new Date(w+"T00:00:00"),S=new Date(F);return S.setDate(S.getDate()+7),I>=F&&I<=S;case "custom":if(r.dateRange){let Y=typeof k=="string"?new Date(k):k;return Y>=r.dateRange.start&&Y<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let v=0;switch(s.by){case "created":let T=f.createdAt?new Date(f.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;v=T-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=N[f.priority||"LOW"],w=N[b.priority||"LOW"];v=k-w;break;case "dueDate":let F=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!F)return 1;if(!I)return -1;let S=typeof F=="string"?new Date(F).getTime():F.getTime(),Y=typeof I=="string"?new Date(I).getTime():I.getTime();v=S-Y;break;case "title":v=f.title.localeCompare(b.title);break;case "estimate":let $=f.estimatedTime||0,X=b.estimatedTime||0;v=$-X;break;default:v=0;}return s.order==="asc"?v:-v}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var z0,U0;if(typeof window<"u")try{let e=js("ai");z0=e.generateObject,U0=e.generateText;}catch{}function W0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(z0&&U0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Ec(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function V0(e){let{cards:t}=e,[a,r]=Ec(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(w=>w.columnId===x.columnId).sort((w,F)=>w.position-F.position),b=f.findIndex(w=>w.id===a.lastSelectedCardId),v=f.findIndex(w=>w.id===d),[T,D]=b<v?[b,v]:[v,b],N=f.slice(T,D+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:p}}var G0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function j0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...G0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((x,h,f,b,v)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:v,isExpanded:true,position:s.filter(D=>D.columnId===f).length,createdAt:new Date};n(D=>[...D,T]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),i=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let v=b.cardIds.filter(T=>T!==h);return v.length<o.minCardsPerStack?null:{...b,cardIds:v}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),m=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(D=>D.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let v=new Map;h.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{v.has(N)||v.set(N,[]),v.get(N).push(D);});}),v.forEach((D,N)=>{D.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(h.forEach(D=>{D.priority&&(T.has(D.priority)||T.set(D.priority,[]),T.get(D.priority).push(D));}),T.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${N} Priority`,cardIds:D.map(w=>w.id),columnId:x,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of h){let k=(await r.findSimilar(D,h)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[D.id,...k.map(I=>I.card.id)],F=k.reduce((I,S)=>I+S.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:F});}}return f.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var _0=react.createContext(null);function K0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=js("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=js("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=js("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(_0.Provider,{value:{store:o},children:e})}function ll(){let e=react.useContext(_0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function zs(){let e=ll(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),i=react.useCallback((b,v)=>{e.updateColumn(b,v);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),m=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,v)=>{e.updateCard(b,v);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,v,T)=>{e.moveCard(b,v,T);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function Y0(e){let{cards:t}=zs();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!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(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function X0(e="position",t="asc"){let{cards:a}=zs();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var dl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=lu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Kw=new dl;function Q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Z0(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 tf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:l}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:m.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function af(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 rf(e,t=10){return e>t}var Ac={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Bc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Oc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$c={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Hc={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)"},zc={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)"},Uc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wc={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}},Vc={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}},cl={spacing:Ac,borderRadius:Lc,fontSize:Ic,fontWeight:Bc,lineHeight:Rc,zIndex:Oc,duration:$c,easing:Hc,shadows:zc,opacity:Uc,kanban:Wc,gantt:Vc};function of(e,t,a){return e[t]??a}function Gc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Gc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Xw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function jc(e="asakaa"){let t=Gc(cl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Xw(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
- }`}function $s(e,t="asakaa"){let a=[],r=Wc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
416
+ }`}function Us(e,t="asakaa"){let a=[],r=Gc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
417
417
  ${a.join(`
418
418
  `)}
419
- }`}var ll={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Gc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},jc={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function _c(e=ll,t="asakaa"){let a=Vc(t),r=$s(e,t);return `${a}
419
+ }`}var ul={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},_c={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Kc={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function qc(e=ul,t="asakaa"){let a=jc(t),r=Us(e,t);return `${a}
420
420
 
421
- ${r}`}function of(){return `/**
421
+ ${r}`}function nf(){return `/**
422
422
  * ASAKAA Design Tokens
423
423
  * Auto-generated from design-tokens.ts
424
424
  * Do not edit this file directly
425
425
  */
426
426
 
427
- ${_c(ll)}
427
+ ${qc(ul)}
428
428
 
429
429
  /* Light theme */
430
430
  [data-theme="light"] {
431
- ${$s(Gc,"asakaa").split(`
431
+ ${Us(_c,"asakaa").split(`
432
432
  `).slice(1,-1).join(`
433
433
  `)}
434
434
  }
435
435
 
436
436
  /* Neutral theme */
437
437
  [data-theme="neutral"] {
438
- ${$s(jc,"asakaa").split(`
438
+ ${Us(Kc,"asakaa").split(`
439
439
  `).slice(1,-1).join(`
440
440
  `)}
441
441
  }
442
- `}var Jw=({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 nf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=En();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let c=n,i=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Jw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
443
- 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=M0;exports.AI_FEATURES=Mw;exports.AI_MODELS=Cc;exports.AddCardButton=jl;exports.AddColumnButton=zl;exports.AttachmentUploader=so;exports.BoardProvider=_0;exports.BulkOperationsToolbar=gi;exports.BurnDownChart=rd;exports.CUSTOM_FIELD_TYPES=a0;exports.CalendarBoard=m0;exports.Card=go;exports.CardDetailModal=Jl;exports.CardDetailModalV2=ed;exports.CardHistoryReplay=v0;exports.CardHistoryTimeline=y0;exports.CardRelationshipsGraph=C0;exports.CardStack=vw;exports.CardTemplateSelector=cd;exports.CircuitBreaker=xl;exports.Column=wn;exports.ColumnManager=vi;exports.CommandPalette=ql;exports.ConfigMenu=gd;exports.ContextMenu=An;exports.DEFAULT_SHORTCUTS=cs;exports.DEFAULT_TABLE_COLUMNS=e0;exports.DEFAULT_TEMPLATES=dd;exports.DateRangePicker=Xn;exports.DependenciesSelector=Qn;exports.DependencyLine=hs;exports.DistributionCharts=od;exports.EditableColumnTitle=Sl;exports.ErrorBoundary=Tn;exports.ExportDropdown=Zp;exports.ExportImportModal=pd;exports.FilterBar=md;exports.GANTT_AI_SYSTEM_PROMPT=Am;exports.GanttAIAssistant=Bi;exports.GanttBoard=Em;exports.GanttI18nContext=Fn;exports.GanttMilestone=Fi;exports.GanttToolbar=xi;exports.GenerateGanttTasksDialog=A0;exports.GeneratePlanModal=D0;exports.GroupBySelector=id;exports.HealthBar=Ll;exports.KanbanBoard=Fo;exports.KanbanToolbar=$l;exports.KanbanViewAdapter=is;exports.KeyboardShortcutsHelp=ld;exports.ListView=Zg;exports.MenuIcons=ca;exports.PluginManager=sl;exports.PrioritySelector=Ko;exports.ProfitabilityReport=Il;exports.QuickTaskCreate=Qo;exports.RATE_LIMITS=Ew;exports.STANDARD_FIELDS=t0;exports.SwimlaneBoardView=nd;exports.TagBadge=Ml;exports.TagList=Gu;exports.TagPicker=So;exports.TaskBar=Ni;exports.TaskDetailModal=bo;exports.TaskFormModal=Pm;exports.TaskGrid=ki;exports.ThemeModal=yd;exports.ThemeProvider=Up;exports.ThemeSwitcher=nf;exports.TimeInputPopover=ro;exports.TimePill=Fl;exports.TimePopover=Pl;exports.Timeline=Ai;exports.UserAssignmentSelector=Yo;exports.VelocityChart=ad;exports.VirtualGrid=ef;exports.VirtualList=J0;exports.aiUsageTracker=dn;exports.borderRadius=Pc;exports.calculatePosition=Gs;exports.calendarDarkTheme=yc;exports.calendarEnTranslations=mc;exports.calendarEsTranslations=gc;exports.calendarLightTheme=xc;exports.calendarNeutralTheme=vc;exports.calendarThemes=tl;exports.calendarTranslations=Ji;exports.cardToGanttTask=$i;exports.cardsToGanttTasks=Hm;exports.cn=u;exports.createKanbanView=vp;exports.createRetryWrapper=Of;exports.darkTheme=fd;exports.darkTokenTheme=ll;exports.defaultTheme=bi;exports.designTokens=il;exports.duration=Rc;exports.easing=Oc;exports.exportTokensToCSS=of;exports.findTaskByName=wo;exports.fontSize=Ac;exports.fontWeight=Lc;exports.formatCost=Is;exports.ganttEnTranslations=yi;exports.ganttEsTranslations=Vp;exports.ganttTaskToCardUpdate=$m;exports.ganttThemes=ft;exports.ganttTokens=Uc;exports.ganttTranslations=xd;exports.ganttUtils=Se;exports.generateCSSVariables=Vc;exports.generateCompleteCSS=_c;exports.generateInitialPositions=Lf;exports.generateTasksContext=Lm;exports.generateThemeVariables=$s;exports.getCalendarTheme=g0;exports.getCalendarTranslations=Es;exports.getListViewTheme=r0;exports.getListViewTranslations=Wd;exports.getMonthNames=o0;exports.getToken=rf;exports.getTranslations=Gp;exports.getWeekdayNames=n0;exports.kanbanTokens=zc;exports.lightTheme=bd;exports.lightTokenTheme=Gc;exports.lineHeight=Ic;exports.listViewDarkTheme=cc;exports.listViewEnTranslations=zd;exports.listViewEsTranslations=Ud;exports.listViewLightTheme=uc;exports.listViewNeutralTheme=pc;exports.listViewThemes=Xi;exports.listViewTranslations=Hi;exports.mergeCalendarTranslations=Qi;exports.mergeListViewTranslations=zi;exports.mergeTranslations=vd;exports.neutralTheme=hd;exports.neutralTokenTheme=jc;exports.opacity=Hc;exports.parseLocalCommand=Rm;exports.parseNaturalDate=Od;exports.parseNaturalDuration=$d;exports.parseProgress=Hd;exports.parseStatus=Bm;exports.pluginManager=Kw;exports.retrySyncOperation=Rf;exports.retryWithBackoff=js;exports.shadows=$c;exports.shouldVirtualizeGrid=af;exports.spacing=Fc;exports.themes=tn;exports.useAI=U0;exports.useBoard=I0;exports.useBoardCore=Os;exports.useBoardStore=nl;exports.useCardStacking=G0;exports.useDragState=Rl;exports.useFilteredCards=q0;exports.useFilters=O0;exports.useGanttI18n=Br;exports.useKanbanState=ol;exports.useKeyboardShortcuts=$p;exports.useMultiSelect=W0;exports.useSelectionState=Dc;exports.useSortedCards=Y0;exports.useTheme=En;exports.useVirtualGrid=tf;exports.useVirtualList=Q0;exports.validateAIResponse=Om;exports.withErrorBoundary=_l;exports.wouldCreateCircularDependency=Ks;exports.zIndex=Bc;//# sourceMappingURL=index.cjs.map
442
+ `}var Jw=({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 sf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Fn();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let c=n,i=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Jw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
443
+ 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=F0;exports.AI_FEATURES=Mw;exports.AI_MODELS=Nc;exports.AddCardButton=Kl;exports.AddColumnButton=Wl;exports.AttachmentUploader=io;exports.BoardProvider=K0;exports.BulkOperationsToolbar=hi;exports.BurnDownChart=nd;exports.CUSTOM_FIELD_TYPES=r0;exports.CalendarBoard=g0;exports.Card=go;exports.CardDetailModal=Zl;exports.CardDetailModalV2=ad;exports.CardHistoryReplay=w0;exports.CardHistoryTimeline=x0;exports.CardRelationshipsGraph=T0;exports.CardStack=vw;exports.CardTemplateSelector=pd;exports.CircuitBreaker=wl;exports.Column=Cn;exports.ColumnManager=Ci;exports.CommandPalette=Xl;exports.ConfigMenu=bd;exports.ContextMenu=In;exports.DEFAULT_SHORTCUTS=ms;exports.DEFAULT_TABLE_COLUMNS=t0;exports.DEFAULT_TEMPLATES=ud;exports.DateRangePicker=Zn;exports.DependenciesSelector=ts;exports.DependencyLine=vs;exports.DistributionCharts=sd;exports.EditableColumnTitle=Ml;exports.ErrorBoundary=Dn;exports.ExportDropdown=em;exports.ExportImportModal=gd;exports.FilterBar=fd;exports.GANTT_AI_SYSTEM_PROMPT=Lm;exports.GanttAIAssistant=$i;exports.GanttBoard=Mm;exports.GanttI18nContext=An;exports.GanttMilestone=Li;exports.GanttToolbar=ki;exports.GenerateGanttTasksDialog=L0;exports.GeneratePlanModal=S0;exports.GroupBySelector=dd;exports.HealthBar=Bl;exports.KanbanBoard=Lo;exports.KanbanToolbar=zl;exports.KanbanViewAdapter=cs;exports.KeyboardShortcutsHelp=cd;exports.ListView=e0;exports.MenuIcons=ca;exports.PluginManager=dl;exports.PrioritySelector=Yo;exports.ProfitabilityReport=Rl;exports.QuickTaskCreate=en;exports.RATE_LIMITS=Ew;exports.STANDARD_FIELDS=a0;exports.SwimlaneBoardView=id;exports.TagBadge=Pl;exports.TagList=ju;exports.TagPicker=Fo;exports.TaskBar=Ei;exports.TaskDetailModal=bo;exports.TaskFormModal=Am;exports.TaskGrid=Ni;exports.ThemeModal=vd;exports.ThemeProvider=Wp;exports.ThemeSwitcher=sf;exports.TimeInputPopover=oo;exports.TimePill=Al;exports.TimePopover=Ll;exports.Timeline=Bi;exports.UserAssignmentSelector=Jo;exports.VelocityChart=od;exports.VirtualGrid=tf;exports.VirtualList=Q0;exports.aiUsageTracker=un;exports.borderRadius=Lc;exports.calculatePosition=Ks;exports.calendarDarkTheme=vc;exports.calendarEnTranslations=fc;exports.calendarEsTranslations=bc;exports.calendarLightTheme=wc;exports.calendarNeutralTheme=kc;exports.calendarThemes=ol;exports.calendarTranslations=el;exports.cardToGanttTask=Ui;exports.cardsToGanttTasks=zm;exports.cn=u;exports.createKanbanView=wp;exports.createRetryWrapper=Of;exports.darkTheme=hd;exports.darkTokenTheme=ul;exports.defaultTheme=xi;exports.designTokens=cl;exports.duration=$c;exports.easing=Hc;exports.exportTokensToCSS=nf;exports.findTaskByName=wo;exports.fontSize=Ic;exports.fontWeight=Bc;exports.formatCost=Os;exports.ganttEnTranslations=wi;exports.ganttEsTranslations=Gp;exports.ganttTaskToCardUpdate=Hm;exports.ganttThemes=ft;exports.ganttTokens=Vc;exports.ganttTranslations=wd;exports.ganttUtils=De;exports.generateCSSVariables=jc;exports.generateCompleteCSS=qc;exports.generateInitialPositions=Lf;exports.generateTasksContext=Im;exports.generateThemeVariables=Us;exports.getCalendarTheme=f0;exports.getCalendarTranslations=Ps;exports.getListViewTheme=o0;exports.getListViewTranslations=Gd;exports.getMonthNames=n0;exports.getToken=of;exports.getTranslations=jp;exports.getWeekdayNames=s0;exports.kanbanTokens=Wc;exports.lightTheme=yd;exports.lightTokenTheme=_c;exports.lineHeight=Rc;exports.listViewDarkTheme=pc;exports.listViewEnTranslations=Wd;exports.listViewEsTranslations=Vd;exports.listViewLightTheme=mc;exports.listViewNeutralTheme=gc;exports.listViewThemes=Zi;exports.listViewTranslations=Wi;exports.mergeCalendarTranslations=tl;exports.mergeListViewTranslations=Vi;exports.mergeTranslations=kd;exports.neutralTheme=xd;exports.neutralTokenTheme=Kc;exports.opacity=Uc;exports.parseLocalCommand=Om;exports.parseNaturalDate=Hd;exports.parseNaturalDuration=zd;exports.parseProgress=Ud;exports.parseStatus=Rm;exports.pluginManager=Kw;exports.retrySyncOperation=Rf;exports.retryWithBackoff=qs;exports.shadows=zc;exports.shouldVirtualizeGrid=rf;exports.spacing=Ac;exports.themes=rn;exports.useAI=W0;exports.useBoard=B0;exports.useBoardCore=zs;exports.useBoardStore=ll;exports.useCardStacking=j0;exports.useDragState=$l;exports.useFilteredCards=Y0;exports.useFilters=$0;exports.useGanttI18n=Or;exports.useKanbanState=il;exports.useKeyboardShortcuts=Hp;exports.useMultiSelect=V0;exports.useSelectionState=Ec;exports.useSortedCards=X0;exports.useTheme=Fn;exports.useVirtualGrid=af;exports.useVirtualList=Z0;exports.validateAIResponse=$m;exports.withErrorBoundary=ql;exports.wouldCreateCircularDependency=Xs;exports.zIndex=Oc;//# sourceMappingURL=index.cjs.map
444
444
  //# sourceMappingURL=index.cjs.map