@libxai/board 1.8.1 → 1.8.2

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
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'),jf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),uy=require('react-markdown'),py=require('remark-gfm'),my=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var jf__default=/*#__PURE__*/_interopDefault(jf);var uy__default=/*#__PURE__*/_interopDefault(uy);var py__default=/*#__PURE__*/_interopDefault(py);var my__default=/*#__PURE__*/_interopDefault(my);var Ys=(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 Xs=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 [Xs.Translate.toString(e),Xs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Js(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 zf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Tl(e,t){return e.length===0?1e3:t===0?Js(null,e[0].position):t>=e.length?Js(e[e.length-1].position,null):Js(e[t-1].position,e[t].position)}function uu(e,t=100){return e>t}var Uf=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 Wf(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=Uf,onRetry:l}=t,d,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(p){if(d=p,u===a||!n(d,u))return {error:d,attempts:i,success:false};let g=Wf(u,r,o,s);if(l)try{l(d,u,g);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,g));}}return {error:d||new Error("Unknown error"),attempts:i,success:false}}function Vf(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 Gf(e,t={}){return async(...a)=>Qs(()=>e(...a),t)}var Nl=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 pu=(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))(pu||{}),en=class en{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,d=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,d?n:"");break;case "INFO":console.info(l,o,d?n:"");break;case "WARN":console.warn(l,o,d?n:"");break;case "ERROR":console.error(l,o,d?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",...en.globalOptions};}static configure(t){en.globalOptions={...en.globalOptions,...t};}child(t){return new en({...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 Zs((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Zs(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:pu[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};en.globalOptions={};var Dl=en,Zs=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}},mu=new Dl;function _f(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 Kf(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,Sl(s.title),Sl(s.description||""),Sl(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
2
  `)}async function qf(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 jf__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"),d=297,i=210,u=n.width/n.height,p=d-20,m=p/u;m>i-20&&(m=i-20,p=m*u);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,d,15,"F"),g.text(e.title||"Kanban Board",10,10);let f=(d-p)/2;return g.addImage(l,"PNG",f,20,p,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(d=>d.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(d=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(d.title,25,s),s+=6,d.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(d.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let u=[];d.startDate&&u.push(`Start: ${d.startDate}`),d.endDate&&u.push(`End: ${d.endDate}`),i.push(u.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 Sl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function fu(e,t,a,r){switch(t){case "json":return _f(e,r);case "csv":return Kf(e);case "pdf":return await qf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function bu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),d=URL.createObjectURL(l),i=document.createElement("a");i.href=d,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);}function Yf(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 Xf(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=hu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=hu(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,f)=>{i[g]=l[f]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let p=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),p.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 hu(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 yu(e,t){switch(t){case "json":return Yf(e);case "csv":return Xf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function xu(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 El=react.createContext(null);function vu(){return react.useContext(El)}var wu=react.createContext(null);function ku({children:e,themeName:t}){return jsxRuntime.jsx(wu.Provider,{value:{themeName:t},children:e})}function Nn(){return react.useContext(wu)}function ta({children:e,container:t}){let[a,r]=react.useState(false),o=vu(),s=Nn();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:d}=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":d,"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 Su={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ob="#BDC3C7",nb=({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 tn({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),d=react.useRef(null),i=()=>{if(!d.current)return;let g=d.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=g.right-y;v<10&&(v=g.left),v+y>x-10&&(v=x-y-10);let C=f-g.bottom,N=g.top,S;C>=b+h?S=g.bottom+h:N>=b+h?S=g.top-b-h:S=C>=N?g.bottom+h:Math.max(10,g.top-b-h),n({top:S,left:v}),o(true);};react.useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&!d.current?.contains(f.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},p=e?Su[e]:null,m=p?.color||ob;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:d,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:p?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ta,{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(Su).map(([g,f])=>jsxRuntime.jsxs("button",{onClick:()=>u(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:f.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(nb,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 sb=[{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 ns({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),m=(Nn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,S=320,M=380,k=4,P=v.left;P+S>N-10&&(P=N-S-10),P<10&&(P=10);let A=C-v.bottom,w=v.top,_;A>=M+k?_=v.bottom+k:w>=M+k?_=v.top-M-k:_=A>=w?v.bottom+k:Math.max(10,v.top-M-k),l({top:_,left:P}),s(true);};react.useEffect(()=>{let v=C=>{d.current&&!d.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 f=v=>{let C=new Date,N=P=>{let A=P.getFullYear(),w=String(P.getMonth()+1).padStart(2,"0"),_=String(P.getDate()).padStart(2,"0");return `${A}-${w}-${_}`},S=N(C),M=new Date(C);M.setDate(M.getDate()+v);let k=N(M);a(S,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=M=>{if(M instanceof Date)return M;if(typeof M!="string"||!M.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=M.split("-").map(Number);if(k.length!==3||k.some(_=>isNaN(_)))return null;let P=k[0],A=k[1],w=k[2];return P===void 0||A===void 0||w===void 0?null:new Date(P,A-1,w)},C=v(e),N=v(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[C.getMonth()]} ${C.getDate()} \u2013 ${S[N.getMonth()]} ${N.getDate()}`},y=e&&t,h=(()=>{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 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${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(ta,{children:jsxRuntime.jsxs("div",{ref:d,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:sb.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color: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 rn({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,d]=react.useState(""),[i,u]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,N=300,S=380,M=4,k=h.right-N;k<10&&(k=h.left),k+N>C-10&&(k=C-N-10);let P=v-h.bottom,A=h.top,w;P>=S+M?w=h.bottom+M:A>=S+M?w=h.top-S-M:w=P>=A?h.bottom+M:Math.max(10,h.top-S-M),u({top:w,left:k}),n(true);};react.useEffect(()=>{let h=v=>{p.current&&!p.current.contains(v.target)&&!m.current?.contains(v.target)&&(n(false),d(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&(n(false),d(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let v=e.some(C=>C.id===h.id);a(v?e.filter(C=>C.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),y=e.slice(0,o),b=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:[y.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(ta,{children:jsxRuntime.jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),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(h=>{let v=e.some(C=>C.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>f(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter: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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),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:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},h.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 ei(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(d.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=d=>{if(!s.has(d)){s.add(d),n.add(d);let i=r.get(d)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(n.has(u))return true}}return n.delete(d),false};return l(a)}function is({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,d]=react.useState(false),[i,u]=react.useState(""),[p,m]=react.useState(t.length>0),[g,f]=react.useState({top:0,left:0}),[x,y]=react.useState(null),b=react.useRef(null),h=react.useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),P=window.innerHeight,A=window.innerWidth,w=300,_=p?380:120,U=4,ae=k.right-w;ae<10&&(ae=k.left),ae+w>A-10&&(ae=A-w-10);let L=P-k.bottom,K=k.top,q;L>=_+U?q=k.bottom+U:K>=_+U?q=k.top-_-U:q=L>=K?k.bottom+U:Math.max(10,k.top-_-U),f({top:q,left:ae}),d(true);};react.useEffect(()=>{if(!l||!h.current)return;let k=h.current.getBoundingClientRect(),P=window.innerHeight,A=window.innerWidth,w=300,_=p?380:120,U=4,ae=k.right-w;ae<10&&(ae=k.left),ae+w>A-10&&(ae=A-w-10);let L=P-k.bottom,K=k.top,q;L>=_+U?q=k.bottom+U:K>=_+U?q=k.top-_-U:q=L>=K?k.bottom+U:Math.max(10,k.top-_-U),f({top:q,left:ae});},[p,l]),react.useEffect(()=>{let k=P=>{b.current&&!b.current.contains(P.target)&&!h.current?.contains(P.target)&&(d(false),u(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=P=>{P.key==="Escape"&&(d(false),u(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let C=k=>{let P=t.includes(k),A=a.find(w=>w.id===k);if(y(null),P){let w=t.filter(_=>_!==k);r(w),w.length===0&&m(false);}else {if(s&&ei(a,k,e)){let _=`Cannot add "${A?.title||k}" as dependency - would create circular reference`;y(_),n?.(k,A?.title||k),setTimeout(()=>y(null),3e3);return}r([...t,k]),m(true);}},N=()=>{let k=!p;m(k),k||r([]);},S=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),M=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?d(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:M,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:M},children:t.length})]}),l&&jsxRuntime.jsx(ta,{children:jsxRuntime.jsxs("div",{ref:b,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:p?"#3b82f6":"transparent",borderColor:p?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:k=>u(k.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:S.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"}):S.map(k=>{let P=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>C(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.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:P?"#3b82f6":"transparent",borderColor:P?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:P&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.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:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.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),d(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 yo=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:m,transition:g,isDragging:f}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Xs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:p,style:x,...i,...u,onClick:()=>a?.(e),children:t(e)});let y=l.filter(C=>e.assignedUserIds?.includes(C.id)),b=e.progress===100,h=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:p,style:v,className:c("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,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";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[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:h.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:S=>{S.currentTarget.style.display="none";}}),N===3&&h.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:["+",h.length-4]})})]},C.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(tn,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(ns,{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(rn,{assignedUsers:y,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(is,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:d,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)));yo.displayName="Card";var ti={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"}},$u=({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 Ou({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),u=[...Object.entries(ti).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...r.filter(y=>!Object.keys(ti).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let y=ti[e];if(y)return {...y,id:e};let b=r.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ti.todo,id:"todo"}},m=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,C=280,N=4,S=y.right-v;S<10&&(S=y.left),S+v>h-10&&(S=h-v-10);let M=b-y.bottom,k=y.top,P;M>=C+N?P=y.bottom+N:k>=C+N?P=y.top-C-N:P=M>=k?y.bottom+N:Math.max(10,y.top-C-N),l({top:P,left:S}),s(true);};react.useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let g=y=>{t(y),s(false);},f=p(),x=f.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:f.label,children:jsxRuntime.jsx($u,{icon:f.icon,color:x})}),o&&jsxRuntime.jsx(ta,{children:jsxRuntime.jsxs("div",{ref:d,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:u.map(y=>jsxRuntime.jsxs("button",{onClick:()=>g(y.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:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx($u,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.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"})})]},y.id))})]})})]})}var Hu={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 zu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Hu[s]||Hu.en,[l,d]=react.useState(false),[i,u]=react.useState(false),[p,m]=react.useState(e),[g,f]=react.useState({top:0,left:0}),x=react.useRef(null),y=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(l&&y.current){let N=y.current.getBoundingClientRect();f({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),react.useEffect(()=>{let N=S=>{x.current&&!x.current.contains(S.target)&&!y.current?.contains(S.target)&&(d(false),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),react.useEffect(()=>{let N=S=>{S.key==="Escape"&&(d(false),u(false),m(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),react.useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{u(true),m(e);},v=()=>{let N=p.trim();N&&N!==e&&t(N),u(false),d(false),m(e);},C=N=>{N.key==="Enter"?v():N.key==="Escape"&&(u(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>d(!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(ta,{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:b,type:"text",value:p,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:h,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(),d(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 En=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:f,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:C,isOver:N}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),S=react.useRef(null),M=u??uu(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>S.current,estimateSize:()=>p,enabled:M});if(a)return jsxRuntime.jsx("div",{ref:C,className:b,children:a(e,t)});let A=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),w=A.state==="exceeded",_=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:C,className:c("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",w&&"ring-2 ring-asakaa-accent-red",b),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:c(_()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&A.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${A.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[A.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"})]}),A.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"})]}),A.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"})}),A.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsxRuntime.jsx(zu,{columnTitle:e.title,onRename:U=>f?.(e.id,U),onDelete:x?()=>x(e.id):void 0,isDeletable:y,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"})]})]}),h&&h(e,t),!m&&jsxRuntime.jsx("div",{ref:S,className:"asakaa-column-cards",style:{maxHeight:M?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(U=>U.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"})}):M?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(U=>{let ae=t[U.index];return ae?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsxRuntime.jsx(yo,{card:ae,render:r,onClick:n,onUpdate:l,availableUsers:d,allCards:i})},ae.id):null})}):t.map(U=>jsxRuntime.jsx(yo,{card:U,render:r,onClick:n,onUpdate:l,availableUsers:d,allCards:i},U.id))})})]})});En.displayName="Column";function Ll({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 d=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:d,onKeyDown:i,className:c("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:c("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Db(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 _u(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 d=l.name.toLowerCase(),i=d.replace(/\s+/g,""),u=d.split(/\s+/);return !!(i===s||d===s||u.some(p=>p===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Sb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Eb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Mb=["\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 Ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:d="es",currentUser:i,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:f,maxFileSizeMB:x=10}){let y=l==="dark",[b,h]=react.useState(false),[v,C]=react.useState([]),[N,S]=react.useState(0),[M,k]=react.useState(null),[P,A]=react.useState(false),w=react.useRef(null),_=react.useRef(null),U=react.useRef(null),ae=react.useRef(null),L=react.useCallback((O,ee)=>{let ue=Db(O,ee);if(k(ue),ue){let Te=r.filter(ve=>ve.name.toLowerCase().includes(ue.query)||ve.email&&ve.email.toLowerCase().includes(ue.query)).slice(0,5);C(Te),h(Te.length>0),S(0);}else h(false),C([]);},[r]),K=O=>{let ee=O.target.value;if(t(ee),L(ee,O.target.selectionStart||0),w.current){w.current.style.height="24px";let ue=w.current.scrollHeight,Te=280,ve=Math.min(ue,Te);w.current.style.height=`${ve}px`,w.current.style.overflowY=ue>Te?"auto":"hidden";}},q=()=>{w.current&&L(e,w.current.selectionStart||0);},z=react.useCallback(O=>{if(!M||!w.current)return;let ee=e.slice(0,M.start),ue=e.slice(M.end),Te=`@${O.name.replace(/\s+/g,"")} `,ve=ee+Te+ue;t(ve),h(false),k(null),setTimeout(()=>{if(w.current){let Ue=M.start+Te.length;w.current.selectionStart=Ue,w.current.selectionEnd=Ue,w.current.focus();}},0);},[M,e,t]),B=O=>{if(b&&v.length>0)switch(O.key){case "ArrowDown":O.preventDefault(),S(ee=>ee<v.length-1?ee+1:0);break;case "ArrowUp":O.preventDefault(),S(ee=>ee>0?ee-1:v.length-1);break;case "Enter":{O.preventDefault();let ee=v[N];ee&&z(ee);break}case "Tab":{O.preventDefault();let ee=v[N];ee&&z(ee);break}case "Escape":O.preventDefault(),h(false);break}else O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),a());};react.useEffect(()=>{let O=ee=>{_.current&&!_.current.contains(ee.target)&&w.current&&!w.current.contains(ee.target)&&h(false),ae.current&&!ae.current.contains(ee.target)&&A(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let X=react.useCallback(O=>{if(!w.current)return;let ee=w.current.selectionStart||e.length,ue=e.slice(0,ee)+O+e.slice(ee);t(ue),A(false),setTimeout(()=>{if(w.current){let Te=ee+O.length;w.current.selectionStart=Te,w.current.selectionEnd=Te,w.current.focus();}},0);},[e,t]),fe=react.useCallback(O=>{if(!g||!O.target.files)return;let ee=Array.from(O.target.files),ue=x*1024*1024,Te=ee.filter(ve=>ve.size>ue?(console.warn(`File ${ve.name} exceeds max size of ${x}MB`),false):true);Te.length>0&&g(Te),O.target.value="";},[g,x]),Ge=react.useCallback(O=>O.type.startsWith("image/")?lucideReact.Image:O.type.includes("pdf")||O.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&_.current){let O=_.current.children[N];O&&O.scrollIntoView({block:"nearest"});}},[N,b]),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(O=>{let ee=Ge(O.file),ue=O.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:c("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[ue&&O.preview?jsxRuntime.jsx("img",{src:O.preview,alt:O.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(ee,{className:c("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:c("text-xs truncate",y?"text-white":"text-gray-900"),children:O.file.name}),jsxRuntime.jsx("p",{className:c("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:Eb(O.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(O.id),className:c("p-0.5 rounded-full transition-colors",y?"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"})})]},O.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:c("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:c("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(!P),disabled:s||n,className:c("p-1 rounded transition-colors flex-shrink-0",y?"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:P&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ae,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"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:Mb.map(O=>jsxRuntime.jsx("button",{type:"button",onClick:()=>X(O),className:c("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:O},O))})})})]}),p&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||n,className:c("p-1.5 rounded transition-colors",y?"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:d==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:U,type:"file",multiple:true,onChange:fe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:w,value:e,onChange:K,onSelect:q,onKeyDown:B,placeholder:o||(d==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:c("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"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:c("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":y?"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:b&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((O,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>z(O),className:c("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ee===N?y?"bg-white/10":"bg-gray-100":y?"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:O.color||"#8B5CF6"},children:Sb(O.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:c("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:O.name}),O.email&&jsxRuntime.jsx("p",{className:c("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:O.email})]})]},O.id))})})]})]})]})}function qu({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,d)=>l.type==="mention"?jsxRuntime.jsx("span",{className:c("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},d):jsxRuntime.jsx("span",{children:l.value},d))})}var si=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,d]=react.useState(false),[i,u]=react.useState(""),[p,m]=react.useState(false),[g,f]=react.useState(si[10]||"#2E94FF"),[x,y]=react.useState({top:0,left:0}),b=react.useRef(null),h=react.useRef(null),v=react.useRef(null),C=react.useRef(null),N=t.filter(w=>w.name.toLowerCase().includes(i.toLowerCase())),S=t.some(w=>w.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let w=h.current.getBoundingClientRect();y({top:w.bottom+6,left:w.left});}},[l]),react.useEffect(()=>{let w=_=>{let U=_.target,ae=b.current?.contains(U),L=v.current?.contains(U);!ae&&!L&&(d(false),u(""),m(false));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let M=w=>{let _=e.some(U=>U.id===w.id);a(_?e.filter(U=>U.id!==w.id):[...e,w]);},k=async()=>{if(!(!r||!i.trim())){m(true);try{let w=await r(i.trim(),g);w&&(a([...e,w]),u(""),f(si[Math.floor(Math.random()*si.length)]||"#2E94FF"));}finally{m(false);}}},P=(w,_)=>{_.stopPropagation(),a(e.filter(U=>U.id!==w));},A={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&d(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,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(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.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:w=>u(w.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:w=>{w.key==="Enter"&&i.trim()&&!S&&r&&k();}})}),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(w=>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:`${w.color}20`,color:w.color},onClick:_=>P(w.id,_),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(w=>{let _=e.some(U=>U.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:U=>{_||(U.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:U=>{_||(U.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.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()&&!S&&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:si.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:g===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:p?.7:1},children:[p?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Bl({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 Xu({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(Bl,{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 nn=[{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 Ob(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 Hb({className:e}){return jsxRuntime.jsxs("svg",{className:c("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 Rl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Ob(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"},d=Ju(e.loggedMinutes),i=e.estimateMinutes?Ju(e.estimateMinutes):null,u=a&&i?`${d} / ${i}`:d;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:c("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(Hb,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function zb(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 li(e){let t=zb(e);return t!==null?String(t):e}function Zu(e){let a=li(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 di(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 Vb(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 Gb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function jb({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 ep({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 _b({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 $l({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:d,onDiscardTimer:i,onClose:u,className:p}){let[m,g]=react.useState(""),[f,x]=react.useState(t.estimateMinutes?di(t.estimateMinutes):""),[y,b]=react.useState(""),[h,v]=react.useState(false),[C,N]=react.useState(false),S=react.useRef(null);react.useEffect(()=>{S.current?.focus();},[]);let M=async()=>{let A=Zu(m);if(!(A<=0||!s)){v(true);try{await s({durationMinutes:A,note:y.trim()||void 0,source:"manual"}),g(""),b("");}finally{v(false);}}},k=async()=>{if(!n)return;let A=f.trim()?Zu(f):null;await n(A),N(false);},P=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),M()),A.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:c("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",p),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(ep,{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:Vb(o)})]}),jsxRuntime.jsx("button",{onClick:d,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(jb,{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(ep,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:c("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(Gb,{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(_b,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:S,type:"text",value:m,onChange:A=>g(A.target.value),onKeyDown:P,placeholder:"8 (=8h), 2h 30m",className:c("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:M,disabled:h||!m.trim(),className:c("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:y,onChange:A=>b(A.target.value),onKeyDown:P,placeholder:"Note (optional)",className:c("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:di(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:f,onChange:A=>x(A.target.value),onKeyDown:A=>{A.key==="Enter"&&k(),A.key==="Escape"&&N(false);},onBlur:k,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?di(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:c("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:c("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(A=>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:A.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:di(A.durationMinutes)})]},A.id))})]})]})}function Jb(e){let a=li(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 Qb(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 no({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,d]=react.useState(Qb(r)),[i,u]=react.useState(""),[p,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let f=async()=>{m(true);let v=Jb(l);await o(v&&v>0?v:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxRuntime.jsxs("div",{className:c("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:b[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=>d(v.target.value),onKeyDown:y,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=>u(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:p||!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:p?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:p,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Zb(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 eh(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 Hl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Zb(e.health),s=eh(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,d=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:c("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:c("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:c("h-full transition-all duration-300",o),style:{width:`${d}%`}}),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:c("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Mn(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 ah(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 rh(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 oh(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 nh({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",d=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:c("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:c("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:c("text-2xl font-bold",o),children:[r?"+":"",Mn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:c("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:c("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:c("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:c("font-medium",d),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:c("font-medium",d),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:c("font-medium",d),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:c("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:c("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:c("font-medium",d),children:Mn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:c("font-medium",d),children:Mn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:c("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:c("font-medium",d),children:e.totalTasksWithEstimate})]})]})]})]})}function sh({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:c("border-b",s,r&&c("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:c("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:c("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Mn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Mn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:c("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,Mn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:c("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:c("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",rh(e.status,a),ah(e.status,a)),children:oh(e.status,t)})})]})}function zl({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",d=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",p=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:c("p-8 text-center",p,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:c("p-8 text-center",p,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:c("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:c("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:c("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(nh,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:c("rounded-lg border overflow-hidden",d,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:c("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:c("divide-y",i),children:g.map(f=>jsxRuntime.jsx(sh,{task:f,locale:a,isDark:n,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:c("text-xs text-center",p),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Fn(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 vh(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 cp(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 wh(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 vo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:d=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:m,availableTasks:g=[],comments:f=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:S=false,timerElapsedSeconds:M=0,onTimeLog:k,onEstimateUpdate:P,onSoldEffortUpdate:A,onTimerStart:w,onTimerStop:_,onTimerDiscard:U,blurFinancials:ae=false}){let L=s==="dark",K={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},q=e&&"title"in e&&!("name"in e),z=e,[B,X]=react.useState(e?cp(e,l):null),[fe,Ge]=react.useState(false),[O,ee]=react.useState(false),[ue,Te]=react.useState(false),[ve,Ue]=react.useState(null),[$e,nt]=react.useState(new Date),[ce,Xe]=react.useState(false),[_e,ke]=react.useState(false),[bt,Bt]=react.useState(""),[st,Ve]=react.useState(false),[tt,Ke]=react.useState(false),[Pe,W]=react.useState(false),[D,j]=react.useState(false),[re,Ne]=react.useState(""),H=react.useRef(null),se=react.useRef(null),[je,we]=react.useState(""),He=react.useRef(null),[ze,Be]=react.useState(""),[ct,ut]=react.useState(false),[ht,pt]=react.useState([]),[Ct,Et]=react.useState(""),[Wt,St]=react.useState(false),zt=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 T=cp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),X(T),Ne(T.description||""),we(T.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!re)return;let T=setTimeout(()=>{let J=se.current;J&&(J.style.height="auto",J.style.height=`${Math.max(100,J.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,re]),react.useEffect(()=>()=>{H.current&&clearTimeout(H.current),He.current&&clearTimeout(He.current);},[]),react.useEffect(()=>{t&&zt.current&&f.length>0&&setTimeout(()=>{zt.current&&(zt.current.scrollTop=zt.current.scrollHeight);},100);},[t,f.length]);let it=react.useCallback(T=>{X(T),q&&o&&z?o(wh(T,z)):r&&r(T);},[q,z,o,r]),jt=react.useCallback(()=>{Ge(false),ee(false),Te(false),Ue(null),ke(false),Bt(""),Ve(false);},[]),mt=react.useCallback((T,J)=>{if(!B)return;let Ce={...B,[T]:J};it(Ce);},[B,it]),lt=react.useCallback(()=>{let T=se.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),ne=react.useCallback(T=>{Ne(T),setTimeout(lt,0),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{if(B){let J={...B,description:T};it(J);}},800);},[B,it,lt]),me=react.useCallback(T=>{we(T),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(B&&T.trim()){let J={...B,name:T.trim()};it(J);}},800);},[B,it]),$=react.useCallback(T=>{let J=T.map(Ce=>{let Le={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ce};return Ce.type.startsWith("image/")&&(Le.preview=URL.createObjectURL(Ce)),Le});pt(Ce=>[...Ce,...J]);},[]),Y=react.useCallback(T=>{pt(J=>{let Ce=J.find(Le=>Le.id===T);return Ce?.preview&&URL.revokeObjectURL(Ce.preview),J.filter(Le=>Le.id!==T)});},[]),Se=react.useCallback(async()=>{if(!(!B||!ze.trim()&&ht.length===0||!x)){ut(true);try{let T=_u(ze,b),J=[];if(ht.length>0&&h){let Ce=ht.map(Le=>Le.file);J=await h(Ce);}await x(B.id,ze.trim(),T.length>0?T:void 0,J.length>0?J:void 0),Be(""),ht.forEach(Ce=>{Ce.preview&&URL.revokeObjectURL(Ce.preview);}),pt([]);}finally{ut(false);}}},[B,ze,ht,x,b,h]),Ze=react.useCallback(()=>{if(!B||!Ct.trim())return;let T=B.subtasks||[],J={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Ct.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},Ce=[...T,J],Le={...B,subtasks:Ce};it(Le),Et(""),St(false);},[B,Ct,it]),gt=react.useCallback(T=>{if(!B?.subtasks)return;let J=B.subtasks.map(Le=>Le.id===T?{...Le,progress:Le.progress===100?0:100}:Le),Ce={...B,subtasks:J};it(Ce);},[B,it]),Pt=react.useCallback(T=>{if(!B?.subtasks)return;let J=B.subtasks.filter(Le=>Le.id!==T),Ce={...B,subtasks:J};it(Ce);},[B,it]),Rt=react.useCallback(T=>{let J=typeof T=="string"?new Date(T):T,Le=new Date().getTime()-J.getTime(),$t=Math.floor(Le/6e4),Nt=Math.floor(Le/36e5),Jt=Math.floor(Le/864e5);return $t<1?n==="es"?"Ahora":"Just now":$t<60?n==="es"?`Hace ${$t} min`:`${$t}m ago`:Nt<24?n==="es"?`Hace ${Nt}h`:`${Nt}h ago`:Jt<7?n==="es"?`Hace ${Jt}d`:`${Jt}d ago`:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Mt=react.useCallback(T=>{if(!B)return;let J=B.progress||0;T==="completed"?J=100:T==="in-progress"&&J===0?J=10:T==="todo"&&(J=0);let Ce={...B,status:T,progress:J};it(Ce),Ge(false);},[B,it]),Yt=react.useCallback((T,J)=>{if(!B)return;let Ce={...B,startDate:T,endDate:J};it(Ce);},[B,it]),Qt=react.useCallback(()=>{let T=$e.getFullYear(),J=$e.getMonth(),Ce=new Date(T,J,1),$t=new Date(T,J+1,0).getDate(),Nt=Ce.getDay(),Jt=[],Ua=new Date(T,J,0).getDate();for(let Ma=Nt-1;Ma>=0;Ma--)Jt.push({date:new Date(T,J-1,Ua-Ma),isCurrentMonth:false});for(let Ma=1;Ma<=$t;Ma++)Jt.push({date:new Date(T,J,Ma),isCurrentMonth:true});let ya=42-Jt.length;for(let Ma=1;Ma<=ya;Ma++)Jt.push({date:new Date(T,J+1,Ma),isCurrentMonth:false});return Jt},[$e]),Z=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),W(false),!B||!p)return;let J=Array.from(T.dataTransfer.files);if(J.length!==0){j(true);try{await p(B.id,J);}finally{j(false);}}},[B,p]),Oe=react.useCallback(async T=>{if(!B||!p||!T.target.files)return;let J=Array.from(T.target.files);if(J.length!==0){j(true);try{await p(B.id,J);}finally{j(false);}T.target.value="";}},[B,p]),Ae=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),W(true);},[]),I=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),W(false);},[]),xe=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),te=react.useCallback(T=>T.startsWith("image/")?lucideReact.Image:T.includes("pdf")||T.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:c("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:c("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:c("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:c("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=B.progress===100?0:100,Ce={...B,progress:T,status:T===100?"completed":"todo"};it(Ce);},className:c("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:je,onChange:T=>me(T.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:c("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{jt(),Ge(!fe);},className:c("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":L?"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:fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ge(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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(T=>jsxRuntime.jsxs("button",{onClick:()=>Mt(T.id),className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",B.status===T.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{jt(),Te(!ue);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((T,J)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},J)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(T=>{let J=B.assignees?.some(Ce=>Ce.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Ce=B.assignees||[],Le;J?Le=Ce.filter($t=>$t.name!==T.name):Le=[...Ce,T],mt("assignees",Le);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",J&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:c("flex-1",L?"text-white":"text-gray-900"),children:T.name}),J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsxRuntime.jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ue(ve?null:"start"),nt(B.startDate||new Date);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:c("mx-1",L?"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:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:c("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:c("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,J=new Date(T);J.setDate(T.getDate()+1);let Ce=new Date(T);Ce.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let Le=new Date(T);Le.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let $t=new Date(T);$t.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Nt=new Date(T);Nt.setDate(T.getDate()+14);let Jt=new Date(T);return Jt.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ce,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$t,display:$t.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Nt,display:Nt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Jt,display:Jt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ya,Ma)=>jsxRuntime.jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ve==="start"){let Sr=B.endDate&&ya.date>B.endDate?ya.date:B.endDate;Yt(ya.date,Sr),Ue("end");}else {let Sr=B.startDate&&ya.date<B.startDate?ya.date:B.startDate;Yt(Sr,ya.date),Ue(null);}},children:[jsxRuntime.jsx("span",{children:ya.label}),jsxRuntime.jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ya.display})]},Ma))})(),jsxRuntime.jsx("div",{className:c("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Yt(void 0,void 0),Ue(null);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children: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:c("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ve==="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:c("font-medium",L?"text-white":"text-gray-900"),children:$e.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:()=>nt(new Date),className:c("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>nt(new Date($e.getFullYear(),$e.getMonth()-1)),className:c("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>nt(new Date($e.getFullYear(),$e.getMonth()+1)),className:c("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsxRuntime.jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Qt().map((T,J)=>{let Ce=T.date.toDateString()===new Date().toDateString(),Le=B.startDate?.toDateString()===T.date.toDateString(),$t=B.endDate?.toDateString()===T.date.toDateString(),Nt=Le||$t,Jt=B.startDate&&B.endDate&&T.date>=B.startDate&&T.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Ua=new Date(T.date);if(ve==="start"){let ya=B.endDate&&Ua>B.endDate?Ua:B.endDate;Yt(Ua,ya),Ue("end");}else {let ya=B.startDate&&Ua<B.startDate?Ua:B.startDate;Yt(ya,Ua),Ue(null);}},className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(L?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#2E94FF]",Le&&"bg-[#2E94FF] text-white",$t&&!Le&&"bg-[#7C3AED] text-white",Jt&&!Nt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Nt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},J)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{jt(),ee(!O);},className:c("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?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:O&&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:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(T=>jsxRuntime.jsxs("button",{onClick:()=>{mt("priority",T.id),ee(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",B.priority===T.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${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:c("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ce?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:T=>{let J=parseInt(T.target.value),Ce=B.status;J===100?Ce="completed":J>0?Ce="in-progress":Ce="todo";let Le={...B,progress:J,status:Ce};it(Le);},onBlur:()=>Xe(false),className:c("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Xe(true),className:c("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:c("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:c("text-sm font-medium min-w-[40px]",L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"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:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?Fn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Fn(C.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:c("text-sm",L?"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(no,{mode:"estimate",locale:n,isDark:L,currentValue:C?.estimateMinutes||null,onSave:async T=>{await P?.(B.id,T),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ae?jsxRuntime.jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"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:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Fn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Fn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:c("text-sm",L?"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"&&!ae&&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(no,{mode:"quoted",locale:n,isDark:L,currentValue:B.quotedMinutes||null,onSave:async T=>{A?(await A(B.id,T),X(J=>J?{...J,quotedMinutes:T}:null)):mt("quotedMinutes",T),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"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:c("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):S?jsxRuntime.jsxs("button",{type:"button",onClick:()=>_?.(B.id),className:c("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"}),vh(M||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>w?.(B.id),className:c("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title: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:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"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:()=>Ke("log"),className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:c("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[Fn(C.loggedMinutes),C.estimateMinutes&&jsxRuntime.jsxs("span",{className:c("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",Fn(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:c("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: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(no,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(T,J)=>{T&&await k?.(B.id,{durationMinutes:T,note:J,source:"manual"}),Ke(false);},onClose:()=>Ke(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Lo,{selectedTags:B.tags||[],availableTags:d,onChange:T=>{mt("tags",T);},onCreateTag:i,theme:K})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:c("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0 mt-1",L?"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(T=>{let J=g.find(Ce=>Ce.id===T);return jsxRuntime.jsxs("span",{className:c("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[J?.name||T.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Ce=(B.dependencies||[]).filter(Le=>Le!==T);mt("dependencies",Ce);},className:c("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{jt(),ke(!_e);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ke(false),Bt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:c("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:bt,onChange:T=>Bt(T.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:c("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(T=>T.id!==B.id).filter(T=>bt===""||T.name.toLowerCase().includes(bt.toLowerCase())).map(T=>{let J=B.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Ce=B.dependencies||[],Le;J?Le=Ce.filter($t=>$t!==T.id):Le=[...Ce,T.id],mt("dependencies",Le);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",J&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:c("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",J?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:c("block truncate",L?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{jt(),Ve(!st);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:nn.find(T=>T.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ve(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:nn.map(T=>{let J=B.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{mt("color",T.value),Ve(false);},className:c("w-7 h-7 rounded-full flex items-center justify-center transition-all",J&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:J?T.value:void 0},title:T.name,children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"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:T=>mt("isMilestone",T.target.checked),className:c("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:se,value:re,onChange:T=>ne(T.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:c("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(T=>T.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((T,J)=>(T.position??0)-(J.position??0)).map(T=>jsxRuntime.jsxs("div",{className:c("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>gt(T.id),className:c("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",T.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:c("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("button",{onClick:()=>Pt(T.id),className:c("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),Wt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Ct,onChange:T=>Et(T.target.value),onKeyDown:T=>{T.key==="Enter"&&Ct.trim()?Ze():T.key==="Escape"&&(St(false),Et(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:c("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-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:Ze,disabled:!Ct.trim(),className:c("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Ct.trim()?"bg-blue-500 hover:bg-blue-600 text-white":L?"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:()=>{St(false),Et("");},className:c("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>St(true),className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:c("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(T=>{let J=te(T.type),Ce=T.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:c("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ce&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:c("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(J,{className:c("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:c("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:xe(T.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(T.id),className:c("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ae,onDragLeave:I,onDrop:Z,className:c("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Pe?L?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":L?"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:Oe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||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:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:c("w-6 h-6 mx-auto mb-2",Pe?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Pe?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"})]})}),!p&&jsxRuntime.jsx("p",{className:c("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:c("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:c("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
4
+ `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=hu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=hu(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,f)=>{i[g]=l[f]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let p=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),p.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 hu(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 yu(e,t){switch(t){case "json":return Yf(e);case "csv":return Xf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function xu(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 El=react.createContext(null);function vu(){return react.useContext(El)}var wu=react.createContext(null);function ku({children:e,themeName:t}){return jsxRuntime.jsx(wu.Provider,{value:{themeName:t},children:e})}function Nn(){return react.useContext(wu)}function ta({children:e,container:t}){let[a,r]=react.useState(false),o=vu(),s=Nn();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:d}=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":d,"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 Su={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ob="#BDC3C7",nb=({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 tn({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),d=react.useRef(null),i=()=>{if(!d.current)return;let g=d.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=g.right-y;v<10&&(v=g.left),v+y>x-10&&(v=x-y-10);let C=f-g.bottom,N=g.top,S;C>=b+h?S=g.bottom+h:N>=b+h?S=g.top-b-h:S=C>=N?g.bottom+h:Math.max(10,g.top-b-h),n({top:S,left:v}),o(true);};react.useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&!d.current?.contains(f.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},p=e?Su[e]:null,m=p?.color||ob;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:d,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:p?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ta,{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(Su).map(([g,f])=>jsxRuntime.jsxs("button",{onClick:()=>u(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:f.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(nb,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.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:"#00E5CC",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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var sb=[{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 ns({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),m=(Nn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,S=320,M=380,k=4,F=v.left;F+S>N-10&&(F=N-S-10),F<10&&(F=10);let A=C-v.bottom,w=v.top,_;A>=M+k?_=v.bottom+k:w>=M+k?_=v.top-M-k:_=A>=w?v.bottom+k:Math.max(10,v.top-M-k),l({top:_,left:F}),s(true);};react.useEffect(()=>{let v=C=>{d.current&&!d.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 f=v=>{let C=new Date,N=F=>{let A=F.getFullYear(),w=String(F.getMonth()+1).padStart(2,"0"),_=String(F.getDate()).padStart(2,"0");return `${A}-${w}-${_}`},S=N(C),M=new Date(C);M.setDate(M.getDate()+v);let k=N(M);a(S,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=M=>{if(M instanceof Date)return M;if(typeof M!="string"||!M.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=M.split("-").map(Number);if(k.length!==3||k.some(_=>isNaN(_)))return null;let F=k[0],A=k[1],w=k[2];return F===void 0||A===void 0||w===void 0?null:new Date(F,A-1,w)},C=v(e),N=v(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[C.getMonth()]} ${C.getDate()} \u2013 ${S[N.getMonth()]} ${N.getDate()}`},y=e&&t,h=(()=>{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 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${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(ta,{children:jsxRuntime.jsxs("div",{ref:d,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:sb.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color: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 rn({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,d]=react.useState(""),[i,u]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,N=300,S=380,M=4,k=h.right-N;k<10&&(k=h.left),k+N>C-10&&(k=C-N-10);let F=v-h.bottom,A=h.top,w;F>=S+M?w=h.bottom+M:A>=S+M?w=h.top-S-M:w=F>=A?h.bottom+M:Math.max(10,h.top-S-M),u({top:w,left:k}),n(true);};react.useEffect(()=>{let h=v=>{p.current&&!p.current.contains(v.target)&&!m.current?.contains(v.target)&&(n(false),d(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&(n(false),d(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let v=e.some(C=>C.id===h.id);a(v?e.filter(C=>C.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),y=e.slice(0,o),b=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:[y.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(ta,{children:jsxRuntime.jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),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(h=>{let v=e.some(C=>C.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>f(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter: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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),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:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.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 ei(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(d.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=d=>{if(!s.has(d)){s.add(d),n.add(d);let i=r.get(d)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(n.has(u))return true}}return n.delete(d),false};return l(a)}function is({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,d]=react.useState(false),[i,u]=react.useState(""),[p,m]=react.useState(t.length>0),[g,f]=react.useState({top:0,left:0}),[x,y]=react.useState(null),b=react.useRef(null),h=react.useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),F=window.innerHeight,A=window.innerWidth,w=300,_=p?380:120,U=4,ae=k.right-w;ae<10&&(ae=k.left),ae+w>A-10&&(ae=A-w-10);let L=F-k.bottom,K=k.top,q;L>=_+U?q=k.bottom+U:K>=_+U?q=k.top-_-U:q=L>=K?k.bottom+U:Math.max(10,k.top-_-U),f({top:q,left:ae}),d(true);};react.useEffect(()=>{if(!l||!h.current)return;let k=h.current.getBoundingClientRect(),F=window.innerHeight,A=window.innerWidth,w=300,_=p?380:120,U=4,ae=k.right-w;ae<10&&(ae=k.left),ae+w>A-10&&(ae=A-w-10);let L=F-k.bottom,K=k.top,q;L>=_+U?q=k.bottom+U:K>=_+U?q=k.top-_-U:q=L>=K?k.bottom+U:Math.max(10,k.top-_-U),f({top:q,left:ae});},[p,l]),react.useEffect(()=>{let k=F=>{b.current&&!b.current.contains(F.target)&&!h.current?.contains(F.target)&&(d(false),u(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=F=>{F.key==="Escape"&&(d(false),u(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let C=k=>{let F=t.includes(k),A=a.find(w=>w.id===k);if(y(null),F){let w=t.filter(_=>_!==k);r(w),w.length===0&&m(false);}else {if(s&&ei(a,k,e)){let _=`Cannot add "${A?.title||k}" as dependency - would create circular reference`;y(_),n?.(k,A?.title||k),setTimeout(()=>y(null),3e3);return}r([...t,k]),m(true);}},N=()=>{let k=!p;m(k),k||r([]);},S=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),M=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?d(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:M,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:M},children:t.length})]}),l&&jsxRuntime.jsx(ta,{children:jsxRuntime.jsxs("div",{ref:b,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:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:k=>u(k.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:S.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"}):S.map(k=>{let F=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>C(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.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?"#00E5CC":"transparent",borderColor:F?"#00E5CC":"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:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.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),d(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 yo=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:m,transition:g,isDragging:f}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Xs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:p,style:x,...i,...u,onClick:()=>a?.(e),children:t(e)});let y=l.filter(C=>e.assignedUserIds?.includes(C.id)),b=e.progress===100,h=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:p,style:v,className:c("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,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";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[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:h.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:S=>{S.currentTarget.style.display="none";}}),N===3&&h.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:["+",h.length-4]})})]},C.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(tn,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(ns,{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(rn,{assignedUsers:y,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(is,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:d,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:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));yo.displayName="Card";var ti={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"}},$u=({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 Ou({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),u=[...Object.entries(ti).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...r.filter(y=>!Object.keys(ti).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let y=ti[e];if(y)return {...y,id:e};let b=r.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ti.todo,id:"todo"}},m=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,C=280,N=4,S=y.right-v;S<10&&(S=y.left),S+v>h-10&&(S=h-v-10);let M=b-y.bottom,k=y.top,F;M>=C+N?F=y.bottom+N:k>=C+N?F=y.top-C-N:F=M>=k?y.bottom+N:Math.max(10,y.top-C-N),l({top:F,left:S}),s(true);};react.useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let g=y=>{t(y),s(false);},f=p(),x=f.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:f.label,children:jsxRuntime.jsx($u,{icon:f.icon,color:x})}),o&&jsxRuntime.jsx(ta,{children:jsxRuntime.jsxs("div",{ref:d,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:u.map(y=>jsxRuntime.jsxs("button",{onClick:()=>g(y.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:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx($u,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var Hu={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 zu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Hu[s]||Hu.en,[l,d]=react.useState(false),[i,u]=react.useState(false),[p,m]=react.useState(e),[g,f]=react.useState({top:0,left:0}),x=react.useRef(null),y=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(l&&y.current){let N=y.current.getBoundingClientRect();f({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),react.useEffect(()=>{let N=S=>{x.current&&!x.current.contains(S.target)&&!y.current?.contains(S.target)&&(d(false),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),react.useEffect(()=>{let N=S=>{S.key==="Escape"&&(d(false),u(false),m(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),react.useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{u(true),m(e);},v=()=>{let N=p.trim();N&&N!==e&&t(N),u(false),d(false),m(e);},C=N=>{N.key==="Enter"?v():N.key==="Escape"&&(u(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>d(!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(ta,{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:b,type:"text",value:p,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-[#00E5CC]/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,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(),d(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 En=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:f,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:C,isOver:N}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),S=react.useRef(null),M=u??uu(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>S.current,estimateSize:()=>p,enabled:M});if(a)return jsxRuntime.jsx("div",{ref:C,className:b,children:a(e,t)});let A=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),w=A.state==="exceeded",_=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:C,className:c("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",w&&"ring-2 ring-asakaa-accent-red",b),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:c(_()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&A.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${A.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[A.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"})]}),A.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"})]}),A.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"})}),A.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsxRuntime.jsx(zu,{columnTitle:e.title,onRename:U=>f?.(e.id,U),onDelete:x?()=>x(e.id):void 0,isDeletable:y,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"})]})]}),h&&h(e,t),!m&&jsxRuntime.jsx("div",{ref:S,className:"asakaa-column-cards",style:{maxHeight:M?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(U=>U.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"})}):M?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(U=>{let ae=t[U.index];return ae?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsxRuntime.jsx(yo,{card:ae,render:r,onClick:n,onUpdate:l,availableUsers:d,allCards:i})},ae.id):null})}):t.map(U=>jsxRuntime.jsx(yo,{card:U,render:r,onClick:n,onUpdate:l,availableUsers:d,allCards:i},U.id))})})]})});En.displayName="Column";function Ll({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 d=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:d,onKeyDown:i,className:c("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:c("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Db(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 _u(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 d=l.name.toLowerCase(),i=d.replace(/\s+/g,""),u=d.split(/\s+/);return !!(i===s||d===s||u.some(p=>p===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Sb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Eb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Mb=["\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 Ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:d="es",currentUser:i,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:f,maxFileSizeMB:x=10}){let y=l==="dark",[b,h]=react.useState(false),[v,C]=react.useState([]),[N,S]=react.useState(0),[M,k]=react.useState(null),[F,A]=react.useState(false),w=react.useRef(null),_=react.useRef(null),U=react.useRef(null),ae=react.useRef(null),L=react.useCallback((O,ee)=>{let ue=Db(O,ee);if(k(ue),ue){let Te=r.filter(ve=>ve.name.toLowerCase().includes(ue.query)||ve.email&&ve.email.toLowerCase().includes(ue.query)).slice(0,5);C(Te),h(Te.length>0),S(0);}else h(false),C([]);},[r]),K=O=>{let ee=O.target.value;if(t(ee),L(ee,O.target.selectionStart||0),w.current){w.current.style.height="24px";let ue=w.current.scrollHeight,Te=280,ve=Math.min(ue,Te);w.current.style.height=`${ve}px`,w.current.style.overflowY=ue>Te?"auto":"hidden";}},q=()=>{w.current&&L(e,w.current.selectionStart||0);},z=react.useCallback(O=>{if(!M||!w.current)return;let ee=e.slice(0,M.start),ue=e.slice(M.end),Te=`@${O.name.replace(/\s+/g,"")} `,ve=ee+Te+ue;t(ve),h(false),k(null),setTimeout(()=>{if(w.current){let Ue=M.start+Te.length;w.current.selectionStart=Ue,w.current.selectionEnd=Ue,w.current.focus();}},0);},[M,e,t]),B=O=>{if(b&&v.length>0)switch(O.key){case "ArrowDown":O.preventDefault(),S(ee=>ee<v.length-1?ee+1:0);break;case "ArrowUp":O.preventDefault(),S(ee=>ee>0?ee-1:v.length-1);break;case "Enter":{O.preventDefault();let ee=v[N];ee&&z(ee);break}case "Tab":{O.preventDefault();let ee=v[N];ee&&z(ee);break}case "Escape":O.preventDefault(),h(false);break}else O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),a());};react.useEffect(()=>{let O=ee=>{_.current&&!_.current.contains(ee.target)&&w.current&&!w.current.contains(ee.target)&&h(false),ae.current&&!ae.current.contains(ee.target)&&A(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let X=react.useCallback(O=>{if(!w.current)return;let ee=w.current.selectionStart||e.length,ue=e.slice(0,ee)+O+e.slice(ee);t(ue),A(false),setTimeout(()=>{if(w.current){let Te=ee+O.length;w.current.selectionStart=Te,w.current.selectionEnd=Te,w.current.focus();}},0);},[e,t]),fe=react.useCallback(O=>{if(!g||!O.target.files)return;let ee=Array.from(O.target.files),ue=x*1024*1024,Te=ee.filter(ve=>ve.size>ue?(console.warn(`File ${ve.name} exceeds max size of ${x}MB`),false):true);Te.length>0&&g(Te),O.target.value="";},[g,x]),Ge=react.useCallback(O=>O.type.startsWith("image/")?lucideReact.Image:O.type.includes("pdf")||O.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&_.current){let O=_.current.children[N];O&&O.scrollIntoView({block:"nearest"});}},[N,b]),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(O=>{let ee=Ge(O.file),ue=O.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:c("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[ue&&O.preview?jsxRuntime.jsx("img",{src:O.preview,alt:O.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(ee,{className:c("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:c("text-xs truncate",y?"text-white":"text-gray-900"),children:O.file.name}),jsxRuntime.jsx("p",{className:c("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:Eb(O.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(O.id),className:c("p-0.5 rounded-full transition-colors",y?"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"})})]},O.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:c("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:c("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(!F),disabled:s||n,className:c("p-1 rounded transition-colors flex-shrink-0",y?"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:ae,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"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:Mb.map(O=>jsxRuntime.jsx("button",{type:"button",onClick:()=>X(O),className:c("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:O},O))})})})]}),p&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||n,className:c("p-1.5 rounded transition-colors",y?"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:d==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:U,type:"file",multiple:true,onChange:fe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:w,value:e,onChange:K,onSelect:q,onKeyDown:B,placeholder:o||(d==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:c("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"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:c("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"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:b&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((O,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>z(O),className:c("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ee===N?y?"bg-white/10":"bg-gray-100":y?"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:O.color||"#8B5CF6"},children:Sb(O.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:c("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:O.name}),O.email&&jsxRuntime.jsx("p",{className:c("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:O.email})]})]},O.id))})})]})]})]})}function qu({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,d)=>l.type==="mention"?jsxRuntime.jsx("span",{className:c("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},d):jsxRuntime.jsx("span",{children:l.value},d))})}var si=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,d]=react.useState(false),[i,u]=react.useState(""),[p,m]=react.useState(false),[g,f]=react.useState(si[10]||"#00E5CC"),[x,y]=react.useState({top:0,left:0}),b=react.useRef(null),h=react.useRef(null),v=react.useRef(null),C=react.useRef(null),N=t.filter(w=>w.name.toLowerCase().includes(i.toLowerCase())),S=t.some(w=>w.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let w=h.current.getBoundingClientRect();y({top:w.bottom+6,left:w.left});}},[l]),react.useEffect(()=>{let w=_=>{let U=_.target,ae=b.current?.contains(U),L=v.current?.contains(U);!ae&&!L&&(d(false),u(""),m(false));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let M=w=>{let _=e.some(U=>U.id===w.id);a(_?e.filter(U=>U.id!==w.id):[...e,w]);},k=async()=>{if(!(!r||!i.trim())){m(true);try{let w=await r(i.trim(),g);w&&(a([...e,w]),u(""),f(si[Math.floor(Math.random()*si.length)]||"#00E5CC"));}finally{m(false);}}},F=(w,_)=>{_.stopPropagation(),a(e.filter(U=>U.id!==w));},A={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&d(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,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(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.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:w=>u(w.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:w=>{w.key==="Enter"&&i.trim()&&!S&&r&&k();}})}),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(w=>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:`${w.color}20`,color:w.color},onClick:_=>F(w.id,_),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(w=>{let _=e.some(U=>U.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:U=>{_||(U.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:U=>{_||(U.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.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()&&!S&&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:si.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:g===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:p?.7:1},children:[p?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Bl({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 Xu({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(Bl,{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 nn=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#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 Ob(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 Hb({className:e}){return jsxRuntime.jsxs("svg",{className:c("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 Rl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Ob(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"},d=Ju(e.loggedMinutes),i=e.estimateMinutes?Ju(e.estimateMinutes):null,u=a&&i?`${d} / ${i}`:d;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:c("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(Hb,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function zb(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 li(e){let t=zb(e);return t!==null?String(t):e}function Zu(e){let a=li(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 di(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 Vb(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 Gb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function jb({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 ep({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 _b({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 $l({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:d,onDiscardTimer:i,onClose:u,className:p}){let[m,g]=react.useState(""),[f,x]=react.useState(t.estimateMinutes?di(t.estimateMinutes):""),[y,b]=react.useState(""),[h,v]=react.useState(false),[C,N]=react.useState(false),S=react.useRef(null);react.useEffect(()=>{S.current?.focus();},[]);let M=async()=>{let A=Zu(m);if(!(A<=0||!s)){v(true);try{await s({durationMinutes:A,note:y.trim()||void 0,source:"manual"}),g(""),b("");}finally{v(false);}}},k=async()=>{if(!n)return;let A=f.trim()?Zu(f):null;await n(A),N(false);},F=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),M()),A.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:c("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",p),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(ep,{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:Vb(o)})]}),jsxRuntime.jsx("button",{onClick:d,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(jb,{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(ep,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:c("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(Gb,{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(_b,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:S,type:"text",value:m,onChange:A=>g(A.target.value),onKeyDown:F,placeholder:"8 (=8h), 2h 30m",className:c("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:M,disabled:h||!m.trim(),className:c("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:y,onChange:A=>b(A.target.value),onKeyDown:F,placeholder:"Note (optional)",className:c("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:di(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:f,onChange:A=>x(A.target.value),onKeyDown:A=>{A.key==="Enter"&&k(),A.key==="Escape"&&N(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?di(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:c("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:c("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(A=>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:A.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:di(A.durationMinutes)})]},A.id))})]})]})}function Jb(e){let a=li(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 Qb(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 no({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,d]=react.useState(Qb(r)),[i,u]=react.useState(""),[p,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let f=async()=>{m(true);let v=Jb(l);await o(v&&v>0?v:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxRuntime.jsxs("div",{className:c("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":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[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=>d(v.target.value),onKeyDown:y,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=>u(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:p||!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, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:p,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Zb(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 eh(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 Hl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Zb(e.health),s=eh(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,d=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:c("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:c("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:c("h-full transition-all duration-300",o),style:{width:`${d}%`}}),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:c("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Mn(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 ah(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function rh(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function oh(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 nh({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",d=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:c("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:c("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:c("text-2xl font-bold",o),children:[r?"+":"",Mn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:c("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:c("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:c("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:c("font-medium",d),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:c("font-medium",d),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:c("font-medium",d),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:c("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:c("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:c("font-medium",d),children:Mn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:c("font-medium",d),children:Mn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:c("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:c("font-medium",d),children:e.totalTasksWithEstimate})]})]})]})]})}function sh({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:c("border-b",s,r&&c("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:c("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:c("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Mn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Mn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:c("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,Mn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:c("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:c("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",rh(e.status,a),ah(e.status,a)),children:oh(e.status,t)})})]})}function zl({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",d=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",p=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:c("p-8 text-center",p,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:c("p-8 text-center",p,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:c("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:c("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:c("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(nh,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:c("rounded-lg border overflow-hidden",d,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:c("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsxRuntime.jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:c("divide-y",i),children:g.map(f=>jsxRuntime.jsx(sh,{task:f,locale:a,isDark:n,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:c("text-xs text-center",p),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Pn(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 vh(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 cp(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 wh(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 vo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:d=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:m,availableTasks:g=[],comments:f=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:S=false,timerElapsedSeconds:M=0,onTimeLog:k,onEstimateUpdate:F,onSoldEffortUpdate:A,onTimerStart:w,onTimerStop:_,onTimerDiscard:U,blurFinancials:ae=false}){let L=s==="dark",K={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},q=e&&"title"in e&&!("name"in e),z=e,[B,X]=react.useState(e?cp(e,l):null),[fe,Ge]=react.useState(false),[O,ee]=react.useState(false),[ue,Te]=react.useState(false),[ve,Ue]=react.useState(null),[$e,nt]=react.useState(new Date),[ce,Xe]=react.useState(false),[_e,ke]=react.useState(false),[bt,Bt]=react.useState(""),[st,Ve]=react.useState(false),[tt,Ke]=react.useState(false),[Fe,W]=react.useState(false),[D,j]=react.useState(false),[re,Ne]=react.useState(""),H=react.useRef(null),se=react.useRef(null),[je,we]=react.useState(""),He=react.useRef(null),[ze,Be]=react.useState(""),[ct,ut]=react.useState(false),[ht,pt]=react.useState([]),[Ct,Et]=react.useState(""),[Wt,St]=react.useState(false),zt=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 T=cp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),X(T),Ne(T.description||""),we(T.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!re)return;let T=setTimeout(()=>{let J=se.current;J&&(J.style.height="auto",J.style.height=`${Math.max(100,J.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,re]),react.useEffect(()=>()=>{H.current&&clearTimeout(H.current),He.current&&clearTimeout(He.current);},[]),react.useEffect(()=>{t&&zt.current&&f.length>0&&setTimeout(()=>{zt.current&&(zt.current.scrollTop=zt.current.scrollHeight);},100);},[t,f.length]);let it=react.useCallback(T=>{X(T),q&&o&&z?o(wh(T,z)):r&&r(T);},[q,z,o,r]),jt=react.useCallback(()=>{Ge(false),ee(false),Te(false),Ue(null),ke(false),Bt(""),Ve(false);},[]),mt=react.useCallback((T,J)=>{if(!B)return;let Ce={...B,[T]:J};it(Ce);},[B,it]),lt=react.useCallback(()=>{let T=se.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),ne=react.useCallback(T=>{Ne(T),setTimeout(lt,0),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{if(B){let J={...B,description:T};it(J);}},800);},[B,it,lt]),me=react.useCallback(T=>{we(T),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(B&&T.trim()){let J={...B,name:T.trim()};it(J);}},800);},[B,it]),$=react.useCallback(T=>{let J=T.map(Ce=>{let Le={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ce};return Ce.type.startsWith("image/")&&(Le.preview=URL.createObjectURL(Ce)),Le});pt(Ce=>[...Ce,...J]);},[]),Y=react.useCallback(T=>{pt(J=>{let Ce=J.find(Le=>Le.id===T);return Ce?.preview&&URL.revokeObjectURL(Ce.preview),J.filter(Le=>Le.id!==T)});},[]),Se=react.useCallback(async()=>{if(!(!B||!ze.trim()&&ht.length===0||!x)){ut(true);try{let T=_u(ze,b),J=[];if(ht.length>0&&h){let Ce=ht.map(Le=>Le.file);J=await h(Ce);}await x(B.id,ze.trim(),T.length>0?T:void 0,J.length>0?J:void 0),Be(""),ht.forEach(Ce=>{Ce.preview&&URL.revokeObjectURL(Ce.preview);}),pt([]);}finally{ut(false);}}},[B,ze,ht,x,b,h]),Ze=react.useCallback(()=>{if(!B||!Ct.trim())return;let T=B.subtasks||[],J={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Ct.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},Ce=[...T,J],Le={...B,subtasks:Ce};it(Le),Et(""),St(false);},[B,Ct,it]),gt=react.useCallback(T=>{if(!B?.subtasks)return;let J=B.subtasks.map(Le=>Le.id===T?{...Le,progress:Le.progress===100?0:100}:Le),Ce={...B,subtasks:J};it(Ce);},[B,it]),Ft=react.useCallback(T=>{if(!B?.subtasks)return;let J=B.subtasks.filter(Le=>Le.id!==T),Ce={...B,subtasks:J};it(Ce);},[B,it]),Rt=react.useCallback(T=>{let J=typeof T=="string"?new Date(T):T,Le=new Date().getTime()-J.getTime(),$t=Math.floor(Le/6e4),Nt=Math.floor(Le/36e5),Jt=Math.floor(Le/864e5);return $t<1?n==="es"?"Ahora":"Just now":$t<60?n==="es"?`Hace ${$t} min`:`${$t}m ago`:Nt<24?n==="es"?`Hace ${Nt}h`:`${Nt}h ago`:Jt<7?n==="es"?`Hace ${Jt}d`:`${Jt}d ago`:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Mt=react.useCallback(T=>{if(!B)return;let J=B.progress||0;T==="completed"?J=100:T==="in-progress"&&J===0?J=10:T==="todo"&&(J=0);let Ce={...B,status:T,progress:J};it(Ce),Ge(false);},[B,it]),Yt=react.useCallback((T,J)=>{if(!B)return;let Ce={...B,startDate:T,endDate:J};it(Ce);},[B,it]),Qt=react.useCallback(()=>{let T=$e.getFullYear(),J=$e.getMonth(),Ce=new Date(T,J,1),$t=new Date(T,J+1,0).getDate(),Nt=Ce.getDay(),Jt=[],Ua=new Date(T,J,0).getDate();for(let Ma=Nt-1;Ma>=0;Ma--)Jt.push({date:new Date(T,J-1,Ua-Ma),isCurrentMonth:false});for(let Ma=1;Ma<=$t;Ma++)Jt.push({date:new Date(T,J,Ma),isCurrentMonth:true});let ya=42-Jt.length;for(let Ma=1;Ma<=ya;Ma++)Jt.push({date:new Date(T,J+1,Ma),isCurrentMonth:false});return Jt},[$e]),Z=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),W(false),!B||!p)return;let J=Array.from(T.dataTransfer.files);if(J.length!==0){j(true);try{await p(B.id,J);}finally{j(false);}}},[B,p]),Oe=react.useCallback(async T=>{if(!B||!p||!T.target.files)return;let J=Array.from(T.target.files);if(J.length!==0){j(true);try{await p(B.id,J);}finally{j(false);}T.target.value="";}},[B,p]),Ae=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),W(true);},[]),I=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),W(false);},[]),xe=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),te=react.useCallback(T=>T.startsWith("image/")?lucideReact.Image:T.includes("pdf")||T.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:c("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:c("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:c("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:c("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=B.progress===100?0:100,Ce={...B,progress:T,status:T===100?"completed":"todo"};it(Ce);},className:c("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:je,onChange:T=>me(T.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:c("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{jt(),Ge(!fe);},className:c("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?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:fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ge(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(T=>jsxRuntime.jsxs("button",{onClick:()=>Mt(T.id),className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",B.status===T.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{jt(),Te(!ue);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((T,J)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},J)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(T=>{let J=B.assignees?.some(Ce=>Ce.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Ce=B.assignees||[],Le;J?Le=Ce.filter($t=>$t.name!==T.name):Le=[...Ce,T],mt("assignees",Le);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",J&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:c("flex-1",L?"text-white":"text-gray-900"),children:T.name}),J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsxRuntime.jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ue(ve?null:"start"),nt(B.startDate||new Date);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:c("mx-1",L?"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:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:c("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:c("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,J=new Date(T);J.setDate(T.getDate()+1);let Ce=new Date(T);Ce.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let Le=new Date(T);Le.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let $t=new Date(T);$t.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Nt=new Date(T);Nt.setDate(T.getDate()+14);let Jt=new Date(T);return Jt.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ce,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$t,display:$t.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Nt,display:Nt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Jt,display:Jt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ya,Ma)=>jsxRuntime.jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ve==="start"){let Sr=B.endDate&&ya.date>B.endDate?ya.date:B.endDate;Yt(ya.date,Sr),Ue("end");}else {let Sr=B.startDate&&ya.date<B.startDate?ya.date:B.startDate;Yt(Sr,ya.date),Ue(null);}},children:[jsxRuntime.jsx("span",{children:ya.label}),jsxRuntime.jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ya.display})]},Ma))})(),jsxRuntime.jsx("div",{className:c("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Yt(void 0,void 0),Ue(null);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children: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:c("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ve==="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:c("font-medium",L?"text-white":"text-gray-900"),children:$e.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:()=>nt(new Date),className:c("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>nt(new Date($e.getFullYear(),$e.getMonth()-1)),className:c("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>nt(new Date($e.getFullYear(),$e.getMonth()+1)),className:c("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsxRuntime.jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Qt().map((T,J)=>{let Ce=T.date.toDateString()===new Date().toDateString(),Le=B.startDate?.toDateString()===T.date.toDateString(),$t=B.endDate?.toDateString()===T.date.toDateString(),Nt=Le||$t,Jt=B.startDate&&B.endDate&&T.date>=B.startDate&&T.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Ua=new Date(T.date);if(ve==="start"){let ya=B.endDate&&Ua>B.endDate?Ua:B.endDate;Yt(Ua,ya),Ue("end");}else {let ya=B.startDate&&Ua<B.startDate?Ua:B.startDate;Yt(ya,Ua),Ue(null);}},className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(L?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#00E5CC]",Le&&"bg-[#00E5CC] text-white",$t&&!Le&&"bg-[#7C3AED] text-white",Jt&&!Nt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Nt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},J)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{jt(),ee(!O);},className:c("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?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:O&&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:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(T=>jsxRuntime.jsxs("button",{onClick:()=>{mt("priority",T.id),ee(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",B.priority===T.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${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:c("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ce?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:T=>{let J=parseInt(T.target.value),Ce=B.status;J===100?Ce="completed":J>0?Ce="in-progress":Ce="todo";let Le={...B,progress:J,status:Ce};it(Le);},onBlur:()=>Xe(false),className:c("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Xe(true),className:c("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:c("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:c("text-sm font-medium min-w-[40px]",L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"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:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?Pn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Pn(C.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:c("text-sm",L?"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(no,{mode:"estimate",locale:n,isDark:L,currentValue:C?.estimateMinutes||null,onSave:async T=>{await F?.(B.id,T),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ae?jsxRuntime.jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"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:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Pn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Pn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:c("text-sm",L?"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"&&!ae&&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(no,{mode:"quoted",locale:n,isDark:L,currentValue:B.quotedMinutes||null,onSave:async T=>{A?(await A(B.id,T),X(J=>J?{...J,quotedMinutes:T}:null)):mt("quotedMinutes",T),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"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:c("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):S?jsxRuntime.jsxs("button",{type:"button",onClick:()=>_?.(B.id),className:c("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"}),vh(M||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>w?.(B.id),className:c("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title: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:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"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:()=>Ke("log"),className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:c("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[Pn(C.loggedMinutes),C.estimateMinutes&&jsxRuntime.jsxs("span",{className:c("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",Pn(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:c("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: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(no,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(T,J)=>{T&&await k?.(B.id,{durationMinutes:T,note:J,source:"manual"}),Ke(false);},onClose:()=>Ke(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Lo,{selectedTags:B.tags||[],availableTags:d,onChange:T=>{mt("tags",T);},onCreateTag:i,theme:K})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:c("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0 mt-1",L?"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(T=>{let J=g.find(Ce=>Ce.id===T);return jsxRuntime.jsxs("span",{className:c("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[J?.name||T.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Ce=(B.dependencies||[]).filter(Le=>Le!==T);mt("dependencies",Ce);},className:c("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{jt(),ke(!_e);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ke(false),Bt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:c("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:bt,onChange:T=>Bt(T.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:c("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(T=>T.id!==B.id).filter(T=>bt===""||T.name.toLowerCase().includes(bt.toLowerCase())).map(T=>{let J=B.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Ce=B.dependencies||[],Le;J?Le=Ce.filter($t=>$t!==T.id):Le=[...Ce,T.id],mt("dependencies",Le);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",J&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:c("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",J?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:c("block truncate",L?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{jt(),Ve(!st);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:nn.find(T=>T.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ve(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:nn.map(T=>{let J=B.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{mt("color",T.value),Ve(false);},className:c("w-7 h-7 rounded-full flex items-center justify-center transition-all",J&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:J?T.value:void 0},title:T.name,children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"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:T=>mt("isMilestone",T.target.checked),className:c("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:se,value:re,onChange:T=>ne(T.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:c("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(T=>T.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((T,J)=>(T.position??0)-(J.position??0)).map(T=>jsxRuntime.jsxs("div",{className:c("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>gt(T.id),className:c("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",T.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:c("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("button",{onClick:()=>Ft(T.id),className:c("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),Wt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Ct,onChange:T=>Et(T.target.value),onKeyDown:T=>{T.key==="Enter"&&Ct.trim()?Ze():T.key==="Escape"&&(St(false),Et(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:c("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsxRuntime.jsx("button",{onClick:Ze,disabled:!Ct.trim(),className:c("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Ct.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{St(false),Et("");},className:c("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>St(true),className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:c("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(T=>{let J=te(T.type),Ce=T.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:c("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ce&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:c("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(J,{className:c("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:c("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:xe(T.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(T.id),className:c("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ae,onDragLeave:I,onDrop:Z,className:c("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Fe?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Oe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||D}),D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:c("w-6 h-6 mx-auto mb-2",Fe?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Fe?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"})]})}),!p&&jsxRuntime.jsx("p",{className:c("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:c("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:c("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
5
5
  .activity-comments-scroll::-webkit-scrollbar {
6
6
  width: 4px !important;
7
7
  }
@@ -15,8 +15,8 @@
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
16
  background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:zt,className:c("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((T,J)=>{let Ce=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,Le=typeof J.createdAt=="string"?new Date(J.createdAt):J.createdAt;return Ce.getTime()-Le.getTime()}).map(T=>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:T.user?.color||"#8B5CF6"},children:T.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:c("text-sm font-medium",L?"text-white":"text-gray-900"),children:T.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Rt(T.createdAt)})]}),jsxRuntime.jsx("div",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(qu,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(J=>{let Ce=J.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:J.url,target:"_blank",rel:"noopener noreferrer",className:c("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Ce?jsxRuntime.jsx(lucideReact.Image,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:c("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:J.name})]},J.id)})})]})]},T.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:c("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:c("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Ku,{value:ze,onChange:Be,onSubmit:Se,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:ct,theme:s,locale:n,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:ht,onFilesSelect:$,onRemoveFile:Y})})]})]})]})})}function Wl(){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 Ro({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:d,error:i,children:u,availableTags:p=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:f,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:S,timeTrackingSummary:M,timeEntries:k,timerState:P,onLogTime:A,onUpdateEstimate:w,onUpdateSoldEffort:_,onStartTimer:U,onStopTimer:ae,onDiscardTimer:L,blurFinancials:K=false,sidePanel:q,renderColumnMetrics:z,suppressDetailModal:B=false}){let[X,fe]=Wl(),[Ge,O]=react.useState(null),[ee,ue]=react.useState(false),Te=react.useRef(null),ve=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ue=o?.theme||"dark",$e=Ue==="dark"||Ue==="neutral",nt=$e?"dark":"",ce=react.useCallback((D,j)=>{t.onCardUpdate?.(D,j);},[t]),Xe=react.useCallback((D,j)=>{t.onColumnUpdate?.(D,{title:j});},[t]),_e=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),ke=["todo","in-progress","completed"],bt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Bt=react.useMemo(()=>{let D=new Map;return e.columns.forEach(j=>{let re=j.cardIds.map(Ne=>e.cards.find(H=>H.id===Ne)).filter(Ne=>Ne!==void 0).sort((Ne,H)=>Ne.position-H.position);D.set(j.id,re);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=Te.current;if(!D)return;let j=se=>{let je=se.target,we=se.button===1,He=je===D||je.classList.contains("asakaa-column")&&!je.closest(".asakaa-card");(we||se.button===0&&He&&!X.isDragging)&&(se.preventDefault(),ue(true),ve.current={x:se.clientX,y:se.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},re=se=>{if(!ee)return;let je=se.clientX-ve.current.x,we=se.clientY-ve.current.y;D.scrollLeft=ve.current.scrollLeft-je,D.scrollTop=ve.current.scrollTop-we;},Ne=()=>{ee&&(ue(false),D.style.cursor="",D.style.userSelect="");},H=()=>{ee&&(ue(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",j),document.addEventListener("mousemove",re),document.addEventListener("mouseup",Ne),D.addEventListener("mouseleave",H),()=>{D.removeEventListener("mousedown",j),document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",Ne),D.removeEventListener("mouseleave",H);}},[ee,X.isDragging]);let st=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(j=>typeof j=="string"?j:j.taskId):[]})),[e.cards]),Ve=react.useCallback(D=>{let{active:j}=D,re=e.cards.find(Ne=>Ne.id===j.id);re&&fe({isDragging:true,draggedCardId:re.id,sourceColumnId:re.columnId,targetColumnId:re.columnId});},[e.cards,fe]),tt=react.useCallback(D=>{let{active:j,over:re}=D;if(!re||!e.cards.find(se=>se.id===j.id))return;let H=null;re.data.current?.type==="column"?H=re.id:re.data.current?.type==="card"&&(H=e.cards.find(je=>je.id===re.id)?.columnId||null),H&&H!==X.targetColumnId&&fe({...X,targetColumnId:H});},[e.cards,X,fe]),Ke=react.useCallback(async D=>{let{active:j,over:re}=D;if(fe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!re)return;let Ne=e.cards.find(we=>we.id===j.id);if(!Ne)return;let H,se;if(re.data.current?.type==="column"){H=re.id;let we=Bt.get(H)||[];se=Tl(we,0);}else {let we=e.cards.find(Be=>Be.id===re.id);if(!we)return;H=we.columnId;let He=Bt.get(H)||[],ze=He.findIndex(Be=>Be.id===re.id);se=Tl(He,ze);}let je=e.columns.find(we=>we.id===H);if(je&&je.wipLimit&&je.wipLimitType==="hard"){let we=Bt.get(H)||[];if(Ne.columnId!==H&&we.length>=je.wipLimit){t.onWipLimitExceeded?.(je,Ne);return}}(Ne.columnId!==H||Ne.position!==se)&&await t.onCardMove?.(Ne.id,H,se);},[e.cards,e.columns,Bt,t,fe]),Pe=react.useCallback(D=>{B||O(D),a?.(D),C?.(D.id);},[a,C,B]),W=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),O(D);},[t]);return d?jsxRuntime.jsx("div",{className:c("asakaa-board",nt,n),style:l,children:jsxRuntime.jsx(Lh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:c("asakaa-board",nt,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(ku,{themeName:Ue,children:[jsxRuntime.jsxs("div",{className:c("flex h-full overflow-hidden",q?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:bt,collisionDetection:core$1.closestCorners,onDragStart:Ve,onDragOver:tt,onDragEnd:Ke,children:[jsxRuntime.jsxs("div",{ref:Te,className:c("asakaa-board",q?"flex-1":"",nt,n),style:{...l,cursor:ee?"grabbing":void 0},"data-theme":Ue,children:[e.columns.sort((D,j)=>D.position-j.position).map(D=>{let j=Bt.get(D.id)||[],re=!ke.includes(D.id),Ne=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(En,{column:D,cards:j,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:z?(H,se)=>z(H,se):void 0,onCardClick:Pe,onCardUpdate:ce,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?_e:void 0,isDeletable:re,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ne]},D.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:X.draggedCardId?jsxRuntime.jsx(yo,{card:e.cards.find(D=>D.id===X.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),q]}),!B&&jsxRuntime.jsx(vo,{task:Ge,isOpen:!!Ge,onClose:()=>O(null),onCardUpdate:W,theme:$e?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:m,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:st,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:S,timeTrackingSummary:M,timeEntries:k,isTimerRunning:P?.isRunning,timerElapsedSeconds:P?.elapsedSeconds,onTimeLog:A,onEstimateUpdate:w,onSoldEffortUpdate:_,onTimerStart:U,onTimerStop:ae,onTimerDiscard:L,blurFinancials:K})]})}function Lh({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 Oh={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)"},Hh={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)"},zh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Uh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Wh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let d=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,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor: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 Vh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,d]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let p=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,f)=>{if(f){d(g);try{await f();}catch(x){console.error(`Export ${g} failed:`,x);}finally{d(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:p.map((g,f)=>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:f<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===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 Gh({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 Gl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:d,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let m=r==="dark"?Oh:Hh,g={...o==="es"?zh:Uh,...i},f=n||l||d;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:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Vh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:d}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),p,t&&(s?jsxRuntime.jsx(Wh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsxRuntime.jsx(Gh,{onClick:()=>t(),label:a||g.newTask}))]})})}function _l({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,d]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),d(""),n(false));},[l,e]),u=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(d(""),n(false));},[i]),p=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:c("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=>d(m.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick: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:()=>{d(""),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:c("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 sn({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[d,i]=react.useState(""),[u,p]=react.useState(void 0),[m,g]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(false),[h,v]=react.useState(false),[C,N]=react.useState(false),[S,M]=react.useState(s||new Date),k=react.useRef(null),P=o==="es",A=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{k.current?.focus();},[]);let w=react.useCallback(()=>{b(false),v(false),N(false);},[]),_=react.useCallback(()=>{i(""),p(void 0),g(null),x(null),w(),t();},[t,w]),U=react.useCallback(()=>{let K=d.trim();if(!K)return;let q=a.find(B=>B.id===m),z=f||s;e({name:K,priority:u,assignee:q||void 0,assigneeId:m,startDate:z,endDate:z}),i(""),p(void 0),g(null),x(null),w(),k.current?.focus();},[d,u,m,f,s,a,e,w]),ae=react.useCallback(K=>{K.key==="Enter"&&d.trim()&&(K.preventDefault(),U()),K.key==="Escape"&&_();},[U,_,d]),L=f||s||new Date;return jsxRuntime.jsxs("div",{className:c("quick-task-create",n),onClick:()=>w(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:k,type:"text",value:d,onChange:K=>i(K.target.value),placeholder:P?"Nombre de la tarea...":"Task name...",className:c("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:ae})}),jsxRuntime.jsxs("div",{className:c("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:K=>{K.stopPropagation(),b(!y),v(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[{id:"urgent",label:P?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:P?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:P?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:P?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:P?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(K=>jsxRuntime.jsxs("button",{onClick:()=>{p(K.id),b(false);},type:"button",className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===K.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",K.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:K.label})]},K.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:K=>{K.stopPropagation(),N(!C),b(false),v(false),M(f||s||new Date);},type:"button",className:c("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-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"}),L.toLocaleDateString(P?"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:c("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsx("div",{className:c("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let K=new Date,q=new Date(K);q.setDate(K.getDate()+1);let z=new Date(K);z.setDate(K.getDate()+((6-K.getDay()+7)%7||7));let B=new Date(K);B.setDate(K.getDate()+((1-K.getDay()+7)%7||7));let X=new Date(K);X.setDate(K.getDate()+14);let fe=new Date(K);fe.setDate(K.getDate()+28);let Ge=P?"es-ES":"en-US";return [{label:P?"Hoy":"Today",date:K,display:K.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:P?"Ma\xF1ana":"Tomorrow",date:q,display:q.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:P?"Este fin de semana":"This weekend",date:z,display:P?"s\xE1b.":"sat."},{label:P?"Pr\xF3xima semana":"Next week",date:B,display:P?"lun.":"mon."},{label:P?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:P?"4 semanas":"4 weeks",date:fe,display:fe.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((ee,ue)=>jsxRuntime.jsxs("button",{type:"button",className:c("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(ee.date),N(false);},children:[jsxRuntime.jsx("span",{children:ee.label}),jsxRuntime.jsx("span",{className:c("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ee.display})]},ue))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:c("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:S.toLocaleDateString(P?"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:()=>M(new Date),className:c("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:P?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>M(new Date(S.getFullYear(),S.getMonth()-1)),className:c("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:()=>M(new Date(S.getFullYear(),S.getMonth()+1)),className:c("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:(P?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(K=>jsxRuntime.jsx("div",{className:c("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:K},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let K=S.getFullYear(),q=S.getMonth(),z=new Date(K,q,1).getDay(),B=new Date(K,q+1,0).getDate(),X=new Date(K,q,0).getDate(),fe=new Date().toDateString(),Ge=[];for(let ee=z-1;ee>=0;ee--)Ge.push({dayNum:X-ee,isCurrent:false,date:new Date(K,q-1,X-ee)});for(let ee=1;ee<=B;ee++)Ge.push({dayNum:ee,isCurrent:true,date:new Date(K,q,ee)});let O=42-Ge.length;for(let ee=1;ee<=O;ee++)Ge.push({dayNum:ee,isCurrent:false,date:new Date(K,q+1,ee)});return Ge.map((ee,ue)=>{let Te=ee.date.toDateString()===fe,ve=(f||s)?.toDateString()===ee.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ee.isCurrent&&(r?"text-white/20":"text-gray-300"),ee.isCurrent&&(r?"text-white":"text-gray-900"),Te&&"ring-1 ring-[#007FFF]",ve&&"bg-[#007FFF] text-white",!ve&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(ee.date),N(false);},children:ee.dayNum},ue)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:K=>{K.stopPropagation(),v(!h),b(false),N(false);},type:"button",className:c("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(K=>K.id===m)?.color||"#007FFF"},children:a.find(K=>K.id===m)?.initials||a.find(K=>K.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),v(false);},className:c("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:c("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:P?"Sin asignar":"Unassigned"})]}),a.map(K=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(K.id),v(false);},className:c("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===K.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:K.color||"#007FFF"},children:K.initials||K.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:K.name})]},K.id)),a.length===0&&jsxRuntime.jsx("div",{className:c("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:P?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:U,disabled:!d.trim(),type:"button",className:c("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",d.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:P?"Guardar":"Save"})]})]})}function Jl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[d,i]=react.useState(false),u=react.useRef(null),p=react.useRef(null),[m,g]=react.useState({}),[f,x]=react.useState(false),y=n==="dark",h={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!d||!u.current)return;let C=90,N=()=>{let S=u.current.getBoundingClientRect(),k=window.innerHeight-S.bottom<C+8;x(k),g({position:"fixed",...k?{bottom:window.innerHeight-S.top+4}:{top:S.bottom+4},left:S.left,width:S.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[d]),react.useEffect(()=>{if(!d)return;let C=N=>{let S=N.target;p.current&&!p.current.contains(S)&&u.current&&!u.current.contains(S)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]);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:u,className:c("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!d),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"})]}),h.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:m,className:c("rounded-lg shadow-2xl",y?"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(sn,{onSubmit:v,onCancel:()=>i(false),availableUsers:a,isDark:y,locale:l,dropdownDirection:"up"})})}),document.body)]})}var bs=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(Ro,{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 Dp(e={}){return new bs(e)}var Pn=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(Pn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ed({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[p,m]=react.useState(false),[g,f]=react.useState(""),[x,y]=react.useState("home"),[b,h]=react.useState(""),[v,C]=react.useState("");react.useEffect(()=>{let k=P=>{(P.metaKey||P.ctrlKey)&&P.key===i&&(P.preventDefault(),m(A=>!A)),P.key==="Escape"&&(m(false),y("home"),f(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{p||(y("home"),f(""),h(""),C(""));},[p]);let N=react.useCallback(()=>{m(false);},[]),S=react.useCallback(k=>{let[P,A]=k.split(":");switch(P){case "create-card":y("create-card");break;case "create-card-in":h(A||"");break;case "navigate":A?(a?.(A),N()):y("navigate");break;case "search":r?.(g),N();break;case "priority":y("priority");break;case "set-priority":v&&A&&(o?.(v,A),N());break;case "assign":y("assign");break;case "assign-user":v&&A&&(s?.(v,A),N());break;case "ai":y("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":d?.(),N();break;case "back":y("home");break;}},[g,v,t,a,r,o,s,n,l,d,N]),M=react.useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),N());},[b,g,t,N]);return p?jsxRuntime.jsx(ta,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:f,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&M();}}),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:S,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:S,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:S,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:S,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(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},k.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:S,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:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(k=>{let P=e.columns.find(A=>A.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:S,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:P?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},k.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 Mp(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:zt,className:c("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((T,J)=>{let Ce=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,Le=typeof J.createdAt=="string"?new Date(J.createdAt):J.createdAt;return Ce.getTime()-Le.getTime()}).map(T=>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:T.user?.color||"#8B5CF6"},children:T.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:c("text-sm font-medium",L?"text-white":"text-gray-900"),children:T.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Rt(T.createdAt)})]}),jsxRuntime.jsx("div",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(qu,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(J=>{let Ce=J.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:J.url,target:"_blank",rel:"noopener noreferrer",className:c("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Ce?jsxRuntime.jsx(lucideReact.Image,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:c("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:J.name})]},J.id)})})]})]},T.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:c("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:c("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Ku,{value:ze,onChange:Be,onSubmit:Se,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:ct,theme:s,locale:n,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:ht,onFilesSelect:$,onRemoveFile:Y})})]})]})]})})}function Wl(){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 Ro({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:d,error:i,children:u,availableTags:p=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:f,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:S,timeTrackingSummary:M,timeEntries:k,timerState:F,onLogTime:A,onUpdateEstimate:w,onUpdateSoldEffort:_,onStartTimer:U,onStopTimer:ae,onDiscardTimer:L,blurFinancials:K=false,sidePanel:q,renderColumnMetrics:z,suppressDetailModal:B=false}){let[X,fe]=Wl(),[Ge,O]=react.useState(null),[ee,ue]=react.useState(false),Te=react.useRef(null),ve=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ue=o?.theme||"dark",$e=Ue==="dark"||Ue==="neutral",nt=$e?"dark":"",ce=react.useCallback((D,j)=>{t.onCardUpdate?.(D,j);},[t]),Xe=react.useCallback((D,j)=>{t.onColumnUpdate?.(D,{title:j});},[t]),_e=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),ke=["todo","in-progress","completed"],bt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Bt=react.useMemo(()=>{let D=new Map;return e.columns.forEach(j=>{let re=j.cardIds.map(Ne=>e.cards.find(H=>H.id===Ne)).filter(Ne=>Ne!==void 0).sort((Ne,H)=>Ne.position-H.position);D.set(j.id,re);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=Te.current;if(!D)return;let j=se=>{let je=se.target,we=se.button===1,He=je===D||je.classList.contains("asakaa-column")&&!je.closest(".asakaa-card");(we||se.button===0&&He&&!X.isDragging)&&(se.preventDefault(),ue(true),ve.current={x:se.clientX,y:se.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},re=se=>{if(!ee)return;let je=se.clientX-ve.current.x,we=se.clientY-ve.current.y;D.scrollLeft=ve.current.scrollLeft-je,D.scrollTop=ve.current.scrollTop-we;},Ne=()=>{ee&&(ue(false),D.style.cursor="",D.style.userSelect="");},H=()=>{ee&&(ue(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",j),document.addEventListener("mousemove",re),document.addEventListener("mouseup",Ne),D.addEventListener("mouseleave",H),()=>{D.removeEventListener("mousedown",j),document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",Ne),D.removeEventListener("mouseleave",H);}},[ee,X.isDragging]);let st=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(j=>typeof j=="string"?j:j.taskId):[]})),[e.cards]),Ve=react.useCallback(D=>{let{active:j}=D,re=e.cards.find(Ne=>Ne.id===j.id);re&&fe({isDragging:true,draggedCardId:re.id,sourceColumnId:re.columnId,targetColumnId:re.columnId});},[e.cards,fe]),tt=react.useCallback(D=>{let{active:j,over:re}=D;if(!re||!e.cards.find(se=>se.id===j.id))return;let H=null;re.data.current?.type==="column"?H=re.id:re.data.current?.type==="card"&&(H=e.cards.find(je=>je.id===re.id)?.columnId||null),H&&H!==X.targetColumnId&&fe({...X,targetColumnId:H});},[e.cards,X,fe]),Ke=react.useCallback(async D=>{let{active:j,over:re}=D;if(fe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!re)return;let Ne=e.cards.find(we=>we.id===j.id);if(!Ne)return;let H,se;if(re.data.current?.type==="column"){H=re.id;let we=Bt.get(H)||[];se=Tl(we,0);}else {let we=e.cards.find(Be=>Be.id===re.id);if(!we)return;H=we.columnId;let He=Bt.get(H)||[],ze=He.findIndex(Be=>Be.id===re.id);se=Tl(He,ze);}let je=e.columns.find(we=>we.id===H);if(je&&je.wipLimit&&je.wipLimitType==="hard"){let we=Bt.get(H)||[];if(Ne.columnId!==H&&we.length>=je.wipLimit){t.onWipLimitExceeded?.(je,Ne);return}}(Ne.columnId!==H||Ne.position!==se)&&await t.onCardMove?.(Ne.id,H,se);},[e.cards,e.columns,Bt,t,fe]),Fe=react.useCallback(D=>{B||O(D),a?.(D),C?.(D.id);},[a,C,B]),W=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),O(D);},[t]);return d?jsxRuntime.jsx("div",{className:c("asakaa-board",nt,n),style:l,children:jsxRuntime.jsx(Lh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:c("asakaa-board",nt,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(ku,{themeName:Ue,children:[jsxRuntime.jsxs("div",{className:c("flex h-full overflow-hidden",q?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:bt,collisionDetection:core$1.closestCorners,onDragStart:Ve,onDragOver:tt,onDragEnd:Ke,children:[jsxRuntime.jsxs("div",{ref:Te,className:c("asakaa-board",q?"flex-1":"",nt,n),style:{...l,cursor:ee?"grabbing":void 0},"data-theme":Ue,children:[e.columns.sort((D,j)=>D.position-j.position).map(D=>{let j=Bt.get(D.id)||[],re=!ke.includes(D.id),Ne=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(En,{column:D,cards:j,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:z?(H,se)=>z(H,se):void 0,onCardClick:Fe,onCardUpdate:ce,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?_e:void 0,isDeletable:re,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ne]},D.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:X.draggedCardId?jsxRuntime.jsx(yo,{card:e.cards.find(D=>D.id===X.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),q]}),!B&&jsxRuntime.jsx(vo,{task:Ge,isOpen:!!Ge,onClose:()=>O(null),onCardUpdate:W,theme:$e?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:m,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:st,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:S,timeTrackingSummary:M,timeEntries:k,isTimerRunning:F?.isRunning,timerElapsedSeconds:F?.elapsedSeconds,onTimeLog:A,onEstimateUpdate:w,onSoldEffortUpdate:_,onTimerStart:U,onTimerStop:ae,onTimerDiscard:L,blurFinancials:K})]})}function Lh({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 Oh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Hh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},zh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Uh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Wh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let d=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, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children: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,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor: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 Vh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,d]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let p=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,f)=>{if(f){d(g);try{await f();}catch(x){console.error(`Export ${g} failed:`,x);}finally{d(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:p.map((g,f)=>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:f<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===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 Gh({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Gl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:d,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let m=r==="dark"?Oh:Hh,g={...o==="es"?zh:Uh,...i},f=n||l||d;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:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Vh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:d}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),p,t&&(s?jsxRuntime.jsx(Wh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsxRuntime.jsx(Gh,{onClick:()=>t(),label:a||g.newTask}))]})})}function _l({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,d]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),d(""),n(false));},[l,e]),u=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(d(""),n(false));},[i]),p=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:c("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=>d(m.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick: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:()=>{d(""),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:c("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 sn({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[d,i]=react.useState(""),[u,p]=react.useState(void 0),[m,g]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(false),[h,v]=react.useState(false),[C,N]=react.useState(false),[S,M]=react.useState(s||new Date),k=react.useRef(null),F=o==="es",A=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{k.current?.focus();},[]);let w=react.useCallback(()=>{b(false),v(false),N(false);},[]),_=react.useCallback(()=>{i(""),p(void 0),g(null),x(null),w(),t();},[t,w]),U=react.useCallback(()=>{let K=d.trim();if(!K)return;let q=a.find(B=>B.id===m),z=f||s;e({name:K,priority:u,assignee:q||void 0,assigneeId:m,startDate:z,endDate:z}),i(""),p(void 0),g(null),x(null),w(),k.current?.focus();},[d,u,m,f,s,a,e,w]),ae=react.useCallback(K=>{K.key==="Enter"&&d.trim()&&(K.preventDefault(),U()),K.key==="Escape"&&_();},[U,_,d]),L=f||s||new Date;return jsxRuntime.jsxs("div",{className:c("quick-task-create",n),onClick:()=>w(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:k,type:"text",value:d,onChange:K=>i(K.target.value),placeholder:F?"Nombre de la tarea...":"Task name...",className:c("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:ae})}),jsxRuntime.jsxs("div",{className:c("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:K=>{K.stopPropagation(),b(!y),v(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.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(K=>jsxRuntime.jsxs("button",{onClick:()=>{p(K.id),b(false);},type:"button",className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===K.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",K.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:K.label})]},K.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:K=>{K.stopPropagation(),N(!C),b(false),v(false),M(f||s||new Date);},type:"button",className:c("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),L.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:c("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsx("div",{className:c("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let K=new Date,q=new Date(K);q.setDate(K.getDate()+1);let z=new Date(K);z.setDate(K.getDate()+((6-K.getDay()+7)%7||7));let B=new Date(K);B.setDate(K.getDate()+((1-K.getDay()+7)%7||7));let X=new Date(K);X.setDate(K.getDate()+14);let fe=new Date(K);fe.setDate(K.getDate()+28);let Ge=F?"es-ES":"en-US";return [{label:F?"Hoy":"Today",date:K,display:K.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:F?"Ma\xF1ana":"Tomorrow",date:q,display:q.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:F?"Este fin de semana":"This weekend",date:z,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:X,display:X.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:F?"4 semanas":"4 weeks",date:fe,display:fe.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((ee,ue)=>jsxRuntime.jsxs("button",{type:"button",className:c("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(ee.date),N(false);},children:[jsxRuntime.jsx("span",{children:ee.label}),jsxRuntime.jsx("span",{className:c("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ee.display})]},ue))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:c("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:S.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:()=>M(new Date),className:c("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:()=>M(new Date(S.getFullYear(),S.getMonth()-1)),className:c("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:()=>M(new Date(S.getFullYear(),S.getMonth()+1)),className:c("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(K=>jsxRuntime.jsx("div",{className:c("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:K},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let K=S.getFullYear(),q=S.getMonth(),z=new Date(K,q,1).getDay(),B=new Date(K,q+1,0).getDate(),X=new Date(K,q,0).getDate(),fe=new Date().toDateString(),Ge=[];for(let ee=z-1;ee>=0;ee--)Ge.push({dayNum:X-ee,isCurrent:false,date:new Date(K,q-1,X-ee)});for(let ee=1;ee<=B;ee++)Ge.push({dayNum:ee,isCurrent:true,date:new Date(K,q,ee)});let O=42-Ge.length;for(let ee=1;ee<=O;ee++)Ge.push({dayNum:ee,isCurrent:false,date:new Date(K,q+1,ee)});return Ge.map((ee,ue)=>{let Te=ee.date.toDateString()===fe,ve=(f||s)?.toDateString()===ee.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ee.isCurrent&&(r?"text-white/20":"text-gray-300"),ee.isCurrent&&(r?"text-white":"text-gray-900"),Te&&"ring-1 ring-[#007FFF]",ve&&"bg-[#007FFF] text-white",!ve&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(ee.date),N(false);},children:ee.dayNum},ue)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:K=>{K.stopPropagation(),v(!h),b(false),N(false);},type:"button",className:c("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(K=>K.id===m)?.color||"#007FFF"},children:a.find(K=>K.id===m)?.initials||a.find(K=>K.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),v(false);},className:c("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:c("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(K=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(K.id),v(false);},className:c("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===K.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:K.color||"#007FFF"},children:K.initials||K.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:K.name})]},K.id)),a.length===0&&jsxRuntime.jsx("div",{className:c("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:U,disabled:!d.trim(),type:"button",className:c("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",d.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[d,i]=react.useState(false),u=react.useRef(null),p=react.useRef(null),[m,g]=react.useState({}),[f,x]=react.useState(false),y=n==="dark",h={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!d||!u.current)return;let C=90,N=()=>{let S=u.current.getBoundingClientRect(),k=window.innerHeight-S.bottom<C+8;x(k),g({position:"fixed",...k?{bottom:window.innerHeight-S.top+4}:{top:S.bottom+4},left:S.left,width:S.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[d]),react.useEffect(()=>{if(!d)return;let C=N=>{let S=N.target;p.current&&!p.current.contains(S)&&u.current&&!u.current.contains(S)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]);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:u,className:c("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!d),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"})]}),h.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:m,className:c("rounded-lg shadow-2xl",y?"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(sn,{onSubmit:v,onCancel:()=>i(false),availableUsers:a,isDark:y,locale:l,dropdownDirection:"up"})})}),document.body)]})}var bs=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(Ro,{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 Dp(e={}){return new bs(e)}var Fn=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(Fn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ed({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[p,m]=react.useState(false),[g,f]=react.useState(""),[x,y]=react.useState("home"),[b,h]=react.useState(""),[v,C]=react.useState("");react.useEffect(()=>{let k=F=>{(F.metaKey||F.ctrlKey)&&F.key===i&&(F.preventDefault(),m(A=>!A)),F.key==="Escape"&&(m(false),y("home"),f(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{p||(y("home"),f(""),h(""),C(""));},[p]);let N=react.useCallback(()=>{m(false);},[]),S=react.useCallback(k=>{let[F,A]=k.split(":");switch(F){case "create-card":y("create-card");break;case "create-card-in":h(A||"");break;case "navigate":A?(a?.(A),N()):y("navigate");break;case "search":r?.(g),N();break;case "priority":y("priority");break;case "set-priority":v&&A&&(o?.(v,A),N());break;case "assign":y("assign");break;case "assign-user":v&&A&&(s?.(v,A),N());break;case "ai":y("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":d?.(),N();break;case "back":y("home");break;}},[g,v,t,a,r,o,s,n,l,d,N]),M=react.useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),N());},[b,g,t,N]);return p?jsxRuntime.jsx(ta,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:f,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&M();}}),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:S,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:S,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:S,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:S,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(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:F},F))})]},k.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:S,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:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(k=>{let F=e.columns.find(A=>A.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:S,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:F?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},k.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 Mp(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=f=>{f.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(p),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(d),document.body.appendChild(n),setTimeout(()=>{d.style.transition="opacity 0.5s ease",d.style.opacity="0";},2e3);}function ny(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 sy(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 ad(e){return e.startsWith("image/")}function lo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[d,i]=react.useState(false),[u,p]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let f=react.useCallback((k,P)=>{P.preventDefault(),P.stopPropagation();let A=g.current.filter(U=>ad(U.type)),w=A.findIndex(U=>U.id===k.id),_=U=>{let ae=g.current.filter(K=>ad(K.type)),L=ae[U];L&&Mp(L.url,L.name,ae,U,_);};Mp(k.url,k.name,A,w,_);},[]),x=react.useCallback(k=>{let P=[],A=[];return e.length+k.length>s?(A.push(`Maximum ${s} files allowed`),{valid:P,errors:A}):(k.forEach(w=>{if(w.size/1048576>r){A.push(`${w.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>w.type.match(U))){A.push(`${w.name} has invalid file type`);return}P.push(w);}),{valid:P,errors:A})},[e.length,s,r,o]),y=react.useCallback(async k=>{let{valid:P,errors:A}=x(k);if(A.length>0){p(A.join(", ")),setTimeout(()=>p(null),5e3);return}if(P.length!==0){i(true),p(null);try{await t?.(P);}catch(w){p(w instanceof Error?w.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[x,t]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),h=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),C=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let P=Array.from(k.dataTransfer.files);y(P);},[y]),N=react.useCallback(k=>{let P=k.target.files?Array.from(k.target.files):[];y(P),m.current&&(m.current.value="");},[y]),S=react.useCallback(()=>{m.current?.click();},[]),M=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${d?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:C,onClick:S,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:d?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"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:ad(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:P=>f(k,P),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.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:sy(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:ny(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>M(k.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"})})})]},k.id))})]})}function rd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:p,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:f,onGenerateSubtasks:x,onEstimateEffort:y,currentUserId:b="user-1"}){let[h,v]=react.useState("details"),[C,N]=react.useState(false),[S,M]=react.useState({}),[k,P]=react.useState(""),[A,w]=react.useState(false),[_,U]=react.useState({});if(!t||!e)return null;let ae=react.useCallback(()=>{N(false),M({}),v("details"),P(""),U({}),a();},[a]),L=react.useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),M({}),N(false));},[e.id,S,r]),K=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ae());},[e.id,o,ae]),q=react.useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),P(""));},[e.id,k,u]),z=react.useCallback(async()=>{if(f){w(true);try{let O=await f(e);U(ee=>({...ee,assignees:O}));}catch(O){console.error("Failed to suggest assignee:",O);}finally{w(false);}}},[e,f]),B=react.useCallback(async()=>{if(x){w(true);try{let O=await x(e);U(ee=>({...ee,subtasks:O}));}catch(O){console.error("Failed to generate subtasks:",O);}finally{w(false);}}},[e,x]),X=react.useCallback(async()=>{if(y){w(true);try{let O=await y(e);U(ee=>({...ee,effort:O}));}catch(O){console.error("Failed to estimate effort:",O);}finally{w(false);}}},[e,y]),fe={...e,...S},Ge=s.filter(O=>fe.assignedUserIds?.includes(O.id));return jsxRuntime.jsx(ta,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:ae,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:O=>O.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:S.title??fe.title,onChange:O=>M({...S,title:O.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:fe.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),M({});},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:K,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:ae,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 ${h==="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 ${h==="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 ${h==="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 ${h==="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 ${h==="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:[h==="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:S.description??fe.description??"",onChange:O=>M({...S,description:O.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:fe.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:S.assignedUserIds??fe.assignedUserIds??[],onChange:O=>{let ee=Array.from(O.target.selectedOptions,ue=>ue.value);M({...S,assignedUserIds:ee});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(O=>jsxRuntime.jsx("option",{value:O.id,children:O.name},O.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ge.length>0?Ge.map(O=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:O.color},children:O.initials}),jsxRuntime.jsx("span",{children:O.name})]},O.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:S.priority??fe.priority??"",onChange:O=>M({...S,priority:O.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:fe.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:fe.labels&&fe.labels.length>0?fe.labels.map(O=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:O},O)):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:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:fe.startDate?new Date(fe.startDate).toISOString().split("T")[0]:"",onChange:O=>M({...S,startDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.startDate?new Date(fe.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:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:fe.endDate?new Date(fe.endDate).toISOString().split("T")[0]:"",onChange:O=>M({...S,endDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.endDate?new Date(fe.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:S.estimatedTime??fe.estimatedTime??"",onChange:O=>M({...S,estimatedTime:O.target.value?parseFloat(O.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:fe.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:fe.dependencies&&fe.dependencies.length>0?fe.dependencies.map(O=>{let ee=typeof O=="string"?O:O.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ee.slice(-4)]},ee)}):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:fe.createdAt?new Date(fe.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:O=>P(O.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:q,disabled:!k.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(O=>{let ee=s.find(ue=>ue.id===O.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:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ee?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(O.createdAt).toLocaleString()})]})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(O.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:O.content})]},O.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"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(O=>{let ee=s.find(ue=>ue.id===O.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("COMMENT")&&"\u{1F4AC}",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",O.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:ee?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:O.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.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"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(lo,{cardId:e.id,attachments:i,onUpload:m?O=>m(e.id,O):void 0,onDelete:g,currentUserId:b,maxSizeMB:10,maxFiles:20})}),h==="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:z,disabled:A||!f,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:A||!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:X,disabled:A||!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("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((O,ee)=>{let ue=s.find(Te=>Te.id===O.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ue&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ue.color},children:ue.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ue?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:O.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(O.confidence*100).toFixed(0),"%"]})]})]},ee)})]}),_.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((O,ee)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:O.title}),O.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:O.description}),O.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",O.estimatedTime,"h"]})]},ee))]}),_.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:[_.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.map(O=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${O.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:O.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:O.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:O.description}),O.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",O.suggestedAction]})]},O.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&d.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 ys({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,d]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let p=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,f=4,x=p.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let y=m-p.bottom,b=p.top,h;return y>=s+f?h=p.bottom+f:b>=s+f?h=p.top-s-f:y>=b?h=p.bottom+f:h=Math.max(10,p.top-s-f),{top:h,left:x}},[e,o,s]);return react.useEffect(()=>{t&&d(u());},[t,u]),react.useEffect(()=>{if(!t)return;let p=g=>{let f=g.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",p);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",p);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let p=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),t?jsxRuntime.jsx(ta,{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 xt={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 gy=["LOW","MEDIUM","HIGH","URGENT"],fy=["todo","in-progress","review","done"];function sd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:p,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:f=[],availableLabels:x=[],availableTags:y=[],onCreateTag:b,onUploadCoverImage:h,unsplashAccessKey:v,theme:C,onSubtasksChange:N,attachments:S=[],onUploadAttachments:M,onDeleteAttachment:k}){let P=Nn(),A=C||P?.themeName||"dark",[w,_]=react.useState(e),[U,ae]=react.useState(false),[L,K]=react.useState(()=>[...e?.subtasks||[]].sort((Y,Se)=>(Y.position??0)-(Se.position??0))),[q,z]=react.useState(false),[B,X]=react.useState(""),[fe,Ge]=react.useState(""),[O,ee]=react.useState("all"),[ue,Te]=react.useState(false),[ve,Ue]=react.useState(false),[$e,nt]=react.useState(false),[ce,Xe]=react.useState(false),[_e,ke]=react.useState(false),[bt,Bt]=react.useState(false),st=react.useRef(null),Ve=react.useRef(null),tt=react.useRef(null),Ke=react.useRef(null),Pe=react.useRef(null),W=react.useRef(null),D=react.useRef(null),j=react.useRef(null),re=react.useRef(null),Ne=react.useRef(null),H=react.useRef(null),se=react.useRef(null);react.useEffect(()=>{if(e&&!w){_({...e});let $=[...e.subtasks||[]].sort((Y,Se)=>(Y.position??0)-(Se.position??0));K($);}else if(e&&w&&e.id!==w.id){_({...e});let $=[...e.subtasks||[]].sort((Y,Se)=>(Y.position??0)-(Se.position??0));K($);}},[e,w]),react.useEffect(()=>{let $=Y=>{let Se=Y.target;Ke.current&&!Ke.current.contains(Se)&&Te(false),Pe.current&&!Pe.current.contains(Se)&&Ue(false),W.current&&!W.current.contains(Se)&&nt(false),D.current&&!D.current.contains(Se)&&Xe(false);};if(ue||ve||$e||ce)return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[ue,ve,$e,ce]),react.useEffect(()=>{if(!t)return;let $=Y=>{let Se=Y.target,Ze=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(Y.key==="Escape"){Y.preventDefault(),ue||ve||$e||ce||_e||bt?(Te(false),Ue(false),nt(false),Xe(false),ke(false),Bt(false)):Ze||a();return}if(Ze&&Y.key!=="Escape")return;let gt=Y.metaKey||Y.ctrlKey;switch(Y.key.toLowerCase()){case "s":Y.preventDefault(),Te(true);break;case "a":Y.preventDefault(),nt(true);break;case "p":Y.preventDefault(),Ue(true);break;case "l":Y.preventDefault(),Xe(true);break;case "d":gt||(Y.preventDefault(),ke(true),setTimeout(()=>j.current?.focus(),0));break;case "e":gt||(Y.preventDefault(),Bt(true));break;case "i":Y.preventDefault(),ae(true),setTimeout(()=>Ve.current?.focus(),0);break;case "t":Y.preventDefault(),z(true);break;case "c":Y.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,a,ue,ve,$e,ce,_e,bt]);let je=react.useCallback($=>{let Y=$.currentTarget.textContent?.trim()||"";if(w&&Y!==w.title){let Se={...w,title:Y};_(Se),r?.(w.id,{title:Y});}},[w,r]),we=react.useCallback($=>{$.key==="Enter"&&($.preventDefault(),$.currentTarget.blur()),$.key==="Escape"&&($.preventDefault(),$.currentTarget.textContent=w?.title||"",$.currentTarget.blur());},[w]),He=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),ae(false);},[w,e,r]),ze=react.useCallback($=>{if(w){let Y={...w,columnId:$};_(Y),r?.(w.id,{columnId:$}),Te(false);}},[w,r]),Be=react.useCallback($=>{if(w){let Y={...w,priority:$};_(Y),r?.(w.id,{priority:$}),Ue(false);}},[w,r]),ct=react.useCallback($=>{if(w){let Y=w.assignedUserIds||[],Se=Y.includes($)?Y.filter(gt=>gt!==$):[...Y,$],Ze={...w,assignedUserIds:Se};_(Ze),r?.(w.id,{assignedUserIds:Se});}},[w,r]),ut=react.useCallback($=>{if(w){let Y=w.labels||[],Se=Y.includes($)?Y.filter(gt=>gt!==$):[...Y,$],Ze={...w,labels:Se};_(Ze),r?.(w.id,{labels:Se});}},[w,r]),ht=react.useCallback($=>{if(w){let Y={...w,tags:$};_(Y),r?.(w.id,{tags:$});}},[w,r]),pt=react.useCallback($=>{if(w){let Y=$.target.value,Se={...w,endDate:Y};_(Se),r?.(w.id,{endDate:Y}),ke(false);}},[w,r]),Ct=react.useCallback($=>{if(w){let Y={...w,estimatedTime:parseFloat($)||0};_(Y),r?.(w.id,{estimatedTime:parseFloat($)||0});}},[w,r]),Et=react.useCallback(()=>{if(B.trim()&&w){let $={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:L.length,createdAt:new Date},Y=[...L,$];K(Y),X(""),z(false),N?.(w.id,Y);}},[B,L,w,N]),Wt=react.useCallback($=>{let Y=L.map(Se=>Se.id===$?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);K(Y),w&&N?.(w.id,Y);},[L,w,N]),St=react.useCallback($=>{let Y=L.filter(Se=>Se.id!==$);K(Y),w&&N?.(w.id,Y);},[L,w,N]),zt=react.useCallback(()=>{fe.trim()&&w&&d&&(d(w.id,fe.trim()),Ge(""));},[fe,w,d]),it=react.useCallback($=>{($.metaKey||$.ctrlKey)&&$.key==="Enter"&&($.preventDefault(),zt());},[zt]),jt=$=>jsxRuntime.jsx(uy__default.default,{remarkPlugins:[py__default.default],rehypePlugins:[my__default.default],components:{a:({node:Y,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:$}),mt=l.filter($=>O==="comments"?$.type.includes("COMMENT"):O==="history"?!$.type.includes("COMMENT"):true);if(!t||!e)return null;let lt=w||e,ne=s.filter($=>lt.assignedUserIds?.includes($.id)),me=L.filter($=>$.completed).length;return jsxRuntime.jsx(ta,{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:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:st,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:je,onKeyDown:we,children:lt.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:Ke,children:[jsxRuntime.jsxs("button",{ref:re,className:"modal-v2-field",onClick:()=>Te(!ue),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:lt.columnId||"No status"})]}),jsxRuntime.jsx(ys,{triggerRef:re,isOpen:ue,onClose:()=>Te(false),width:250,estimatedHeight:200,children:(f.length>0?f:fy.map($=>({id:$,title:$}))).map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${lt.columnId===$.id?"active":""}`,onClick:()=>ze($.id),children:$.title},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:W,children:[jsxRuntime.jsxs("button",{ref:Ne,className:"modal-v2-field",onClick:()=>nt(!$e),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:ne.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ne.map($=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:$.color},title:$.name,children:$.initials},$.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ys,{triggerRef:Ne,isOpen:$e,onClose:()=>nt(false),width:280,estimatedHeight:300,children:s.map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${lt.assignedUserIds?.includes($.id)?"active":""}`,onClick:()=>ct($.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:$.color},children:$.initials}),$.name,lt.assignedUserIds?.includes($.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"})})]},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Pe,children:[jsxRuntime.jsxs("button",{ref:H,className:"modal-v2-field",onClick:()=>Ue(!ve),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:lt.priority||"None"})]}),jsxRuntime.jsxs(ys,{triggerRef:H,isOpen:ve,onClose:()=>Ue(false),width:180,estimatedHeight:220,children:[gy.map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${$.toLowerCase()} ${lt.priority===$?"active":""}`,onClick:()=>Be($),children:$},$)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Be(""),children:"None"})]})]}),y.length>0||b?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(Lo,{selectedTags:lt.tags||[],availableTags:y,onChange:ht,onCreateTag:b,theme:xt[A]||xt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:se,className:"modal-v2-field",onClick:()=>Xe(!ce),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:lt.labels&&lt.labels.length>0?jsxRuntime.jsx("span",{children:lt.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ys,{triggerRef:se,isOpen:ce,onClose:()=>Xe(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${lt.labels?.includes($)?"active":""}`,onClick:()=>ut($),children:[$,lt.labels?.includes($)&&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"})})]},$))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ke(!_e),setTimeout(()=>j.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:lt.endDate?new Date(lt.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:j,type:"date",value:typeof lt.endDate=="string"?lt.endDate.split("T")[0]:lt.endDate?(()=>{let $=new Date(lt.endDate),Y=$.getUTCFullYear(),Se=String($.getUTCMonth()+1).padStart(2,"0"),Ze=String($.getUTCDate()).padStart(2,"0");return `${Y}-${Se}-${Ze}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Bt(!bt),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:lt.estimatedTime?`${lt.estimatedTime}h`:"Not set"})]}),bt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:lt.estimatedTime||"",onChange:$=>Ct($.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Bt(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"})]}),U?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:lt.description||"",onChange:$=>{if(w){let Y={...w,description:$.target.value};_(Y);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>ae(true),children:lt.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:jt(lt.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"}),L.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[me,"/",L.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>z(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:[L.map($=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${$.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Wt($.id),children:$.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:$.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>St($.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"})]})})]},$.id)),q&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:$=>X($.target.value),onKeyDown:$=>{$.key==="Enter"&&Et(),$.key==="Escape"&&(z(false),X(""));},onBlur:Et,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||S.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"}),S.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:S.length})]}),jsxRuntime.jsx(lo,{cardId:lt.id,attachments:S,onUpload:M?$=>M(lt.id,$):void 0,onDelete:k,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 ${O==="all"?"active":""}`,onClick:()=>ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${O==="comments"?"active":""}`,onClick:()=>ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${O==="history"?"active":""}`,onClick:()=>ee("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.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:fe,onChange:$=>Ge($.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:zt,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[mt.map($=>{let Y=s.find(Ze=>Ze.id===$.userId);if($.type.includes("COMMENT")){let Ze=n.find(gt=>gt.id===$.metadata?.commentId);return Ze?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Y&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Y.color},children:Y.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:Y?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ze.content})]})]},$.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.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:Y?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)}),mt.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 Ty({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 ld({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,d)=>l+d.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(Ty,{})}),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 Ly({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 dd({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,d=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(Ly,{})}),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:d>=50?"#10B981":"#F59E0B"},children:[d.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 Wy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Op=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Vy({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)),d=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:d,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Hp({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 cd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((d,i)=>d+i.value,0),n=e.map(d=>({...d,totalValue:s,color:d.color||Wy[d.name]||Op[e.indexOf(d)%Op.length]})),l=n.map(d=>d.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?Vy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${d} (${u.value} - ${p}%)`}})]}):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(Hp,{})}),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((d,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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var wi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[d,i]=react.useState(false),[u,p]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let f=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(f,{priority:C}),l(false);},y=C=>{r.onBulkMove?.(f,C),i(false),a();},b=C=>{r.onBulkUpdate?.(f,{assignedUserIds:C}),p(false);},h=C=>{let N=new Set;e.forEach(M=>{M.labels?.forEach(k=>N.add(k));});let S=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(f,{labels:S}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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:c("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(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(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:()=>p(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([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:()=>h([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"})})]})]})})});wi.displayName="BulkOperationsToolbar";function qy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,d,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let f=a?.find(x=>x.id===g);n=`assignee-${g}`,l=f?.name||`User ${g}`,d=f?.color,i=f?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:d,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",d="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:d,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,d=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:d}),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,d="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:d}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",d="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:d}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ud({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>qy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),d=react.useCallback(i=>{n(u=>{let p=new Set(u);return p.has(i)?p.delete(i):p.add(i),p});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Ro,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:c("asakaa-swimlane-view",o),children:[l.map(i=>{let u=s.has(i.id),p=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:p};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&&d(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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Ro,{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 pd=[{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 md({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=pd.find(i=>i.value===e)||pd[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:c("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:c("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:pd.map(i=>jsxRuntime.jsxs("button",{onClick:()=>d(i.value),className:c("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 xs=[{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 Jy(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,d=o.meta?e.metaKey:true;return s&&n&&l&&d}function Gp(e={}){let{shortcuts:t=xs,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(d=>{o.current=[...o.current,d];},[]),l=react.useCallback(d=>{o.current=o.current.filter(i=>i.action!==d);},[]);return react.useEffect(()=>{function d(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of o.current)if(Jy(i,p)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Zy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function ex(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 tx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ex(e),r=t?Zy(t):"";return a?`${a} + ${r}`:r}function ax(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 gd({shortcuts:e=xs,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=ax(e);return jsxRuntime.jsxs("div",{className:c("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,d])=>d.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:d.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:tx(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 fd=[{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=f=>{f.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(p),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(d),document.body.appendChild(n),setTimeout(()=>{d.style.transition="opacity 0.5s ease",d.style.opacity="0";},2e3);}function ny(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 sy(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 ad(e){return e.startsWith("image/")}function lo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[d,i]=react.useState(false),[u,p]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let f=react.useCallback((k,F)=>{F.preventDefault(),F.stopPropagation();let A=g.current.filter(U=>ad(U.type)),w=A.findIndex(U=>U.id===k.id),_=U=>{let ae=g.current.filter(K=>ad(K.type)),L=ae[U];L&&Mp(L.url,L.name,ae,U,_);};Mp(k.url,k.name,A,w,_);},[]),x=react.useCallback(k=>{let F=[],A=[];return e.length+k.length>s?(A.push(`Maximum ${s} files allowed`),{valid:F,errors:A}):(k.forEach(w=>{if(w.size/1048576>r){A.push(`${w.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>w.type.match(U))){A.push(`${w.name} has invalid file type`);return}F.push(w);}),{valid:F,errors:A})},[e.length,s,r,o]),y=react.useCallback(async k=>{let{valid:F,errors:A}=x(k);if(A.length>0){p(A.join(", ")),setTimeout(()=>p(null),5e3);return}if(F.length!==0){i(true),p(null);try{await t?.(F);}catch(w){p(w instanceof Error?w.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[x,t]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),h=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),C=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let F=Array.from(k.dataTransfer.files);y(F);},[y]),N=react.useCallback(k=>{let F=k.target.files?Array.from(k.target.files):[];y(F),m.current&&(m.current.value="");},[y]),S=react.useCallback(()=>{m.current?.click();},[]),M=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${d?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:C,onClick:S,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:d?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"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:ad(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:F=>f(k,F),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.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:sy(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:ny(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>M(k.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"})})})]},k.id))})]})}function rd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:p,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:f,onGenerateSubtasks:x,onEstimateEffort:y,currentUserId:b="user-1"}){let[h,v]=react.useState("details"),[C,N]=react.useState(false),[S,M]=react.useState({}),[k,F]=react.useState(""),[A,w]=react.useState(false),[_,U]=react.useState({});if(!t||!e)return null;let ae=react.useCallback(()=>{N(false),M({}),v("details"),F(""),U({}),a();},[a]),L=react.useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),M({}),N(false));},[e.id,S,r]),K=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ae());},[e.id,o,ae]),q=react.useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),F(""));},[e.id,k,u]),z=react.useCallback(async()=>{if(f){w(true);try{let O=await f(e);U(ee=>({...ee,assignees:O}));}catch(O){console.error("Failed to suggest assignee:",O);}finally{w(false);}}},[e,f]),B=react.useCallback(async()=>{if(x){w(true);try{let O=await x(e);U(ee=>({...ee,subtasks:O}));}catch(O){console.error("Failed to generate subtasks:",O);}finally{w(false);}}},[e,x]),X=react.useCallback(async()=>{if(y){w(true);try{let O=await y(e);U(ee=>({...ee,effort:O}));}catch(O){console.error("Failed to estimate effort:",O);}finally{w(false);}}},[e,y]),fe={...e,...S},Ge=s.filter(O=>fe.assignedUserIds?.includes(O.id));return jsxRuntime.jsx(ta,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:ae,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:O=>O.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:S.title??fe.title,onChange:O=>M({...S,title:O.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:fe.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),M({});},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:K,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:ae,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 ${h==="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 ${h==="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 ${h==="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 ${h==="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 ${h==="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:[h==="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:S.description??fe.description??"",onChange:O=>M({...S,description:O.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:fe.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:S.assignedUserIds??fe.assignedUserIds??[],onChange:O=>{let ee=Array.from(O.target.selectedOptions,ue=>ue.value);M({...S,assignedUserIds:ee});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(O=>jsxRuntime.jsx("option",{value:O.id,children:O.name},O.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ge.length>0?Ge.map(O=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:O.color},children:O.initials}),jsxRuntime.jsx("span",{children:O.name})]},O.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:S.priority??fe.priority??"",onChange:O=>M({...S,priority:O.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:fe.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:fe.labels&&fe.labels.length>0?fe.labels.map(O=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:O},O)):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:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:fe.startDate?new Date(fe.startDate).toISOString().split("T")[0]:"",onChange:O=>M({...S,startDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.startDate?new Date(fe.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:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:fe.endDate?new Date(fe.endDate).toISOString().split("T")[0]:"",onChange:O=>M({...S,endDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.endDate?new Date(fe.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:S.estimatedTime??fe.estimatedTime??"",onChange:O=>M({...S,estimatedTime:O.target.value?parseFloat(O.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:fe.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:fe.dependencies&&fe.dependencies.length>0?fe.dependencies.map(O=>{let ee=typeof O=="string"?O:O.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ee.slice(-4)]},ee)}):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:fe.createdAt?new Date(fe.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:O=>F(O.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:q,disabled:!k.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(O=>{let ee=s.find(ue=>ue.id===O.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:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ee?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(O.createdAt).toLocaleString()})]})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(O.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:O.content})]},O.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"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(O=>{let ee=s.find(ue=>ue.id===O.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("COMMENT")&&"\u{1F4AC}",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",O.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:ee?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:O.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.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"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(lo,{cardId:e.id,attachments:i,onUpload:m?O=>m(e.id,O):void 0,onDelete:g,currentUserId:b,maxSizeMB:10,maxFiles:20})}),h==="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:z,disabled:A||!f,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:A||!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:X,disabled:A||!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("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((O,ee)=>{let ue=s.find(Te=>Te.id===O.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ue&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ue.color},children:ue.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ue?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:O.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(O.confidence*100).toFixed(0),"%"]})]})]},ee)})]}),_.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((O,ee)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:O.title}),O.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:O.description}),O.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",O.estimatedTime,"h"]})]},ee))]}),_.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:[_.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.map(O=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${O.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:O.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:O.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:O.description}),O.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",O.suggestedAction]})]},O.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&d.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 ys({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,d]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let p=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,f=4,x=p.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let y=m-p.bottom,b=p.top,h;return y>=s+f?h=p.bottom+f:b>=s+f?h=p.top-s-f:y>=b?h=p.bottom+f:h=Math.max(10,p.top-s-f),{top:h,left:x}},[e,o,s]);return react.useEffect(()=>{t&&d(u());},[t,u]),react.useEffect(()=>{if(!t)return;let p=g=>{let f=g.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",p);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",p);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let p=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),t?jsxRuntime.jsx(ta,{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 xt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var gy=["LOW","MEDIUM","HIGH","URGENT"],fy=["todo","in-progress","review","done"];function sd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:p,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:f=[],availableLabels:x=[],availableTags:y=[],onCreateTag:b,onUploadCoverImage:h,unsplashAccessKey:v,theme:C,onSubtasksChange:N,attachments:S=[],onUploadAttachments:M,onDeleteAttachment:k}){let F=Nn(),A=C||F?.themeName||"dark",[w,_]=react.useState(e),[U,ae]=react.useState(false),[L,K]=react.useState(()=>[...e?.subtasks||[]].sort((Y,Se)=>(Y.position??0)-(Se.position??0))),[q,z]=react.useState(false),[B,X]=react.useState(""),[fe,Ge]=react.useState(""),[O,ee]=react.useState("all"),[ue,Te]=react.useState(false),[ve,Ue]=react.useState(false),[$e,nt]=react.useState(false),[ce,Xe]=react.useState(false),[_e,ke]=react.useState(false),[bt,Bt]=react.useState(false),st=react.useRef(null),Ve=react.useRef(null),tt=react.useRef(null),Ke=react.useRef(null),Fe=react.useRef(null),W=react.useRef(null),D=react.useRef(null),j=react.useRef(null),re=react.useRef(null),Ne=react.useRef(null),H=react.useRef(null),se=react.useRef(null);react.useEffect(()=>{if(e&&!w){_({...e});let $=[...e.subtasks||[]].sort((Y,Se)=>(Y.position??0)-(Se.position??0));K($);}else if(e&&w&&e.id!==w.id){_({...e});let $=[...e.subtasks||[]].sort((Y,Se)=>(Y.position??0)-(Se.position??0));K($);}},[e,w]),react.useEffect(()=>{let $=Y=>{let Se=Y.target;Ke.current&&!Ke.current.contains(Se)&&Te(false),Fe.current&&!Fe.current.contains(Se)&&Ue(false),W.current&&!W.current.contains(Se)&&nt(false),D.current&&!D.current.contains(Se)&&Xe(false);};if(ue||ve||$e||ce)return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[ue,ve,$e,ce]),react.useEffect(()=>{if(!t)return;let $=Y=>{let Se=Y.target,Ze=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(Y.key==="Escape"){Y.preventDefault(),ue||ve||$e||ce||_e||bt?(Te(false),Ue(false),nt(false),Xe(false),ke(false),Bt(false)):Ze||a();return}if(Ze&&Y.key!=="Escape")return;let gt=Y.metaKey||Y.ctrlKey;switch(Y.key.toLowerCase()){case "s":Y.preventDefault(),Te(true);break;case "a":Y.preventDefault(),nt(true);break;case "p":Y.preventDefault(),Ue(true);break;case "l":Y.preventDefault(),Xe(true);break;case "d":gt||(Y.preventDefault(),ke(true),setTimeout(()=>j.current?.focus(),0));break;case "e":gt||(Y.preventDefault(),Bt(true));break;case "i":Y.preventDefault(),ae(true),setTimeout(()=>Ve.current?.focus(),0);break;case "t":Y.preventDefault(),z(true);break;case "c":Y.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,a,ue,ve,$e,ce,_e,bt]);let je=react.useCallback($=>{let Y=$.currentTarget.textContent?.trim()||"";if(w&&Y!==w.title){let Se={...w,title:Y};_(Se),r?.(w.id,{title:Y});}},[w,r]),we=react.useCallback($=>{$.key==="Enter"&&($.preventDefault(),$.currentTarget.blur()),$.key==="Escape"&&($.preventDefault(),$.currentTarget.textContent=w?.title||"",$.currentTarget.blur());},[w]),He=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),ae(false);},[w,e,r]),ze=react.useCallback($=>{if(w){let Y={...w,columnId:$};_(Y),r?.(w.id,{columnId:$}),Te(false);}},[w,r]),Be=react.useCallback($=>{if(w){let Y={...w,priority:$};_(Y),r?.(w.id,{priority:$}),Ue(false);}},[w,r]),ct=react.useCallback($=>{if(w){let Y=w.assignedUserIds||[],Se=Y.includes($)?Y.filter(gt=>gt!==$):[...Y,$],Ze={...w,assignedUserIds:Se};_(Ze),r?.(w.id,{assignedUserIds:Se});}},[w,r]),ut=react.useCallback($=>{if(w){let Y=w.labels||[],Se=Y.includes($)?Y.filter(gt=>gt!==$):[...Y,$],Ze={...w,labels:Se};_(Ze),r?.(w.id,{labels:Se});}},[w,r]),ht=react.useCallback($=>{if(w){let Y={...w,tags:$};_(Y),r?.(w.id,{tags:$});}},[w,r]),pt=react.useCallback($=>{if(w){let Y=$.target.value,Se={...w,endDate:Y};_(Se),r?.(w.id,{endDate:Y}),ke(false);}},[w,r]),Ct=react.useCallback($=>{if(w){let Y={...w,estimatedTime:parseFloat($)||0};_(Y),r?.(w.id,{estimatedTime:parseFloat($)||0});}},[w,r]),Et=react.useCallback(()=>{if(B.trim()&&w){let $={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:L.length,createdAt:new Date},Y=[...L,$];K(Y),X(""),z(false),N?.(w.id,Y);}},[B,L,w,N]),Wt=react.useCallback($=>{let Y=L.map(Se=>Se.id===$?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);K(Y),w&&N?.(w.id,Y);},[L,w,N]),St=react.useCallback($=>{let Y=L.filter(Se=>Se.id!==$);K(Y),w&&N?.(w.id,Y);},[L,w,N]),zt=react.useCallback(()=>{fe.trim()&&w&&d&&(d(w.id,fe.trim()),Ge(""));},[fe,w,d]),it=react.useCallback($=>{($.metaKey||$.ctrlKey)&&$.key==="Enter"&&($.preventDefault(),zt());},[zt]),jt=$=>jsxRuntime.jsx(uy__default.default,{remarkPlugins:[py__default.default],rehypePlugins:[my__default.default],components:{a:({node:Y,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:$}),mt=l.filter($=>O==="comments"?$.type.includes("COMMENT"):O==="history"?!$.type.includes("COMMENT"):true);if(!t||!e)return null;let lt=w||e,ne=s.filter($=>lt.assignedUserIds?.includes($.id)),me=L.filter($=>$.completed).length;return jsxRuntime.jsx(ta,{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:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:st,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:je,onKeyDown:we,children:lt.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:Ke,children:[jsxRuntime.jsxs("button",{ref:re,className:"modal-v2-field",onClick:()=>Te(!ue),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:lt.columnId||"No status"})]}),jsxRuntime.jsx(ys,{triggerRef:re,isOpen:ue,onClose:()=>Te(false),width:250,estimatedHeight:200,children:(f.length>0?f:fy.map($=>({id:$,title:$}))).map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${lt.columnId===$.id?"active":""}`,onClick:()=>ze($.id),children:$.title},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:W,children:[jsxRuntime.jsxs("button",{ref:Ne,className:"modal-v2-field",onClick:()=>nt(!$e),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:ne.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ne.map($=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:$.color},title:$.name,children:$.initials},$.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ys,{triggerRef:Ne,isOpen:$e,onClose:()=>nt(false),width:280,estimatedHeight:300,children:s.map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${lt.assignedUserIds?.includes($.id)?"active":""}`,onClick:()=>ct($.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:$.color},children:$.initials}),$.name,lt.assignedUserIds?.includes($.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"})})]},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Fe,children:[jsxRuntime.jsxs("button",{ref:H,className:"modal-v2-field",onClick:()=>Ue(!ve),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:lt.priority||"None"})]}),jsxRuntime.jsxs(ys,{triggerRef:H,isOpen:ve,onClose:()=>Ue(false),width:180,estimatedHeight:220,children:[gy.map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${$.toLowerCase()} ${lt.priority===$?"active":""}`,onClick:()=>Be($),children:$},$)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Be(""),children:"None"})]})]}),y.length>0||b?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(Lo,{selectedTags:lt.tags||[],availableTags:y,onChange:ht,onCreateTag:b,theme:xt[A]||xt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:se,className:"modal-v2-field",onClick:()=>Xe(!ce),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:lt.labels&&lt.labels.length>0?jsxRuntime.jsx("span",{children:lt.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ys,{triggerRef:se,isOpen:ce,onClose:()=>Xe(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${lt.labels?.includes($)?"active":""}`,onClick:()=>ut($),children:[$,lt.labels?.includes($)&&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"})})]},$))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ke(!_e),setTimeout(()=>j.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:lt.endDate?new Date(lt.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:j,type:"date",value:typeof lt.endDate=="string"?lt.endDate.split("T")[0]:lt.endDate?(()=>{let $=new Date(lt.endDate),Y=$.getUTCFullYear(),Se=String($.getUTCMonth()+1).padStart(2,"0"),Ze=String($.getUTCDate()).padStart(2,"0");return `${Y}-${Se}-${Ze}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Bt(!bt),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:lt.estimatedTime?`${lt.estimatedTime}h`:"Not set"})]}),bt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:lt.estimatedTime||"",onChange:$=>Ct($.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Bt(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"})]}),U?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:lt.description||"",onChange:$=>{if(w){let Y={...w,description:$.target.value};_(Y);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>ae(true),children:lt.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:jt(lt.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"}),L.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[me,"/",L.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>z(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:[L.map($=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${$.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Wt($.id),children:$.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:$.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>St($.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"})]})})]},$.id)),q&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:$=>X($.target.value),onKeyDown:$=>{$.key==="Enter"&&Et(),$.key==="Escape"&&(z(false),X(""));},onBlur:Et,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||S.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"}),S.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:S.length})]}),jsxRuntime.jsx(lo,{cardId:lt.id,attachments:S,onUpload:M?$=>M(lt.id,$):void 0,onDelete:k,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 ${O==="all"?"active":""}`,onClick:()=>ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${O==="comments"?"active":""}`,onClick:()=>ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${O==="history"?"active":""}`,onClick:()=>ee("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.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:fe,onChange:$=>Ge($.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:zt,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[mt.map($=>{let Y=s.find(Ze=>Ze.id===$.userId);if($.type.includes("COMMENT")){let Ze=n.find(gt=>gt.id===$.metadata?.commentId);return Ze?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Y&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Y.color},children:Y.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:Y?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ze.content})]})]},$.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.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:Y?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)}),mt.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 Ty({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 ld({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,d)=>l+d.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(Ty,{})}),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:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((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:"#00E5CC"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Ly({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 dd({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,d=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(Ly,{})}),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:d>=50?"#10B981":"#F59E0B"},children:[d.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 Wy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Op=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Vy({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)),d=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:d,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Hp({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 cd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((d,i)=>d+i.value,0),n=e.map(d=>({...d,totalValue:s,color:d.color||Wy[d.name]||Op[e.indexOf(d)%Op.length]})),l=n.map(d=>d.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?Vy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${d} (${u.value} - ${p}%)`}})]}):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(Hp,{})}),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((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((d,i)=>i.value>d.value?i:d).name})]})]})]})}var wi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[d,i]=react.useState(false),[u,p]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let f=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(f,{priority:C}),l(false);},y=C=>{r.onBulkMove?.(f,C),i(false),a();},b=C=>{r.onBulkUpdate?.(f,{assignedUserIds:C}),p(false);},h=C=>{let N=new Set;e.forEach(M=>{M.labels?.forEach(k=>N.add(k));});let S=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(f,{labels:S}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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:c("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(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(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:()=>p(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([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:()=>h([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"})})]})]})})});wi.displayName="BulkOperationsToolbar";function qy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,d,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let f=a?.find(x=>x.id===g);n=`assignee-${g}`,l=f?.name||`User ${g}`,d=f?.color,i=f?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:d,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",d="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:d,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,d=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:d}),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,d="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:d}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",d="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:d}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ud({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>qy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),d=react.useCallback(i=>{n(u=>{let p=new Set(u);return p.has(i)?p.delete(i):p.add(i),p});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Ro,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:c("asakaa-swimlane-view",o),children:[l.map(i=>{let u=s.has(i.id),p=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:p};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&&d(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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Ro,{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 pd=[{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 md({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=pd.find(i=>i.value===e)||pd[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:c("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:c("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:pd.map(i=>jsxRuntime.jsxs("button",{onClick:()=>d(i.value),className:c("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var xs=[{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 Jy(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,d=o.meta?e.metaKey:true;return s&&n&&l&&d}function Gp(e={}){let{shortcuts:t=xs,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(d=>{o.current=[...o.current,d];},[]),l=react.useCallback(d=>{o.current=o.current.filter(i=>i.action!==d);},[]);return react.useEffect(()=>{function d(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of o.current)if(Jy(i,p)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Zy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function ex(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 tx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ex(e),r=t?Zy(t):"";return a?`${a} + ${r}`:r}function ax(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 gd({shortcuts:e=xs,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=ax(e);return jsxRuntime.jsxs("div",{className:c("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,d])=>d.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:d.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:tx(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 fd=[{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 bd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},d=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),i},{});return jsxRuntime.jsxs("div",{className:c("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:c("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(d).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(p=>jsxRuntime.jsxs("button",{onClick:()=>l(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:p.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:p.name}),p.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function yd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[d,i]=react.useState("json"),[u,p]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,y=await fu(e,d,x);bu(y,d);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await xu(y),h=y.name.endsWith(".json")?"json":"csv",v=yu(b,h);p(v),v.success&&r&&r(v,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:c("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:c("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:c("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:c("p-4 rounded-lg border-2 transition-all text-center",d===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:f,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"})]})]}),u&&jsxRuntime.jsxs("div",{className:c("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:c("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var ix=["URGENT","HIGH","MEDIUM","LOW"],lx=[{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"}],dx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function xd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:m=false,groupBy:g="none",onGroupByChange:f}){let[x,y]=react.useState(true),b=react.useCallback(S=>{a({search:S.target.value});},[a]),h=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),v=react.useCallback(S=>{r({by:S.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:()=>y(!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:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.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:[p&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),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:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,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:S=>{let M=S.target.value;a({priorities:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ix.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let M=S.target.value;a({assignees:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let M=S.target.value;a({labels:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),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:lx.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.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"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:S=>f(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:dx.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function vd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:d}){let[i,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let g=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxRuntime.jsxs("div",{className:c("relative",r),ref:p,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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(()=>d?.()),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 wd={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"}},kd={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"}},Cd={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"}},cn={dark:wd,light:kd,neutral:Cd},Ci="dark";var Ti=react.createContext(void 0),xx="asakaa-theme";function Kp({children:e,defaultTheme:t=Ci,storageKey:a=xx}){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,d=cn[r];Object.entries(d.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${vx(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let m=d.colors[u];m&&l.style.setProperty(p,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:cn};return jsxRuntime.jsx(Ti.Provider,{value:n,children:e})}function Bn(){let e=react.useContext(Ti);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function vx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Td({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Bn();return e?jsxRuntime.jsxs("div",{className:c("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(cn).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:c("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 qp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xt[e]||xt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",xt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",xt[e].bgSecondary),bgGrid:r("--theme-bg-card",xt[e].bgGrid),bgWeekend:r("--theme-bg-hover",xt[e].bgWeekend),border:r("--theme-border-primary",xt[e].border),borderLight:r("--theme-border-subtle",xt[e].borderLight),textPrimary:r("--theme-text-primary",xt[e].textPrimary),textSecondary:r("--theme-text-secondary",xt[e].textSecondary),textTertiary:r("--theme-text-tertiary",xt[e].textTertiary),accent:r("--theme-accent-primary",xt[e].accent),accentHover:r("--theme-accent-hover",xt[e].accentHover),accentLight:r("--theme-accent-primary",xt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",xt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",xt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",xt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",xt[e].dependency),dependencyHover:r("--theme-border-secondary",xt[e].dependencyHover),criticalPath:r("--theme-error",xt[e].criticalPath),criticalPathLight:r("--theme-error",xt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",xt[e].today):e==="neutral"?r("--theme-text-primary",xt[e].today):r("--theme-error",xt[e].today),todayLight:e==="light"?r("--theme-accent-primary",xt[e].todayLight):e==="neutral"?r("--theme-text-primary",xt[e].todayLight):r("--theme-error",xt[e].todayLight),milestone:r("--theme-warning",xt[e].milestone),milestoneLight:r("--theme-warning",xt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",xt[e].statusTodo),statusInProgress:r("--theme-accent-primary",xt[e].statusInProgress),statusCompleted:r("--theme-success",xt[e].statusCompleted),hoverBg:r("--theme-bg-hover",xt[e].hoverBg),focusRing:r("--theme-accent-primary",xt[e].focusRing),...xt[e].dotGrid&&{dotGrid:xt[e].dotGrid},...xt[e].glassHeader&&{glassHeader:xt[e].glassHeader},...xt[e].glassToolbar&&{glassToolbar:xt[e].glassToolbar},...xt[e].forecastHud&&{forecastHud:xt[e].forecastHud},...xt[e].neonRedGlow&&{neonRedGlow:xt[e].neonRedGlow},...xt[e].executionBarBg&&{executionBarBg:xt[e].executionBarBg}}}var Ni={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"}},Yp={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"}},Nd={en:Ni,es:Yp};function Xp(e){return Nd[e]||Nd.en}function Dd(e,t){let a=Xp(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 $n=react.createContext(Ni);function $r(){return react.useContext($n)}function ks(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,d;a==="right"?d=n.right-r:d=n.left;let i=8;d+r>window.innerWidth-i&&(d=window.innerWidth-i-r),d<i&&(d=i),s({top:l,left:d});},[t,a,e,r]),o}function nm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,d]=react.useState(false),[i,u]=react.useState(null),p=react.useRef(null),m=react.useRef(null),g=$r(),f=ks(p,l,"right",176);if(react.useEffect(()=>{if(!l)return;let h=v=>{let C=v.target;p.current&&!p.current.contains(C)&&m.current&&!m.current.contains(C)&&d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]),!(t||a||r||o||s||n))return null;let y=[{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(h=>h.handler),b=async(h,v)=>{if(v){u(h);try{await v();}catch(C){console.error(`Export ${h} failed:`,C);}finally{u(null),d(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:p,onClick:()=>d(!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:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((h,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(h.id,h.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<y.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===h.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"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function Qp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[d,i]=react.useState(null),[u,p]=react.useState(false),m=react.useRef(null),g=react.useRef(null),f=$r(),x=ks(m,n,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let N=S=>{let M=S.target;m.current&&!m.current.contains(M)&&g.current&&!g.current.contains(M)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),v=async(N,S)=>{if(S){i(N);try{await S();}catch(M){console.error(`Export ${N} failed:`,M);}finally{i(null),l(false);}}},C=()=>{s?.(),p(true),setTimeout(()=>p(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:f.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:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.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:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((N,S)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(N.id,N.handler),disabled:d!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.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:d===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))})]}),h.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"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:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Vx({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 Gx({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 Zp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),d=$r(),i=ks(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let f=g.target;n.current&&!n.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:d.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],p=t==="all"?d.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:`${d.toolbar.wbsLevel||"Level"}: ${p}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:p})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children: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:u.map((m,g)=>{let f=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:f?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:m.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function em({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),d=react.useRef(null),i=$r(),u=ks(l,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;l.current&&!l.current.contains(h)&&d.current&&!d.current.contains(h)&&n(false);},y=b=>{b.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),d._cleanup&&d._cleanup();}},[s]);let p=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#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:f=>{f.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:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.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:p.map(f=>{let x=t===f.value&&!r,y=()=>f.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"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(f.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?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},f.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 jx({value:e,onChange:t,theme:a}){let r=$r(),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 _x({theme:e,forecast:t}){let a=$r(),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,d=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,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,m=t?.currency||"$",g=p!=null?p>=1e6?`${m}${(p/1e6).toFixed(2)}M`:p>=1e3?`${m}${(p/1e3).toFixed(1)}K`:`${m}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.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:u,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&&y&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function Kx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:d,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[m,g]=react.useState(false),f=react.useRef(null),x=react.useRef(null),y=$r(),b=ks(f,m,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let S=M=>{let k=M.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&g(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[m]);let v=y.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!p,tooltip:p?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:d}],N=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:f,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:y.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:b.top,left:b.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:[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:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:C.map((S,M)=>{let k=S.icon,P=S.disabled,A=S.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!P&&S.onChange?.(!S.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:P?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:P?"not-allowed":"pointer"},whileHover:P?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},title:A,children:[jsxRuntime.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:P?h?"rgba(255,255,255,0.2)":"#D1D5DB":S.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.label}),S.active&&!P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},S.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((S,M)=>{let k=i===S.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(S.value),className:"w-full flex items-center justify-between 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:(C.length+M)*.03},children:[jsxRuntime.jsx("span",{style:{color:k?e.accent||"#2E94FF":h?"rgba(255,255,255,0.85)":e.textPrimary},children:S.label}),k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},S.value)})]})]})}),document.body)]})}function Di({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:p,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:S,projectForecast:M,onExportPNG:k,onExportPDF:P,onExportExcel:A,onExportCSV:w,onExportJSON:_,onExportMSProject:U,showCriticalPath:ae=true,onShowCriticalPathChange:L,showDependencies:K=true,onShowDependenciesChange:q,highlightWeekends:z=true,onHighlightWeekendsChange:B,showBaseline:X=false,onShowBaselineChange:fe,onCopySnapshotLink:Ge,hasDependencies:O=true}){let ee=$r(),ue=k||P||A||w||_||U,Te=!!e.glassToolbar,[ve,Ue]=react.useState(false),$e=react.useRef(null);react.useEffect(()=>{ve&&$e.current&&$e.current.focus();},[ve]);let nt=[{value:"day",label:ee.toolbar.day},{value:"week",label:ee.toolbar.week},{value:"month",label:ee.toolbar.month}],ce=[{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"})}],Xe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Te){let _e=Xe?"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:Xe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ve?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ue(!ve),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"})}),ve&&jsxRuntime.jsx("input",{ref:$e,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:()=>Ue(false),onKeyDown:ke=>{ke.key==="Escape"&&Ue(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),S&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Xe?"#000000":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>S("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Xe?"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:ee.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>S("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Xe?"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:ee.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(jx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),v&&jsxRuntime.jsx(Zp,{theme:e,value:h??"all",onChange:v,maxDepth:C}),f&&jsxRuntime.jsx(em,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),jsxRuntime.jsx(Kx,{theme:e,showCriticalPath:ae,onShowCriticalPathChange:L,showBaseline:X,onShowBaselineChange:fe,highlightWeekends:z,onHighlightWeekendsChange:B,showDependencies:K,onShowDependenciesChange:q,rowDensity:l,onRowDensityChange:d,hasDependencies:O}),jsxRuntime.jsx(Qp,{theme:e,onExportPNG:k,onExportPDF:P,onExportExcel:A,onExportMSProject:U,onCopySnapshotLink:Ge}),u&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Xe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Xe?"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:p||ee.toolbar.createTask})]})]})]}),M&&jsxRuntime.jsx(_x,{theme:e,forecast:M})]})}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(Gx,{options:nt,value:t,onChange:_e=>a(_e),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(Zp,{theme:e,value:h??"all",onChange:v,maxDepth:C}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(em,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #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:p||ee.toolbar.createTask})]}),(ue||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Qp,{theme:e,onExportPNG:k,onExportPDF:P,onExportExcel:A,onExportMSProject:U,onCopySnapshotLink:Ge}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Vx,{options:ce,value:s,onChange:_e=>n(_e),theme:e})]})]})}function Si({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=p=>{l.current&&!l.current.contains(p.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let u=d.current.getBoundingClientRect();n({x:u.left,y:u.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(ta,{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(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function Hn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,d]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,p=r.length*36+8,m=8,g=window.innerWidth,f=window.innerHeight,x=t,y=a;t+u+m>g&&(x=t-u,x<m&&(x=m)),a+p+m>f&&(y=f-p-m,y<m&&(y=m)),d({x,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},p=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ma={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function pm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:m=true}){let g=react.useRef(false),f=react.useCallback(v=>{g.current=v;},[]),x=react.useCallback(v=>{let C=[],N=S=>{for(let M of S)C.push(M),M.subtasks&&M.subtasks.length>0&&M.isExpanded&&N(M.subtasks);};return N(v),C},[]),y=react.useCallback(()=>{let v=x(e);for(let C of v)if(t.has(C.id))return C;return null},[e,t,x]),b=react.useCallback((v,C)=>{let N=x(e);if(N.length===0)return;let S=y();if(!S){a(N[0].id,false);return}let M=N.findIndex(A=>A.id===S.id);if(M===-1)return;let k=v==="up"?M-1:M+1;if(k<0||k>=N.length)return;let P=N[k];a(P.id,C);},[e,y,x,a]),h=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 M=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),P=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(P&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){P.subtasks&&P.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!P.isExpanded||v.key==="ArrowLeft"&&P.isExpanded)&&u(P.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),n(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),d(k));return}if(v.key==="Enter"&&!v.shiftKey&&!M){P&&(v.preventDefault(),r(P.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!M){P&&(v.preventDefault(),r(P.id,"above"));return}if(v.key==="Enter"&&M){P&&(v.preventDefault(),p(P.id));return}if(v.key==="F2"){P&&(v.preventDefault(),i(P.id));return}if(v.key==="Delete"||v.key==="Backspace"&&M){k.length>0&&(v.preventDefault(),o(k));return}if(v.key==="d"&&M&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[m,t,y,b,r,o,s,n,l,d,i,u,p]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:f}}function gm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(p=>{t(new Set([p])),r(p);},[]),s=react.useCallback(p=>{t(m=>{let g=new Set(m);return g.has(p)?g.delete(p):g.add(p),g}),r(p);},[]),n=react.useCallback((p,m)=>{if(!a){o(p);return}let g=m.indexOf(a),f=m.indexOf(p);if(g===-1||f===-1){o(p);return}let x=Math.min(g,f),y=Math.max(g,f),b=m.slice(x,y+1);t(new Set(b)),r(p);},[a,o]),l=react.useCallback((p,m,g,f)=>{f?n(p,m):g?s(p):o(p);},[o,s,n]),d=react.useCallback((p,m)=>{m?t(g=>{let f=new Set(g);return f.add(p),f}):o(p);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(p=>e.has(p),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function Pd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Pd(t.subtasks):t.subtasks}))}function zn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,d)=>(l.position??0)-(d.position??0));for(let l=0;l<n.length;l++){let d={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function Un(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Un(a.subtasks,t);if(r)return r}}return null}function Fd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Fd(a.subtasks,t);if(r)return r}return null}function Ad(e,t){if(t.length===0)return e;let a=zn(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 f=[];return {tasks:m.filter(y=>{if(g.has(y.id))return f.push(y),false;if(y.subtasks){let b=n(y.subtasks,g);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(m,g,f)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),d=new Set(t),{tasks:i,removed:u}=n(e,d),p=l(i,s.id,u);return Pd(p)}function Ld(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Fd(a,r);if(!o)continue;let s=Fd(a,o.id),n=(i,u,p)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let f=g.subtasks.findIndex(x=>x.id===p);if(f!==-1){let[x]=g.subtasks.splice(f,1);return x}}if(g.subtasks){let f=n(g.subtasks,u,p);if(f)return f}}return null},l=(i,u,p)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,p),i;for(let g of i)g.subtasks&&l(g.subtasks,u,p);return i},d=n(a,o.id,r);d&&(s&&s.subtasks?l(s.subtasks,o.id,d):l(a,o.id,d));}return Pd(a)}function Id(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,d)=>{let i=n.findIndex(p=>p.id===l);if(i===-1){for(let p of n)if(p.subtasks&&s(p.subtasks,l,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function Bd(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 Ts(e,t){let a=[...e],r=[];for(let o of t){let s=(d,i)=>d.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),n=d=>{let i=d.findIndex(g=>g.id===o);if(i===-1){for(let g of d)if(g.subtasks){let f=n(g.subtasks);if(f)return f}return null}let u=d[i],p=`${u.id}-copy-${Date.now()}`,m={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return d.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function fm(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=d=>{let i=d.findIndex(p=>p.id===t);if(i===-1){for(let p of d)if(p.subtasks&&l(p.subtasks))return true;return false}let u=a==="above"?i:i+1;return d.splice(u,0,n),true};return l(r),{tasks:r,newTask:n}}function Rd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Rd(r.subtasks,t,a)}:r)}function $d(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:$d(a.subtasks,t)}:a)}function Od(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let f=a(g.subtasks);if(f)return f}}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,d=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let f=d(g.subtasks);if(f>=0)return f}}return 0},i=d(e),u={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},p=m=>m.map(g=>{if(g.id===t){let f=g.subtasks||[];return {...g,subtasks:[...f,u],isExpanded:true}}return g.subtasks?{...g,subtasks:p(g.subtasks)}:g});return {tasks:p(e),newTask:u}}function bm(e,t,a,r){if(t===a)return e;let o=Un(e,t);if(!o)return e;if(a){let l=(d,i)=>{if(!d.subtasks)return false;for(let u of d.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(o,a))return e}let s=l=>{let d=l.filter(u=>u.id!==t),i=d.length<l.length;return d.map((u,p)=>{let m=i?{...u,position:p}:u;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((d,i)=>({...d,position:i}));}else {let l=d=>d.map(i=>{if(i.id===a){let u=i.subtasks||[],p=r!==void 0?r:u.length,m=[...u];m.splice(p,0,{...o,parentId:a});let g=m.map((f,x)=>({...f,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 Or(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Or(t.subtasks),r=a.reduce((l,d)=>(d.startDate&&l.starts.push(new Date(d.startDate).getTime()),d.endDate&&l.ends.push(new Date(d.endDate).getTime()),l.progresses.push(d.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,d)=>l+d,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function Mi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:p,onColumnResize:m,onTaskUpdate:g,onTaskIndent:f,onTaskOutdent:x,onTaskMove:y,onMultiTaskDelete:b,onTaskDuplicate:h,onTaskCreate:v,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:S,onDeleteRequest:M,onTaskReparent:k,scrollContainerRef:P,showCriticalPath:A=false}){let w=react.useContext($n),[_,U]=react.useState(null),[ae,L]=react.useState(null),[K,q]=react.useState(""),z=react.useRef(null),[B,X]=react.useState(null),[fe,Ge]=react.useState(0),[O,ee]=react.useState(0),[ue,Te]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ve,Ue]=react.useState(null),[$e,nt]=react.useState(null),[ce,Xe]=react.useState(null),_e=react.useRef(0),ke=5,bt=react.useRef(false),[Bt,st]=react.useState(null),[Ve,tt]=react.useState(false),Ke=react.useRef(null),[Pe,W]=react.useState(null),[D,j]=react.useState(false),re=react.useRef(null);react.useEffect(()=>{function ne(me){re.current&&!re.current.contains(me.target)&&j(false);}if(D)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[D]),react.useEffect(()=>{ae&&z.current&&(z.current.focus(),z.current.select());},[ae]),react.useEffect(()=>{if(!B)return;let ne=$=>{let Y=$.clientX-fe,Se=O+Y;m?.(B,Se);},me=()=>{X(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[B,fe,O,m]);let{selectedTaskIds:Ne,handleTaskClick:H,isTaskSelected:se}=gm(),{setIsEditing:je}=pm({tasks:e,selectedTaskIds:Ne,onTaskSelect:(ne,me)=>{let Y=zn(e).map(Se=>Se.id);H(ne,Y,me||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:f||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ne=>{let me=zn(e).find($=>$.id===ne);me&&ut(me);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ne=>{let me=zn(e).find($=>$.id===ne);me&&S&&S(me);},enableKeyboard:true}),we=(ne,me=0,$="")=>{let Y=[],Se=[...ne].sort((Ze,gt)=>(Ze.position??0)-(gt.position??0));for(let Ze=0;Ze<Se.length;Ze++){let gt=Se[Ze],Pt=Ze+1,Rt=$?`${$}.${Pt}`:`${Pt}.0`,Mt=gt.wbsCode||Rt;if(gt.wbsCode=Mt,Y.push({task:gt,level:me}),gt.subtasks&&gt.subtasks.length>0&&gt.isExpanded){let Qt=gt.wbsCode?.replace(/\.0$/,"")||($?`${$}.${Pt}`:`${Pt}`);Y.push(...we(gt.subtasks,me+1,Qt));}}return Y},He=we(e),ze=48,Be=Math.max(He.length*a,600-ze),ct=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,ut=ne=>{L(ne.id),q(ne.name),je(true);},ht=ne=>{K.trim()&&K!==e.find(me=>me.id===ne)?.name&&C?.(ne,K.trim()),L(null),q(""),je(false);},pt=()=>{L(null),q(""),je(false);},Ct=(ne,me)=>{me.stopPropagation(),N?.(ne.id);},Et=(ne,me)=>{me.preventDefault(),_e.current=me.clientY,Ue(ne),bt.current=false,tt(false),st({x:me.clientX,y:me.clientY});},Wt=ne=>{if(!ve||(Math.abs(ne.clientY-_e.current)>ke&&!bt.current&&(bt.current=true,tt(true)),st({x:ne.clientX,y:ne.clientY}),!bt.current))return;if(P?.current){let Ze=P.current,gt=Ze.getBoundingClientRect(),Pt=60,Rt=12;Ke.current&&(cancelAnimationFrame(Ke.current),Ke.current=null);let Mt=ne.clientY-gt.top,Yt=gt.bottom-ne.clientY;if(Mt<Pt&&Ze.scrollTop>0){let Qt=Math.round(Rt*(1-Mt/Pt)),Z=()=>{Ze.scrollTop-=Qt,bt.current&&Ze.scrollTop>0&&(Ke.current=requestAnimationFrame(Z));};Ke.current=requestAnimationFrame(Z);}else if(Yt<Pt&&Ze.scrollTop<Ze.scrollHeight-Ze.clientHeight){let Qt=Math.round(Rt*(1-Yt/Pt)),Z=()=>{Ze.scrollTop+=Qt,bt.current&&Ze.scrollTop<Ze.scrollHeight-Ze.clientHeight&&(Ke.current=requestAnimationFrame(Z));};Ke.current=requestAnimationFrame(Z);}}let $=document.querySelectorAll("[data-task-row]"),Y=null,Se=null;$.forEach(Ze=>{let gt=Ze.getBoundingClientRect(),Pt=Ze.getAttribute("data-task-row");if(Pt&&Pt!==ve&&ne.clientY>=gt.top&&ne.clientY<=gt.bottom){Y=Pt;let Rt=ne.clientY-gt.top,Mt=gt.height;Rt<Mt*.25?Se="above":Rt>Mt*.75?Se="below":Se="child";}}),nt(Y),Xe(Se);},St=()=>{if(bt.current&&ve&&$e&&ce){if(ce==="child")k?.(ve,$e);else if(ce==="above"||ce==="below"){let ne=(Se,Ze,gt=null)=>{for(let Pt of Se){if(Pt.id===Ze)return gt;if(Pt.subtasks){let Rt=ne(Pt.subtasks,Ze,Pt.id);if(Rt!==void 0)return Rt}}},me=ne(e,ve,null),$=ne(e,$e,null),Y=(Se,Ze,gt,Pt)=>{let Rt=Se.findIndex(Qt=>Qt.id===Ze),Mt=Pt?Se.findIndex(Qt=>Qt.id===gt):-1,Yt=ce==="below"?Rt+1:Rt;return Pt&&Mt!==-1&&Mt<Rt&&(Yt-=1),Math.max(0,Yt)};if($===null){let Ze=Y(e,$e,ve,me===null);k?.(ve,null,Ze);}else {let Se=Un(e,$);if(Se?.subtasks){let Ze=me===$,gt=Y(Se.subtasks,$e,ve,Ze);k?.(ve,$,gt);}}}}Ke.current&&(cancelAnimationFrame(Ke.current),Ke.current=null),Ue(null),nt(null),Xe(null),st(null),bt.current=false,tt(false);};react.useEffect(()=>{if(ve)return document.addEventListener("mousemove",Wt),document.addEventListener("mouseup",St),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Wt),document.removeEventListener("mouseup",St),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,$e,ce]);let zt=(ne,me,$)=>{let Y=me.subtasks&&me.subtasks.length>0;switch(ne.id){case "name":let Se=ae===me.id,Ze=_===me.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${$*20}px`},children:[k&&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:Ze?1:.3},onMouseDown:I=>Et(me.id,I),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:I=>{I.stopPropagation(),d?.(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"}),Se?jsxRuntime.jsx("input",{ref:z,type:"text",value:K,onChange:I=>q(I.target.value),onKeyDown:I=>{I.key==="Enter"?ht(me.id):I.key==="Escape"&&pt();},onBlur:()=>ht(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:I=>I.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),"%"]}),A&&me.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),A&&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"]})]}),Ze&&!Se&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>Ct(me,I),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:I=>{I.stopPropagation(),ut(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 Pt=ne.id==="startDate"?"startDate":"endDate",Rt=me[Pt],Mt=Pe?.taskId===me.id&&Pe?.field===Pt,Yt=I=>I?(typeof I=="string"?new Date(I):I).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:I=>I.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:Y?.5:1,cursor:Y?"default":"pointer"},title:Y?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!Y)if(Mt)W(null);else {let xe=I.currentTarget.getBoundingClientRect();W({taskId:me.id,field:Pt,month:Rt?typeof Rt=="string"?new Date(Rt):Rt:new Date,position:{top:xe.bottom+4,left:xe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Yt(Rt)}),Y&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Mt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>W(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Pe?.position.top,left:Pe?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,xe=new Date(I);xe.setDate(I.getDate()+1);let te=new Date(I);te.setDate(I.getDate()+7);let T=new Date(I);return T.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:xe},{label:"Pr\xF3xima semana",date:te},{label:"2 semanas",date:T}].map((Ce,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:$t=>$t.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:$t=>$t.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pt]:Ce.date}),W(null);},children:Ce.label},Le))})(),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:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pt]:void 0}),W(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:()=>W(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Pe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>W(I=>I?{...I,month:new Date(I.month.getFullYear(),I.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((I,xe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},xe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=Pe?.month||new Date,xe=I.getFullYear(),te=I.getMonth(),T=new Date(xe,te,1).getDay(),J=new Date(xe,te+1,0).getDate(),Ce=new Date,Le=[];for(let Nt=T-1;Nt>=0;Nt--)Le.push({day:new Date(xe,te,-Nt).getDate(),date:new Date(xe,te-1,new Date(xe,te,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=J;Nt++)Le.push({day:Nt,date:new Date(xe,te,Nt),isCurrentMonth:true});let $t=42-Le.length;for(let Nt=1;Nt<=$t;Nt++)Le.push({day:Nt,date:new Date(xe,te+1,Nt),isCurrentMonth:false});return Le.map((Nt,Jt)=>{let Ua=Nt.date.toDateString()===Ce.toDateString(),Ma=(Rt?typeof Rt=="string"?new Date(Rt):Rt:null)?.toDateString()===Nt.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:Nt.isCurrentMonth?Ma?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ma?"#2E94FF":"transparent",boxShadow:Ua&&!Ma?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Pt]:Nt.date}),W(null);},children:Nt.day},Jt)})})()})]})]})]}),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:ct(me)})});case "assignees":if(Y)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 Qt=r.filter(I=>me.assignees?.some(xe=>xe.name===I.name||xe.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(rn,{assignedUsers:Qt,availableUsers:r,onChange:I=>{let xe=I.map(te=>({id:te.id,name:te.name,initials:te.initials,color:te.color}));g?.(me.id,{assignees:xe.length>0?xe:void 0});}})});case "status":if(Y){let I=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:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Ou,{status:me.status||"todo",onChange:I=>{g?.(me.id,{status:I,progress:I==="completed"?100:me.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:Y?.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 Z={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Oe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ae=Z[me.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(tn,{priority:Ae,onChange:I=>{I&&g?.(me.id,{priority:Oe[I]||"medium"});}})});default:return null}},it=ne=>[{id:"hide",label:"Hide Column",icon:ma.Hide,onClick:()=>p(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ma.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ma.SortDesc,onClick:()=>{}}],jt=ne=>ne.subtasks&&ne.subtasks.length>0?[{id:"addSubtask",label:w?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{N?.(ne.id);}},{id:"duplicate",label:w?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{h?.([ne.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:w?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{M?M(ne.id,ne.name):b?.([ne.id]);}}]:[{id:"edit",label:w?.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{n?.(ne);}},{id:"addSubtask",label:w?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{N?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:w?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{g?.(ne.id,{status:"todo",progress:0});},disabled:ne.status==="todo"},{id:"setInProgress",label:w?.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{g?.(ne.id,{status:"in-progress"});},disabled:ne.status==="in-progress"},{id:"markComplete",label:w?.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{g?.(ne.id,{status:"completed",progress:100});},disabled:ne.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:w?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{h?.([ne.id]);}},{id:"split",label:w?.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:w?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{M?M(ne.id,ne.name):b?.([ne.id]);}}],mt=u.filter(ne=>ne.visible),lt=mt.reduce((ne,me)=>ne+me.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:lt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${ze}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:mt.map((ne,me)=>{let $=me===mt.length-1,Y=ne.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Y?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(Y?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:Y&&mt.length===1?1:0,flexGrow:Y&&mt.length===1?1:0,borderRight:$?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Se=>{Se.preventDefault(),Te({isOpen:true,x:Se.clientX,y:Se.clientY,type:"header",columnId:ne.id});},onMouseEnter:Se=>{Se.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Se=>{Se.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Se=>{Se.preventDefault(),Se.stopPropagation(),X(ne.id),Ge(Se.clientX),ee(ne.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:B===ne.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Si,{columns:u,onToggleColumn:p,theme:t}),jsxRuntime.jsx("button",{onClick:()=>j(!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:re,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>j(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Be},children:He.map(({task:ne,level:me},$)=>{let Y=se(ne.id),Se=$e===ne.id,Ze=Se&&ce==="above",gt=Se&&ce==="below",Pt=Se&&ce==="child",Rt={};return Pt&&(Rt.backgroundColor=`${t.accent}15`,Rt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${ve===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Y?t.accentLight:Pt?`${t.accent}15`:$%2===0?t.bgPrimary:t.bgGrid,opacity:A?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Rt},onMouseEnter:()=>U(ne.id),onMouseLeave:()=>U(null),onClick:Mt=>{let Qt=zn(e).map(Ae=>Ae.id),Oe=navigator.platform.toUpperCase().indexOf("MAC")>=0?Mt.metaKey:Mt.ctrlKey;H(ne.id,Qt,Oe,Mt.shiftKey),s?.(ne);},onDoubleClick:Mt=>{Mt.stopPropagation(),n?.(ne);},onContextMenu:Mt=>{Mt.preventDefault(),Te({isOpen:true,x:Mt.clientX,y:Mt.clientY,type:"task",task:ne}),l?.(ne,Mt);},whileHover:{backgroundColor:Y?t.accentLight:t.hoverBg},children:[Ze&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),gt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),mt.map((Mt,Yt)=>{let Qt=Yt===mt.length-1,Z=Mt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Z?"justify-start":"justify-center"}`,style:{width:`${Mt.width}px`,minWidth:`${Mt.minWidth??(Z?200:60)}px`,maxWidth:`${Mt.maxWidth??2e3}px`,flexShrink:Z&&mt.length===1?1:0,flexGrow:Z&&mt.length===1?1:0,borderRight:Qt?"none":`1px solid ${_===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:zt(Mt,ne,Z?me:0)},`${ne.id}-${Mt.id}`)})]},ne.id)})}),jsxRuntime.jsx(Hn,{isOpen:ue.isOpen,x:ue.x,y:ue.y,items:ue.type==="header"&&ue.columnId?it(ue.columnId):ue.type==="task"&&ue.task?jt(ue.task):[],onClose:()=>Te({...ue,isOpen:false}),theme:t}),Ve&&Bt&&ve&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Bt.x+12,top:Bt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=He.find(me=>me.task.id===ve)?.task;return ne?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function wm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[d,i]=react.useState(t),[u,p]=react.useState(null),[m,g]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(0),[C,N]=react.useState(0),[S,M]=react.useState(null),[k,P]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:m,setHoveredTaskId:g,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:S,setHoveredSegmentIndex:M,isHovered:k,setIsHovered:P,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ae,L)=>{r("none"),p(null),g(null),l(ae),i(L),N(0),b(null),v(0);}}}function Fi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:C}){let N=wm(t,r),S=react.useRef(null),M=react.useRef(false),k=react.useRef(null),P=react.useRef(null),{dragMode:A,setDragMode:w,dragOffset:_,setDragOffset:U,ghostX:ae,setGhostX:L,ghostWidth:K,setGhostWidth:q,connectionLine:z,setConnectionLine:B,hoveredTaskId:X,setHoveredTaskId:fe,activeZone:Ge,setActiveZone:O,draggedSegmentIndex:ee,setDraggedSegmentIndex:ue,draggedSegmentStartX:Te,setDraggedSegmentStartX:ve,segmentDragOffsetX:Ue,setSegmentDragOffsetX:$e,hoveredSegmentIndex:nt,setHoveredSegmentIndex:ce,isHovered:Xe,setIsHovered:_e,isDragging:ke,isResizing:bt,isConnecting:Bt,resetDragState:st}=N,Ve=18,tt=!!o.executionBarBg,Ke=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Pe=tt?3:6,W=e.subtasks&&e.subtasks.length>0,D=react.useRef(null),[j,re]=(()=>{let Z=react.useRef(null),[,Oe]=react.useState(0);return [Z.current,Ae=>{Z.current=Ae,Oe(I=>I+1);}]})(),Ne=!!C&&!v&&!W&&!e.segments&&!!e.startDate&&!!e.endDate,H=e.endDate&&(()=>{let Z=new Date;Z.setHours(0,0,0,0);let Oe=new Date(e.endDate);return Oe.setHours(0,0,0,0),Oe<Z})()&&e.progress<100,se=h&&e.isCriticalPath,je=o.name==="neutral"||o.today==="#1C1917",we=e.status==="completed"||e.progress===100,He={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Be=h&&e.isCriticalPath||H?"#EF4444":e.color?e.color:e.priority&&He[e.priority]?He[e.priority]:o.taskBarPrimary,ct=v?"default":ke?Bt?"crosshair":bt?"ew-resize":"grabbing":"grab",ut=v?"default":"ew-resize",pt=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),Ct=r<50,Et=r<40;react.useEffect(()=>{x&&(!Xe||ke||e.segments)&&x(null);},[Xe,ke,e.segments,x]);let Wt=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),St=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},zt=Z=>Math.round(Z/s)*s,it=Z=>{let Oe=Math.round(Z/s),Ae=new Date(n);return Ae.setDate(Ae.getDate()+Oe),Ae},jt=(Z,Oe)=>{for(let Ae of g){if(Ae.id===e.id)continue;let I=5;if(Z>=Ae.x-I&&Z<=Ae.x+Ae.width+I&&Oe>=Ae.y-I&&Oe<=Ae.y+Ae.height+I)return Ae.id}return null},mt=react.useCallback((Z,Oe,Ae)=>{if(v)return;Z.preventDefault(),Z.stopPropagation();let I=S.current?.ownerSVGElement;if(!I)return;let xe=I.createSVGPoint();xe.x=Z.clientX,xe.y=Z.clientY;let te=xe.matrixTransform(I.getScreenCTM()?.inverse()),T=Ae!==void 0?Ae:t,J=Oe;if(!J){let Ce=te.x-T;Z.shiftKey?(J="connect",B({x:t+r,y:a+Ve/2})):Z.ctrlKey||Z.metaKey?J="move":Z.altKey?J=Ce<r/2?"resize-start":"resize-end":Et?Ce<r/2?J="move":J="resize-end":Ct?Ce<=pt/2?J="resize-start":Ce>=r-pt/2?J="resize-end":J="move":Ce<=pt?J="resize-start":Ce>=r-pt?J="resize-end":J="move";}M.current=false,w(J),_e(false),O(null),J==="move"?U(te.x-T):J==="connect"?B({x:t+r,y:a+Ve/2}):U(0),L(T),q(r);},[t,r,a,Ve,v]),lt=react.useCallback(Z=>{let Oe=S.current?.ownerSVGElement;if(!Oe)return;let Ae=Oe.closest(".gantt-timeline-scroll");if(!Ae)return;let I=Ae.getBoundingClientRect(),xe=60,te=15,T=0;if(Z.clientX<I.left+xe){let J=I.left+xe-Z.clientX;T=-Math.min(te,J/2);}else if(Z.clientX>I.right-xe){let J=Z.clientX-(I.right-xe);T=Math.min(te,J/2);}return T!==0&&(Ae.scrollLeft+=T),T!==0},[]),ne=react.useCallback(Z=>{if(A==="none")return;M.current=true,P.current=Z;let Oe=S.current?.ownerSVGElement;if(!Oe)return;if(A==="move"||A==="resize-start"||A==="resize-end"){let xe=lt(Z);xe&&!k.current?k.current=window.setInterval(()=>{P.current&&(lt(P.current),ne(P.current));},16):!xe&&k.current&&(window.clearInterval(k.current),k.current=null);}let Ae=Oe.createSVGPoint();Ae.x=Z.clientX,Ae.y=Z.clientY;let I=Ae.matrixTransform(Oe.getScreenCTM()?.inverse());if(A==="connect"){B({x:I.x,y:I.y});let xe=jt(I.x,I.y);fe(xe);}else if(A==="move"){let xe=I.x-_,te=zt(xe);L(te),q(r);let T=Math.round((te-t)/s);if(f?.(e.id,T,true),e.segments&&e.segments.length>0&&ee!==null){let J=te-Te;$e(J);}}else if(A==="resize-start"){let xe=I.x,te=zt(xe),T=t+r-te;T>=s&&(L(te),q(T));}else if(A==="resize-end"){let xe=I.x,T=zt(xe)-t;T>=s&&q(T);}},[A,t,r,s,_,e,zt,ee,Te,jt,fe,B,L,q,$e,f,lt]),me=react.useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),P.current=null,A!=="none"){if(A==="connect")X&&m&&m(e,X),B(null),fe(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),Oe,Ae,I=true;if(A==="move"){if(Oe=it(ae),Ae=new Date(Oe.getTime()+Z),e.segments&&e.segments.length>0&&ee!==null){let xe=Math.round(Ue/s),te=e.segments.map((Le,$t)=>{if($t===ee){let Nt=new Date(Le.startDate),Jt=new Date(Le.endDate);return Nt.setDate(Nt.getDate()+xe),Jt.setDate(Jt.getDate()+xe),{startDate:Nt,endDate:Jt}}return Le}),T=te.flatMap(Le=>[Le.startDate,Le.endDate]),J=new Date(Math.min(...T.map(Le=>Le.getTime()))),Ce=new Date(Math.max(...T.map(Le=>Le.getTime())));p?.({...e,segments:te},J,Ce),st(t,r);return}}else A==="resize-start"?(Oe=it(ae),Ae=e.endDate,Oe>Ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),I=false)):A==="resize-end"?(Oe=e.startDate,Ae=it(ae+K),Ae.setDate(Ae.getDate()-1),Ae<Oe&&(console.warn("Invalid date range: end date must be after or equal to start date"),I=false)):I=false;I&&Oe&&Ae&&(Ae.getTime()<Oe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,Oe,Ae));}f?.(e.id,0,false),st(t,r);}},[A,ae,K,e,p,X,m,t,r,s,it,Ue,ee,st,f]);react.useEffect(()=>{if(A==="none")return;let Z=Ae=>{ne(Ae);},Oe=()=>{me();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",Oe),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",Oe),k.current&&(window.clearInterval(k.current),k.current=null);}},[A,ne,me]);let $=ke&&!Bt?ae:t,Y=ke&&!Bt?K:r,Se=l.taskClass(e),Ze=24,gt=h?e.isCriticalPath?1:.25:1,Pt=react.useCallback(Z=>{if(!Ne)return;Z.stopPropagation(),Z.preventDefault();let Ae=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;D.current={barRect:Ae,initialPct:e.progress||0},Z.currentTarget.setPointerCapture(Z.pointerId),re(e.progress||0);},[Ne,e.progress,re]),Rt=react.useCallback(Z=>{let Oe=D.current;if(!Oe)return;let I=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??Oe.barRect;if(!I||I.width<=0)return;let xe=(Z.clientX-I.left)/I.width,te=Math.round(Math.max(0,Math.min(1,xe))*100);Z.shiftKey&&(te=Math.round(te/25)*25),re(te);},[re]),Mt=react.useCallback(Z=>{let Oe=D.current;if(!Oe)return;Z.stopPropagation(),Z.preventDefault();try{Z.currentTarget.releasePointerCapture(Z.pointerId);}catch{}let Ae=j;D.current=null,re(null),Ae!=null&&Ae!==Oe.initialPct&&C&&C(e,Ae);},[j,C,e,re]),Yt=react.useCallback(Z=>{Z.stopPropagation(),Z.preventDefault();},[]),Qt=j??(e.progress||0);return jsxRuntime.jsxs("g",{ref:S,"data-task-bar":"true",style:{opacity:gt,transition:"opacity 300ms ease"},onClick:()=>{!ke&&!M.current&&d?.(e),M.current=false;},onDoubleClick:Z=>{!ke&&!M.current&&(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!ke&&_e(true),onMouseMove:Z=>{x&&Xe&&!ke&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ve,showBelow:false,mouseX:Z.clientX,mouseY:Z.clientY});},onMouseLeave:()=>{ke||(_e(false),O(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+Ze,height:Ve,fill:"transparent",style:{pointerEvents:"all"}}),Xe&&!ke&&!Ct&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:pt,height:Ve,fill:Ge==="resize-start"?o.accent:"transparent",opacity:Ge==="resize-start"?.15:0,style:{cursor:ut,pointerEvents:"all"},onMouseEnter:()=>O("resize-start"),onMouseDown:Z=>mt(Z,"resize-start")}),jsxRuntime.jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:Ve,fill:Ge==="move"?o.accent:"transparent",opacity:Ge==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:Z=>mt(Z,"move")}),jsxRuntime.jsx("rect",{x:t+r-pt,y:a,width:pt,height:Ve,fill:Ge==="resize-end"?o.accent:"transparent",opacity:Ge==="resize-end"?.15:0,style:{cursor:ut,pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:Z=>mt(Z,"resize-end")})]}),Xe&&!ke&&Et&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ve,fill:Ge==="move"?o.accent:"transparent",opacity:Ge==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:Z=>mt(Z,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ve,fill:Ge==="resize-end"?o.accent:"transparent",opacity:Ge==="resize-end"?.2:0,style:{cursor:ut,pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:Z=>mt(Z,"resize-end")}),Xe&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ke&&!Bt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae,y:a,width:K,height:Ve,rx:Pe,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"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!ke&&(()=>{let Z=e.baselineStartDate.getTime(),Oe=e.baselineEndDate.getTime(),Ae=n.getTime(),I=864e5,xe=(Z-Ae)/I,te=(Oe-Z)/I,T=xe*s,J=Math.max(te*s,s),Ce=$+Y,Le=T+J,$t=e.endDate?.getTime()??0,Nt=Math.ceil(($t-Oe)/I),Jt=Nt>0,Ua=Nt<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:T,y:a,width:J,height:Ve,rx:Pe,fill:"none",stroke:Ke?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Jt&&Ce>Le&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Ce-Le,height:Ve,rx:0,fill:"#EF4444",opacity:.2}),Jt&&jsxRuntime.jsxs("text",{x:Math.max(Ce,Le)+6,y:a+Ve/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Nt,"d"]}),Ua&&jsxRuntime.jsxs("text",{x:Ce+6,y:a+Ve/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Nt,"d"]})]})})(),!e.segments&&tt&&W&&(()=>{let Oe=a+(Ve-8)/2,Ae=4,I=e.progress||0,xe=new Date;xe.setHours(0,0,0,0);let te=e.startDate&&xe>=e.startDate,T=e.endDate&&(()=>{let Jt=new Date(e.endDate);return Jt.setHours(0,0,0,0),xe>Jt})(),J=e.startDate&&xe<e.startDate,Ce=1;if(te&&e.startDate&&e.endDate&&!J){let Jt=new Date(e.startDate);Jt.setHours(0,0,0,0);let Ua=new Date(e.endDate);Ua.setHours(0,0,0,0);let ya=Math.max(1,(Ua.getTime()-Jt.getTime())/(1e3*60*60*24)),Sr=Math.min((xe.getTime()-Jt.getTime())/(1e3*60*60*24),ya)/ya*100;Ce=Sr>0?I/Sr:1;}let Le;I>=100?Le="#00E5CC":J?Le="#4B5563":T&&I<100?Le="#EF4444":Ce>=.95?Le="#22C55E":Ce>=.8?Le="#F59E0B":Le="#EF4444";let $t=Math.max(I/100*Y,I>0?Ae*2:0),Nt=Y>100&&I>0;return jsxRuntime.jsxs("g",{"data-task-class":Se,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:$,y:Oe,width:Y,height:8,rx:Ae,fill:"rgba(255,255,255,0.10)"}),I>0&&jsxRuntime.jsx("rect",{x:$,y:Oe,width:$t,height:8,rx:Ae,fill:Le}),Nt&&jsxRuntime.jsxs("text",{x:$+$t+6,y:Oe+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(I),"%"]})]})})(),!e.segments&&tt&&!W&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$,y:a,width:Y,height:Ve,rx:Pe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Se,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:ke&&!Bt?.15:e.parentId?.6:1,scale:Xe&&!ke?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>mt(Z),style:{cursor:ct,pointerEvents:"all"}}),!e.segments&&!tt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$,y:a,width:Y,height:Ve,rx:Pe,fill:Be,"data-task-class":Se,initial:{opacity:0,scale:.95},animate:{opacity:ke&&!Bt?.15:e.parentId?.6:Xe?.9:.8,scale:Xe&&!ke?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:W?void 0:Z=>mt(Z),style:{cursor:W?"default":ct,pointerEvents:"all"}}),tt&&(H||se)&&!e.segments&&jsxRuntime.jsx("rect",{x:$,y:a,width:Y,height:Ve,rx:Pe,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&&Qt>0&&!W&&jsxRuntime.jsx("rect",{x:$,y:a,width:Math.max(Y*(Qt/100),Pe*2),height:Ve,rx:Pe,fill:Be,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!W&&e.progress<100&&(()=>{let Z=e.progress>0?Y*(e.progress/100):0,Oe=$+Z,Ae=Y-Z,I=e.progress===0?Pe:0,xe=e.progress===0?$:Oe,te=e.progress===0?Y:Ae;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:xe,y:a,width:te,height:Ve,rx:I,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:xe,y:a,width:te,height:Ve,rx:I,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),tt&&!e.segments&&e.progress>0&&e.progress<100&&!W&&!ke&&j===null&&(()=>{let Z=$+Y*(e.progress/100),Oe=8,Ae=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:Z,cy:a+Ve/2,r:Oe,fill:Ae?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:Z,y:a+Ve/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Ae?.initials||Ae?.name?.charAt(0)?.toUpperCase()||""})]})})(),Ne&&!ke&&Y>=40&&(j!==null||Qt<88)&&(()=>{let Z=$+Y*(Qt/100),Oe=a+Ve/2,Ae=j!==null,I=Ae?7:Xe?6:5,xe=Ae||Xe?1:.35,te=$+Y-Z,T=Math.max(4,Math.min(12,te-10)),J=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Z-J,y:Oe-12,width:J+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Pt,onPointerMove:Rt,onPointerUp:Mt,onPointerCancel:Mt,onClick:Yt,onDoubleClick:Yt,onMouseDown:Ce=>Ce.stopPropagation()}),jsxRuntime.jsx("circle",{cx:Z,cy:Oe,r:I,fill:"#FFFFFF",stroke:Be,strokeWidth:2,opacity:xe,style:{pointerEvents:"none",filter:Ae?`drop-shadow(0 0 4px ${Be})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Ae&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Z-20,y:Oe-28,width:40,height:18,rx:4,fill:Ke?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Be,strokeWidth:1}),jsxRuntime.jsxs("text",{x:Z,y:Oe-16,textAnchor:"middle",dominantBaseline:"central",fill:Ke?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[j,"%"]})]})]})})(),e.segments&&e.segments.map((Z,Oe)=>{let Ae=(Z.startDate.getTime()-n.getTime())/864e5*s,xe=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ae+s,te=ke&&A==="move"&&ee===Oe,T=nt===Oe,J=te?Ae+Ue:Ae;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ke&&ce(Oe),onMouseLeave:()=>!ke&&ce(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:J,y:a,width:xe,height:Ve,rx:Pe,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:te||e.parentId?.6:T?.9:.8,scale:T&&!ke?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ce=>{Ce.stopPropagation(),ue(Oe),ve(Ae),mt(Ce,void 0,Ae);},style:{cursor:ct,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:J,y:a,width:xe*(e.progress/100),height:Ve,rx:Pe,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Oe}`)}),je&&(H||se)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[se&&!H&&jsxRuntime.jsx("rect",{x:$,y:a,width:Y,height:Ve,rx:Pe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),H&&jsxRuntime.jsx("rect",{x:$,y:a,width:Y,height:Ve,rx:Pe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Y>60&&!e.segments&&!(tt&&W)&&(()=>{let Z=l.taskLabel(e),Oe=typeof Z=="string"?Z:e.name,Ae=Oe.length>Math.floor(Y/8)?`${Oe.substring(0,Math.floor(Y/8))}...`:Oe;return jsxRuntime.jsx("text",{x:$+8,y:a+Ve/2,dominantBaseline:"middle",fill:we?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:we?"line-through":"none"},children:Ae})})(),!ke&&!e.segments&&!W&&e.progress>0&&e.progress<100&&(tt?jsxRuntime.jsxs("text",{x:$+Y+6,y:a+Ve/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Y>100?jsxRuntime.jsxs("text",{x:$+Y-12,y:a+Ve/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&&Y>80&&!ke&&!e.segments&&!(tt&&W)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:$+Y-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:$+Y-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Xe||bt)&&!Bt&&!e.segments&&!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:$-2,y:a,width:16,height:Ve,fill:"transparent",style:{cursor:ut},onMouseEnter:()=>O("resize-start"),onMouseLeave:()=>O(null),onMouseDown:Z=>{Z.stopPropagation(),mt(Z,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:$+4,y:a+8,width:3,height:Ve-16,rx:1.5,fill:Ge==="resize-start"||A==="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:$+Y-14,y:a,width:16,height:Ve,fill:"transparent",style:{cursor:ut},onMouseEnter:()=>O("resize-end"),onMouseLeave:()=>O(null),onMouseDown:Z=>{Z.stopPropagation(),mt(Z,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:$+Y-7,y:a+8,width:3,height:Ve-16,rx:1.5,fill:Ge==="resize-end"||A==="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:Xe&&!ke&&!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+Ve/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>O("connect"),onMouseLeave:()=>O(null),onMouseDown:Z=>{Z.stopPropagation(),mt(Z,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ve/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ge==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Bt&&z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ve/2,x2:z.x,y2:z.y,stroke:X?o.statusCompleted:o.accent,strokeWidth:X?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:X?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:z.x,cy:z.y,r:X?8:6,fill:X?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),X&&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"})]}),(Xe||ke)&&!Bt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$-1,y:a-1,width:Y+2,height:Ve+2,rx:Pe+1,fill:"none",stroke:ke?o.accent:tt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:tt?1:2,opacity:ke||tt?.6:.4,initial:{opacity:0},animate:{opacity:ke||tt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:ae,y1:0,x2:ae,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:ae+K,y1:0,x2:ae+K,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&!ke&&!e.segments&&!x&&(()=>{let Ae=a<100,I=Ae?a+Ve+13:a-82-13,xe=Ae?`M ${$+Y/2-6} ${a+Ve+3} L ${$+Y/2} ${a+Ve+13} L ${$+Y/2+6} ${a+Ve+3}`:`M ${$+Y/2-6} ${a-13} L ${$+Y/2} ${a-3} L ${$+Y/2+6} ${a-13}`,te=I+22,T=I+40,J=I+55,Ce=I+70,Le=Ae?I+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:xe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:$+Y/2-120,y:I,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:$+Y/2,y:te,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:$+Y/2-110,y:T,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:$+Y/2-70,y:T,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt(e.startDate)}),jsxRuntime.jsx("text",{x:$+Y/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:$+Y/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt(e.endDate)}),jsxRuntime.jsx("text",{x:$+Y/2+10,y:T,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:$+Y/2+65,y:T,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:St()}),jsxRuntime.jsx("text",{x:$+Y/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:$+Y/2+65,y:J,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:$+Y/2-110,y:Ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:$+Y/2-50,y:Ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($t=>$t.name).join(", ").substring(0,30),e.assignees.map($t=>$t.name).join(", ").length>30?"...":""]})]}),!Ae&&jsxRuntime.jsx("text",{x:$+Y/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Et?"Left: move \u2022 Right: resize":Ct?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Hd=260,Vn=8,Tm=16,Bv=-12;function Nm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:v,mouseY:C}=e,N=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null,S=h.lastActivity!=null,M=(N?155:105)+(S?28:0),k=v+Tm,P=C+Bv-M;k+Hd>window.innerWidth-Vn&&(k=v-Hd-Tm),k<Vn&&(k=Vn);let A=P<Vn;A&&(P=C+20),P+M>window.innerHeight-Vn&&(P=window.innerHeight-Vn-M),o({left:k,top:P,showBelow:A});},[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"},d=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let v=Math.floor(h/60),C=h%60;return v===0?`${C}m`:C===0?`${v}h`:`${v}h ${C}m`},p=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",f=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",y=t.border||"#374151",b=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Hd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,border:`1px solid ${y}`,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(Pi,{label:l.start,value:s.startDate?d(s.startDate):"N/A",labelColor:p,valueColor:m}),jsxRuntime.jsx(Pi,{label:l.duration,value:i(),labelColor:p,valueColor:m}),jsxRuntime.jsx(Pi,{label:l.end,value:s.endDate?d(s.endDate):"N/A",labelColor:p,valueColor:m}),jsxRuntime.jsx(Pi,{label:l.progress,value:`${s.progress}%`,labelColor:p,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:p},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.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:p},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:p},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:f,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:p},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(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:p,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 bd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},d=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),i},{});return jsxRuntime.jsxs("div",{className:c("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:c("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(d).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(p=>jsxRuntime.jsxs("button",{onClick:()=>l(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:p.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:p.name}),p.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function yd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[d,i]=react.useState("json"),[u,p]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,y=await fu(e,d,x);bu(y,d);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await xu(y),h=y.name.endsWith(".json")?"json":"csv",v=yu(b,h);p(v),v.success&&r&&r(v,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:c("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:c("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:c("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-[#00E5CC]":"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:c("p-4 rounded-lg border-2 transition-all text-center",d===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),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:f,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"})]})]}),u&&jsxRuntime.jsxs("div",{className:c("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:c("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var ix=["URGENT","HIGH","MEDIUM","LOW"],lx=[{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"}],dx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function xd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:m=false,groupBy:g="none",onGroupByChange:f}){let[x,y]=react.useState(true),b=react.useCallback(S=>{a({search:S.target.value});},[a]),h=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),v=react.useCallback(S=>{r({by:S.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:()=>y(!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:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.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:[p&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),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:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,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:S=>{let M=S.target.value;a({priorities:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ix.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let M=S.target.value;a({assignees:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let M=S.target.value;a({labels:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),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:lx.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.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"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:S=>f(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:dx.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function vd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:d}){let[i,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let g=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxRuntime.jsxs("div",{className:c("relative",r),ref:p,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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(()=>d?.()),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 wd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},kd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Cd={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"}},cn={dark:wd,light:kd,neutral:Cd},Ci="dark";var Ti=react.createContext(void 0),xx="asakaa-theme";function Kp({children:e,defaultTheme:t=Ci,storageKey:a=xx}){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,d=cn[r];Object.entries(d.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${vx(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let m=d.colors[u];m&&l.style.setProperty(p,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:cn};return jsxRuntime.jsx(Ti.Provider,{value:n,children:e})}function Bn(){let e=react.useContext(Ti);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function vx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Td({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Bn();return e?jsxRuntime.jsxs("div",{className:c("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(cn).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:c("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children: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 qp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xt[e]||xt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",xt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",xt[e].bgSecondary),bgGrid:r("--theme-bg-card",xt[e].bgGrid),bgWeekend:r("--theme-bg-hover",xt[e].bgWeekend),border:r("--theme-border-primary",xt[e].border),borderLight:r("--theme-border-subtle",xt[e].borderLight),textPrimary:r("--theme-text-primary",xt[e].textPrimary),textSecondary:r("--theme-text-secondary",xt[e].textSecondary),textTertiary:r("--theme-text-tertiary",xt[e].textTertiary),accent:r("--theme-accent-primary",xt[e].accent),accentHover:r("--theme-accent-hover",xt[e].accentHover),accentLight:r("--theme-accent-primary",xt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",xt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",xt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",xt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",xt[e].dependency),dependencyHover:r("--theme-border-secondary",xt[e].dependencyHover),criticalPath:r("--theme-error",xt[e].criticalPath),criticalPathLight:r("--theme-error",xt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",xt[e].today):e==="neutral"?r("--theme-text-primary",xt[e].today):r("--theme-error",xt[e].today),todayLight:e==="light"?r("--theme-accent-primary",xt[e].todayLight):e==="neutral"?r("--theme-text-primary",xt[e].todayLight):r("--theme-error",xt[e].todayLight),milestone:r("--theme-warning",xt[e].milestone),milestoneLight:r("--theme-warning",xt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",xt[e].statusTodo),statusInProgress:r("--theme-accent-primary",xt[e].statusInProgress),statusCompleted:r("--theme-success",xt[e].statusCompleted),hoverBg:r("--theme-bg-hover",xt[e].hoverBg),focusRing:r("--theme-accent-primary",xt[e].focusRing),...xt[e].dotGrid&&{dotGrid:xt[e].dotGrid},...xt[e].glassHeader&&{glassHeader:xt[e].glassHeader},...xt[e].glassToolbar&&{glassToolbar:xt[e].glassToolbar},...xt[e].forecastHud&&{forecastHud:xt[e].forecastHud},...xt[e].neonRedGlow&&{neonRedGlow:xt[e].neonRedGlow},...xt[e].executionBarBg&&{executionBarBg:xt[e].executionBarBg}}}var Ni={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"}},Yp={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"}},Nd={en:Ni,es:Yp};function Xp(e){return Nd[e]||Nd.en}function Dd(e,t){let a=Xp(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 $n=react.createContext(Ni);function $r(){return react.useContext($n)}function ks(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,d;a==="right"?d=n.right-r:d=n.left;let i=8;d+r>window.innerWidth-i&&(d=window.innerWidth-i-r),d<i&&(d=i),s({top:l,left:d});},[t,a,e,r]),o}function nm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,d]=react.useState(false),[i,u]=react.useState(null),p=react.useRef(null),m=react.useRef(null),g=$r(),f=ks(p,l,"right",176);if(react.useEffect(()=>{if(!l)return;let h=v=>{let C=v.target;p.current&&!p.current.contains(C)&&m.current&&!m.current.contains(C)&&d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]),!(t||a||r||o||s||n))return null;let y=[{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(h=>h.handler),b=async(h,v)=>{if(v){u(h);try{await v();}catch(C){console.error(`Export ${h} failed:`,C);}finally{u(null),d(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:p,onClick:()=>d(!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:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((h,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(h.id,h.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<y.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===h.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"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function Qp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[d,i]=react.useState(null),[u,p]=react.useState(false),m=react.useRef(null),g=react.useRef(null),f=$r(),x=ks(m,n,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let N=S=>{let M=S.target;m.current&&!m.current.contains(M)&&g.current&&!g.current.contains(M)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),v=async(N,S)=>{if(S){i(N);try{await S();}catch(M){console.error(`Export ${N} failed:`,M);}finally{i(null),l(false);}}},C=()=>{s?.(),p(true),setTimeout(()=>p(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:f.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:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.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:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((N,S)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(N.id,N.handler),disabled:d!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.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:d===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))})]}),h.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"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:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Vx({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 Gx({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 Zp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),d=$r(),i=ks(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let f=g.target;n.current&&!n.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:d.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],p=t==="all"?d.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:`${d.toolbar.wbsLevel||"Level"}: ${p}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:p})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children: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:u.map((m,g)=>{let f=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:f?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:m.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function em({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),d=react.useRef(null),i=$r(),u=ks(l,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;l.current&&!l.current.contains(h)&&d.current&&!d.current.contains(h)&&n(false);},y=b=>{b.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),d._cleanup&&d._cleanup();}},[s]);let p=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],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:f=>{f.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(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.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:p.map(f=>{let x=t===f.value&&!r,y=()=>f.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(f.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?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor: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?"#00E5CC":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:"#00E5CC"}})]})})]})}),document.body)]})}function jx({value:e,onChange:t,theme:a}){let r=$r(),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 _x({theme:e,forecast:t}){let a=$r(),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,d=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,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,m=t?.currency||"$",g=p!=null?p>=1e6?`${m}${(p/1e6).toFixed(2)}M`:p>=1e3?`${m}${(p/1e3).toFixed(1)}K`:`${m}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.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:u,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&&y&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function Kx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:d,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[m,g]=react.useState(false),f=react.useRef(null),x=react.useRef(null),y=$r(),b=ks(f,m,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let S=M=>{let k=M.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&g(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[m]);let v=y.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!p,tooltip:p?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:d}],N=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:f,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:y.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:b.top,left:b.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:[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:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:C.map((S,M)=>{let k=S.icon,F=S.disabled,A=S.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!F&&S.onChange?.(!S.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:F?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"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:M*.03},title:A,children:[jsxRuntime.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:F?h?"rgba(255,255,255,0.2)":"#D1D5DB":S.active?e.accent||"#00E5CC":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.label}),S.active&&!F&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},S.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((S,M)=>{let k=i===S.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(S.value),className:"w-full flex items-center justify-between 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:(C.length+M)*.03},children:[jsxRuntime.jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:S.label}),k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},S.value)})]})]})}),document.body)]})}function Di({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:p,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:S,projectForecast:M,onExportPNG:k,onExportPDF:F,onExportExcel:A,onExportCSV:w,onExportJSON:_,onExportMSProject:U,showCriticalPath:ae=true,onShowCriticalPathChange:L,showDependencies:K=true,onShowDependenciesChange:q,highlightWeekends:z=true,onHighlightWeekendsChange:B,showBaseline:X=false,onShowBaselineChange:fe,onCopySnapshotLink:Ge,hasDependencies:O=true}){let ee=$r(),ue=k||F||A||w||_||U,Te=!!e.glassToolbar,[ve,Ue]=react.useState(false),$e=react.useRef(null);react.useEffect(()=>{ve&&$e.current&&$e.current.focus();},[ve]);let nt=[{value:"day",label:ee.toolbar.day},{value:"week",label:ee.toolbar.week},{value:"month",label:ee.toolbar.month}],ce=[{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"})}],Xe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Te){let _e=Xe?"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:Xe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ve?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ue(!ve),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"})}),ve&&jsxRuntime.jsx("input",{ref:$e,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:()=>Ue(false),onKeyDown:ke=>{ke.key==="Escape"&&Ue(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),S&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Xe?"#000000":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>S("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Xe?"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:ee.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>S("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Xe?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:N==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:ee.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(jx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),v&&jsxRuntime.jsx(Zp,{theme:e,value:h??"all",onChange:v,maxDepth:C}),f&&jsxRuntime.jsx(em,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),jsxRuntime.jsx(Kx,{theme:e,showCriticalPath:ae,onShowCriticalPathChange:L,showBaseline:X,onShowBaselineChange:fe,highlightWeekends:z,onHighlightWeekendsChange:B,showDependencies:K,onShowDependenciesChange:q,rowDensity:l,onRowDensityChange:d,hasDependencies:O}),jsxRuntime.jsx(Qp,{theme:e,onExportPNG:k,onExportPDF:F,onExportExcel:A,onExportMSProject:U,onCopySnapshotLink:Ge}),u&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Xe?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Xe?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p||ee.toolbar.createTask})]})]})]}),M&&jsxRuntime.jsx(_x,{theme:e,forecast:M})]})}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(Gx,{options:nt,value:t,onChange:_e=>a(_e),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(Zp,{theme:e,value:h??"all",onChange:v,maxDepth:C}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(em,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p||ee.toolbar.createTask})]}),(ue||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Qp,{theme:e,onExportPNG:k,onExportPDF:F,onExportExcel:A,onExportMSProject:U,onCopySnapshotLink:Ge}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Vx,{options:ce,value:s,onChange:_e=>n(_e),theme:e})]})]})}function Si({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=p=>{l.current&&!l.current.contains(p.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let u=d.current.getBoundingClientRect();n({x:u.left,y:u.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(ta,{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(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function Hn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,d]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,p=r.length*36+8,m=8,g=window.innerWidth,f=window.innerHeight,x=t,y=a;t+u+m>g&&(x=t-u,x<m&&(x=m)),a+p+m>f&&(y=f-p-m,y<m&&(y=m)),d({x,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},p=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ma={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function pm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:m=true}){let g=react.useRef(false),f=react.useCallback(v=>{g.current=v;},[]),x=react.useCallback(v=>{let C=[],N=S=>{for(let M of S)C.push(M),M.subtasks&&M.subtasks.length>0&&M.isExpanded&&N(M.subtasks);};return N(v),C},[]),y=react.useCallback(()=>{let v=x(e);for(let C of v)if(t.has(C.id))return C;return null},[e,t,x]),b=react.useCallback((v,C)=>{let N=x(e);if(N.length===0)return;let S=y();if(!S){a(N[0].id,false);return}let M=N.findIndex(A=>A.id===S.id);if(M===-1)return;let k=v==="up"?M-1:M+1;if(k<0||k>=N.length)return;let F=N[k];a(F.id,C);},[e,y,x,a]),h=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 M=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),F=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("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)&&u(F.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),n(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),d(k));return}if(v.key==="Enter"&&!v.shiftKey&&!M){F&&(v.preventDefault(),r(F.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!M){F&&(v.preventDefault(),r(F.id,"above"));return}if(v.key==="Enter"&&M){F&&(v.preventDefault(),p(F.id));return}if(v.key==="F2"){F&&(v.preventDefault(),i(F.id));return}if(v.key==="Delete"||v.key==="Backspace"&&M){k.length>0&&(v.preventDefault(),o(k));return}if(v.key==="d"&&M&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[m,t,y,b,r,o,s,n,l,d,i,u,p]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:f}}function gm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(p=>{t(new Set([p])),r(p);},[]),s=react.useCallback(p=>{t(m=>{let g=new Set(m);return g.has(p)?g.delete(p):g.add(p),g}),r(p);},[]),n=react.useCallback((p,m)=>{if(!a){o(p);return}let g=m.indexOf(a),f=m.indexOf(p);if(g===-1||f===-1){o(p);return}let x=Math.min(g,f),y=Math.max(g,f),b=m.slice(x,y+1);t(new Set(b)),r(p);},[a,o]),l=react.useCallback((p,m,g,f)=>{f?n(p,m):g?s(p):o(p);},[o,s,n]),d=react.useCallback((p,m)=>{m?t(g=>{let f=new Set(g);return f.add(p),f}):o(p);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(p=>e.has(p),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function Fd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Fd(t.subtasks):t.subtasks}))}function zn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,d)=>(l.position??0)-(d.position??0));for(let l=0;l<n.length;l++){let d={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function Un(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Un(a.subtasks,t);if(r)return r}}return null}function Pd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Pd(a.subtasks,t);if(r)return r}return null}function Ad(e,t){if(t.length===0)return e;let a=zn(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 f=[];return {tasks:m.filter(y=>{if(g.has(y.id))return f.push(y),false;if(y.subtasks){let b=n(y.subtasks,g);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(m,g,f)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),d=new Set(t),{tasks:i,removed:u}=n(e,d),p=l(i,s.id,u);return Fd(p)}function Ld(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Pd(a,r);if(!o)continue;let s=Pd(a,o.id),n=(i,u,p)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let f=g.subtasks.findIndex(x=>x.id===p);if(f!==-1){let[x]=g.subtasks.splice(f,1);return x}}if(g.subtasks){let f=n(g.subtasks,u,p);if(f)return f}}return null},l=(i,u,p)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,p),i;for(let g of i)g.subtasks&&l(g.subtasks,u,p);return i},d=n(a,o.id,r);d&&(s&&s.subtasks?l(s.subtasks,o.id,d):l(a,o.id,d));}return Fd(a)}function Id(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,d)=>{let i=n.findIndex(p=>p.id===l);if(i===-1){for(let p of n)if(p.subtasks&&s(p.subtasks,l,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function Bd(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 Ts(e,t){let a=[...e],r=[];for(let o of t){let s=(d,i)=>d.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),n=d=>{let i=d.findIndex(g=>g.id===o);if(i===-1){for(let g of d)if(g.subtasks){let f=n(g.subtasks);if(f)return f}return null}let u=d[i],p=`${u.id}-copy-${Date.now()}`,m={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return d.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function fm(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:"#00E5CC"},l=d=>{let i=d.findIndex(p=>p.id===t);if(i===-1){for(let p of d)if(p.subtasks&&l(p.subtasks))return true;return false}let u=a==="above"?i:i+1;return d.splice(u,0,n),true};return l(r),{tasks:r,newTask:n}}function Rd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Rd(r.subtasks,t,a)}:r)}function $d(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:$d(a.subtasks,t)}:a)}function Od(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let f=a(g.subtasks);if(f)return f}}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,d=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let f=d(g.subtasks);if(f>=0)return f}}return 0},i=d(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},p=m=>m.map(g=>{if(g.id===t){let f=g.subtasks||[];return {...g,subtasks:[...f,u],isExpanded:true}}return g.subtasks?{...g,subtasks:p(g.subtasks)}:g});return {tasks:p(e),newTask:u}}function bm(e,t,a,r){if(t===a)return e;let o=Un(e,t);if(!o)return e;if(a){let l=(d,i)=>{if(!d.subtasks)return false;for(let u of d.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(o,a))return e}let s=l=>{let d=l.filter(u=>u.id!==t),i=d.length<l.length;return d.map((u,p)=>{let m=i?{...u,position:p}:u;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((d,i)=>({...d,position:i}));}else {let l=d=>d.map(i=>{if(i.id===a){let u=i.subtasks||[],p=r!==void 0?r:u.length,m=[...u];m.splice(p,0,{...o,parentId:a});let g=m.map((f,x)=>({...f,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 Or(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Or(t.subtasks),r=a.reduce((l,d)=>(d.startDate&&l.starts.push(new Date(d.startDate).getTime()),d.endDate&&l.ends.push(new Date(d.endDate).getTime()),l.progresses.push(d.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,d)=>l+d,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function Mi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:p,onColumnResize:m,onTaskUpdate:g,onTaskIndent:f,onTaskOutdent:x,onTaskMove:y,onMultiTaskDelete:b,onTaskDuplicate:h,onTaskCreate:v,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:S,onDeleteRequest:M,onTaskReparent:k,scrollContainerRef:F,showCriticalPath:A=false}){let w=react.useContext($n),[_,U]=react.useState(null),[ae,L]=react.useState(null),[K,q]=react.useState(""),z=react.useRef(null),[B,X]=react.useState(null),[fe,Ge]=react.useState(0),[O,ee]=react.useState(0),[ue,Te]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ve,Ue]=react.useState(null),[$e,nt]=react.useState(null),[ce,Xe]=react.useState(null),_e=react.useRef(0),ke=5,bt=react.useRef(false),[Bt,st]=react.useState(null),[Ve,tt]=react.useState(false),Ke=react.useRef(null),[Fe,W]=react.useState(null),[D,j]=react.useState(false),re=react.useRef(null);react.useEffect(()=>{function ne(me){re.current&&!re.current.contains(me.target)&&j(false);}if(D)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[D]),react.useEffect(()=>{ae&&z.current&&(z.current.focus(),z.current.select());},[ae]),react.useEffect(()=>{if(!B)return;let ne=$=>{let Y=$.clientX-fe,Se=O+Y;m?.(B,Se);},me=()=>{X(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[B,fe,O,m]);let{selectedTaskIds:Ne,handleTaskClick:H,isTaskSelected:se}=gm(),{setIsEditing:je}=pm({tasks:e,selectedTaskIds:Ne,onTaskSelect:(ne,me)=>{let Y=zn(e).map(Se=>Se.id);H(ne,Y,me||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:f||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ne=>{let me=zn(e).find($=>$.id===ne);me&&ut(me);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ne=>{let me=zn(e).find($=>$.id===ne);me&&S&&S(me);},enableKeyboard:true}),we=(ne,me=0,$="")=>{let Y=[],Se=[...ne].sort((Ze,gt)=>(Ze.position??0)-(gt.position??0));for(let Ze=0;Ze<Se.length;Ze++){let gt=Se[Ze],Ft=Ze+1,Rt=$?`${$}.${Ft}`:`${Ft}.0`,Mt=gt.wbsCode||Rt;if(gt.wbsCode=Mt,Y.push({task:gt,level:me}),gt.subtasks&&gt.subtasks.length>0&&gt.isExpanded){let Qt=gt.wbsCode?.replace(/\.0$/,"")||($?`${$}.${Ft}`:`${Ft}`);Y.push(...we(gt.subtasks,me+1,Qt));}}return Y},He=we(e),ze=48,Be=Math.max(He.length*a,600-ze),ct=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,ut=ne=>{L(ne.id),q(ne.name),je(true);},ht=ne=>{K.trim()&&K!==e.find(me=>me.id===ne)?.name&&C?.(ne,K.trim()),L(null),q(""),je(false);},pt=()=>{L(null),q(""),je(false);},Ct=(ne,me)=>{me.stopPropagation(),N?.(ne.id);},Et=(ne,me)=>{me.preventDefault(),_e.current=me.clientY,Ue(ne),bt.current=false,tt(false),st({x:me.clientX,y:me.clientY});},Wt=ne=>{if(!ve||(Math.abs(ne.clientY-_e.current)>ke&&!bt.current&&(bt.current=true,tt(true)),st({x:ne.clientX,y:ne.clientY}),!bt.current))return;if(F?.current){let Ze=F.current,gt=Ze.getBoundingClientRect(),Ft=60,Rt=12;Ke.current&&(cancelAnimationFrame(Ke.current),Ke.current=null);let Mt=ne.clientY-gt.top,Yt=gt.bottom-ne.clientY;if(Mt<Ft&&Ze.scrollTop>0){let Qt=Math.round(Rt*(1-Mt/Ft)),Z=()=>{Ze.scrollTop-=Qt,bt.current&&Ze.scrollTop>0&&(Ke.current=requestAnimationFrame(Z));};Ke.current=requestAnimationFrame(Z);}else if(Yt<Ft&&Ze.scrollTop<Ze.scrollHeight-Ze.clientHeight){let Qt=Math.round(Rt*(1-Yt/Ft)),Z=()=>{Ze.scrollTop+=Qt,bt.current&&Ze.scrollTop<Ze.scrollHeight-Ze.clientHeight&&(Ke.current=requestAnimationFrame(Z));};Ke.current=requestAnimationFrame(Z);}}let $=document.querySelectorAll("[data-task-row]"),Y=null,Se=null;$.forEach(Ze=>{let gt=Ze.getBoundingClientRect(),Ft=Ze.getAttribute("data-task-row");if(Ft&&Ft!==ve&&ne.clientY>=gt.top&&ne.clientY<=gt.bottom){Y=Ft;let Rt=ne.clientY-gt.top,Mt=gt.height;Rt<Mt*.25?Se="above":Rt>Mt*.75?Se="below":Se="child";}}),nt(Y),Xe(Se);},St=()=>{if(bt.current&&ve&&$e&&ce){if(ce==="child")k?.(ve,$e);else if(ce==="above"||ce==="below"){let ne=(Se,Ze,gt=null)=>{for(let Ft of Se){if(Ft.id===Ze)return gt;if(Ft.subtasks){let Rt=ne(Ft.subtasks,Ze,Ft.id);if(Rt!==void 0)return Rt}}},me=ne(e,ve,null),$=ne(e,$e,null),Y=(Se,Ze,gt,Ft)=>{let Rt=Se.findIndex(Qt=>Qt.id===Ze),Mt=Ft?Se.findIndex(Qt=>Qt.id===gt):-1,Yt=ce==="below"?Rt+1:Rt;return Ft&&Mt!==-1&&Mt<Rt&&(Yt-=1),Math.max(0,Yt)};if($===null){let Ze=Y(e,$e,ve,me===null);k?.(ve,null,Ze);}else {let Se=Un(e,$);if(Se?.subtasks){let Ze=me===$,gt=Y(Se.subtasks,$e,ve,Ze);k?.(ve,$,gt);}}}}Ke.current&&(cancelAnimationFrame(Ke.current),Ke.current=null),Ue(null),nt(null),Xe(null),st(null),bt.current=false,tt(false);};react.useEffect(()=>{if(ve)return document.addEventListener("mousemove",Wt),document.addEventListener("mouseup",St),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Wt),document.removeEventListener("mouseup",St),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,$e,ce]);let zt=(ne,me,$)=>{let Y=me.subtasks&&me.subtasks.length>0;switch(ne.id){case "name":let Se=ae===me.id,Ze=_===me.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${$*20}px`},children:[k&&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:Ze?1:.3},onMouseDown:I=>Et(me.id,I),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:I=>{I.stopPropagation(),d?.(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"}),Se?jsxRuntime.jsx("input",{ref:z,type:"text",value:K,onChange:I=>q(I.target.value),onKeyDown:I=>{I.key==="Enter"?ht(me.id):I.key==="Escape"&&pt();},onBlur:()=>ht(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:I=>I.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),"%"]}),A&&me.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),A&&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"]})]}),Ze&&!Se&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>Ct(me,I),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:I=>{I.stopPropagation(),ut(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 Ft=ne.id==="startDate"?"startDate":"endDate",Rt=me[Ft],Mt=Fe?.taskId===me.id&&Fe?.field===Ft,Yt=I=>I?(typeof I=="string"?new Date(I):I).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:I=>I.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:Y?.5:1,cursor:Y?"default":"pointer"},title:Y?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!Y)if(Mt)W(null);else {let xe=I.currentTarget.getBoundingClientRect();W({taskId:me.id,field:Ft,month:Rt?typeof Rt=="string"?new Date(Rt):Rt:new Date,position:{top:xe.bottom+4,left:xe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Yt(Rt)}),Y&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Mt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>W(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:Fe?.position.top,left:Fe?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,xe=new Date(I);xe.setDate(I.getDate()+1);let te=new Date(I);te.setDate(I.getDate()+7);let T=new Date(I);return T.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:xe},{label:"Pr\xF3xima semana",date:te},{label:"2 semanas",date:T}].map((Ce,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:$t=>$t.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:$t=>$t.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Ft]:Ce.date}),W(null);},children:Ce.label},Le))})(),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:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Ft]:void 0}),W(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:()=>W(I=>I?{...I,month:new Date(I.month.getFullYear(),I.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:Fe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>W(I=>I?{...I,month:new Date(I.month.getFullYear(),I.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((I,xe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},xe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=Fe?.month||new Date,xe=I.getFullYear(),te=I.getMonth(),T=new Date(xe,te,1).getDay(),J=new Date(xe,te+1,0).getDate(),Ce=new Date,Le=[];for(let Nt=T-1;Nt>=0;Nt--)Le.push({day:new Date(xe,te,-Nt).getDate(),date:new Date(xe,te-1,new Date(xe,te,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=J;Nt++)Le.push({day:Nt,date:new Date(xe,te,Nt),isCurrentMonth:true});let $t=42-Le.length;for(let Nt=1;Nt<=$t;Nt++)Le.push({day:Nt,date:new Date(xe,te+1,Nt),isCurrentMonth:false});return Le.map((Nt,Jt)=>{let Ua=Nt.date.toDateString()===Ce.toDateString(),Ma=(Rt?typeof Rt=="string"?new Date(Rt):Rt:null)?.toDateString()===Nt.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:Nt.isCurrentMonth?Ma?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ma?"#00E5CC":"transparent",boxShadow:Ua&&!Ma?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{g?.(me.id,{[Ft]:Nt.date}),W(null);},children:Nt.day},Jt)})})()})]})]})]}),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:ct(me)})});case "assignees":if(Y)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 Qt=r.filter(I=>me.assignees?.some(xe=>xe.name===I.name||xe.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(rn,{assignedUsers:Qt,availableUsers:r,onChange:I=>{let xe=I.map(te=>({id:te.id,name:te.name,initials:te.initials,color:te.color}));g?.(me.id,{assignees:xe.length>0?xe:void 0});}})});case "status":if(Y){let I=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:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Ou,{status:me.status||"todo",onChange:I=>{g?.(me.id,{status:I,progress:I==="completed"?100:me.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:Y?.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 Z={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Oe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ae=Z[me.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(tn,{priority:Ae,onChange:I=>{I&&g?.(me.id,{priority:Oe[I]||"medium"});}})});default:return null}},it=ne=>[{id:"hide",label:"Hide Column",icon:ma.Hide,onClick:()=>p(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ma.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ma.SortDesc,onClick:()=>{}}],jt=ne=>ne.subtasks&&ne.subtasks.length>0?[{id:"addSubtask",label:w?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{N?.(ne.id);}},{id:"duplicate",label:w?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{h?.([ne.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:w?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{M?M(ne.id,ne.name):b?.([ne.id]);}}]:[{id:"edit",label:w?.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{n?.(ne);}},{id:"addSubtask",label:w?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{N?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:w?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{g?.(ne.id,{status:"todo",progress:0});},disabled:ne.status==="todo"},{id:"setInProgress",label:w?.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{g?.(ne.id,{status:"in-progress"});},disabled:ne.status==="in-progress"},{id:"markComplete",label:w?.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{g?.(ne.id,{status:"completed",progress:100});},disabled:ne.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:w?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{h?.([ne.id]);}},{id:"split",label:w?.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:w?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{M?M(ne.id,ne.name):b?.([ne.id]);}}],mt=u.filter(ne=>ne.visible),lt=mt.reduce((ne,me)=>ne+me.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:lt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${ze}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:mt.map((ne,me)=>{let $=me===mt.length-1,Y=ne.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Y?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(Y?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:Y&&mt.length===1?1:0,flexGrow:Y&&mt.length===1?1:0,borderRight:$?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Se=>{Se.preventDefault(),Te({isOpen:true,x:Se.clientX,y:Se.clientY,type:"header",columnId:ne.id});},onMouseEnter:Se=>{Se.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Se=>{Se.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Se=>{Se.preventDefault(),Se.stopPropagation(),X(ne.id),Ge(Se.clientX),ee(ne.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:B===ne.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Si,{columns:u,onToggleColumn:p,theme:t}),jsxRuntime.jsx("button",{onClick:()=>j(!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:re,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>j(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Be},children:He.map(({task:ne,level:me},$)=>{let Y=se(ne.id),Se=$e===ne.id,Ze=Se&&ce==="above",gt=Se&&ce==="below",Ft=Se&&ce==="child",Rt={};return Ft&&(Rt.backgroundColor=`${t.accent}15`,Rt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${ve===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Y?t.accentLight:Ft?`${t.accent}15`:$%2===0?t.bgPrimary:t.bgGrid,opacity:A?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Rt},onMouseEnter:()=>U(ne.id),onMouseLeave:()=>U(null),onClick:Mt=>{let Qt=zn(e).map(Ae=>Ae.id),Oe=navigator.platform.toUpperCase().indexOf("MAC")>=0?Mt.metaKey:Mt.ctrlKey;H(ne.id,Qt,Oe,Mt.shiftKey),s?.(ne);},onDoubleClick:Mt=>{Mt.stopPropagation(),n?.(ne);},onContextMenu:Mt=>{Mt.preventDefault(),Te({isOpen:true,x:Mt.clientX,y:Mt.clientY,type:"task",task:ne}),l?.(ne,Mt);},whileHover:{backgroundColor:Y?t.accentLight:t.hoverBg},children:[Ze&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),gt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),mt.map((Mt,Yt)=>{let Qt=Yt===mt.length-1,Z=Mt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Z?"justify-start":"justify-center"}`,style:{width:`${Mt.width}px`,minWidth:`${Mt.minWidth??(Z?200:60)}px`,maxWidth:`${Mt.maxWidth??2e3}px`,flexShrink:Z&&mt.length===1?1:0,flexGrow:Z&&mt.length===1?1:0,borderRight:Qt?"none":`1px solid ${_===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:zt(Mt,ne,Z?me:0)},`${ne.id}-${Mt.id}`)})]},ne.id)})}),jsxRuntime.jsx(Hn,{isOpen:ue.isOpen,x:ue.x,y:ue.y,items:ue.type==="header"&&ue.columnId?it(ue.columnId):ue.type==="task"&&ue.task?jt(ue.task):[],onClose:()=>Te({...ue,isOpen:false}),theme:t}),Ve&&Bt&&ve&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Bt.x+12,top:Bt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=He.find(me=>me.task.id===ve)?.task;return ne?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function wm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[d,i]=react.useState(t),[u,p]=react.useState(null),[m,g]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(0),[C,N]=react.useState(0),[S,M]=react.useState(null),[k,F]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:m,setHoveredTaskId:g,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:S,setHoveredSegmentIndex:M,isHovered:k,setIsHovered:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ae,L)=>{r("none"),p(null),g(null),l(ae),i(L),N(0),b(null),v(0);}}}function Pi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:C}){let N=wm(t,r),S=react.useRef(null),M=react.useRef(false),k=react.useRef(null),F=react.useRef(null),{dragMode:A,setDragMode:w,dragOffset:_,setDragOffset:U,ghostX:ae,setGhostX:L,ghostWidth:K,setGhostWidth:q,connectionLine:z,setConnectionLine:B,hoveredTaskId:X,setHoveredTaskId:fe,activeZone:Ge,setActiveZone:O,draggedSegmentIndex:ee,setDraggedSegmentIndex:ue,draggedSegmentStartX:Te,setDraggedSegmentStartX:ve,segmentDragOffsetX:Ue,setSegmentDragOffsetX:$e,hoveredSegmentIndex:nt,setHoveredSegmentIndex:ce,isHovered:Xe,setIsHovered:_e,isDragging:ke,isResizing:bt,isConnecting:Bt,resetDragState:st}=N,Ve=18,tt=!!o.executionBarBg,Ke=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Fe=tt?3:6,W=e.subtasks&&e.subtasks.length>0,D=react.useRef(null),[j,re]=(()=>{let Z=react.useRef(null),[,Oe]=react.useState(0);return [Z.current,Ae=>{Z.current=Ae,Oe(I=>I+1);}]})(),Ne=!!C&&!v&&!W&&!e.segments&&!!e.startDate&&!!e.endDate,H=e.endDate&&(()=>{let Z=new Date;Z.setHours(0,0,0,0);let Oe=new Date(e.endDate);return Oe.setHours(0,0,0,0),Oe<Z})()&&e.progress<100,se=h&&e.isCriticalPath,je=o.name==="neutral"||o.today==="#1C1917",we=e.status==="completed"||e.progress===100,He={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Be=h&&e.isCriticalPath||H?"#EF4444":e.color?e.color:e.priority&&He[e.priority]?He[e.priority]:o.taskBarPrimary,ct=v?"default":ke?Bt?"crosshair":bt?"ew-resize":"grabbing":"grab",ut=v?"default":"ew-resize",pt=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),Ct=r<50,Et=r<40;react.useEffect(()=>{x&&(!Xe||ke||e.segments)&&x(null);},[Xe,ke,e.segments,x]);let Wt=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),St=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},zt=Z=>Math.round(Z/s)*s,it=Z=>{let Oe=Math.round(Z/s),Ae=new Date(n);return Ae.setDate(Ae.getDate()+Oe),Ae},jt=(Z,Oe)=>{for(let Ae of g){if(Ae.id===e.id)continue;let I=5;if(Z>=Ae.x-I&&Z<=Ae.x+Ae.width+I&&Oe>=Ae.y-I&&Oe<=Ae.y+Ae.height+I)return Ae.id}return null},mt=react.useCallback((Z,Oe,Ae)=>{if(v)return;Z.preventDefault(),Z.stopPropagation();let I=S.current?.ownerSVGElement;if(!I)return;let xe=I.createSVGPoint();xe.x=Z.clientX,xe.y=Z.clientY;let te=xe.matrixTransform(I.getScreenCTM()?.inverse()),T=Ae!==void 0?Ae:t,J=Oe;if(!J){let Ce=te.x-T;Z.shiftKey?(J="connect",B({x:t+r,y:a+Ve/2})):Z.ctrlKey||Z.metaKey?J="move":Z.altKey?J=Ce<r/2?"resize-start":"resize-end":Et?Ce<r/2?J="move":J="resize-end":Ct?Ce<=pt/2?J="resize-start":Ce>=r-pt/2?J="resize-end":J="move":Ce<=pt?J="resize-start":Ce>=r-pt?J="resize-end":J="move";}M.current=false,w(J),_e(false),O(null),J==="move"?U(te.x-T):J==="connect"?B({x:t+r,y:a+Ve/2}):U(0),L(T),q(r);},[t,r,a,Ve,v]),lt=react.useCallback(Z=>{let Oe=S.current?.ownerSVGElement;if(!Oe)return;let Ae=Oe.closest(".gantt-timeline-scroll");if(!Ae)return;let I=Ae.getBoundingClientRect(),xe=60,te=15,T=0;if(Z.clientX<I.left+xe){let J=I.left+xe-Z.clientX;T=-Math.min(te,J/2);}else if(Z.clientX>I.right-xe){let J=Z.clientX-(I.right-xe);T=Math.min(te,J/2);}return T!==0&&(Ae.scrollLeft+=T),T!==0},[]),ne=react.useCallback(Z=>{if(A==="none")return;M.current=true,F.current=Z;let Oe=S.current?.ownerSVGElement;if(!Oe)return;if(A==="move"||A==="resize-start"||A==="resize-end"){let xe=lt(Z);xe&&!k.current?k.current=window.setInterval(()=>{F.current&&(lt(F.current),ne(F.current));},16):!xe&&k.current&&(window.clearInterval(k.current),k.current=null);}let Ae=Oe.createSVGPoint();Ae.x=Z.clientX,Ae.y=Z.clientY;let I=Ae.matrixTransform(Oe.getScreenCTM()?.inverse());if(A==="connect"){B({x:I.x,y:I.y});let xe=jt(I.x,I.y);fe(xe);}else if(A==="move"){let xe=I.x-_,te=zt(xe);L(te),q(r);let T=Math.round((te-t)/s);if(f?.(e.id,T,true),e.segments&&e.segments.length>0&&ee!==null){let J=te-Te;$e(J);}}else if(A==="resize-start"){let xe=I.x,te=zt(xe),T=t+r-te;T>=s&&(L(te),q(T));}else if(A==="resize-end"){let xe=I.x,T=zt(xe)-t;T>=s&&q(T);}},[A,t,r,s,_,e,zt,ee,Te,jt,fe,B,L,q,$e,f,lt]),me=react.useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),F.current=null,A!=="none"){if(A==="connect")X&&m&&m(e,X),B(null),fe(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),Oe,Ae,I=true;if(A==="move"){if(Oe=it(ae),Ae=new Date(Oe.getTime()+Z),e.segments&&e.segments.length>0&&ee!==null){let xe=Math.round(Ue/s),te=e.segments.map((Le,$t)=>{if($t===ee){let Nt=new Date(Le.startDate),Jt=new Date(Le.endDate);return Nt.setDate(Nt.getDate()+xe),Jt.setDate(Jt.getDate()+xe),{startDate:Nt,endDate:Jt}}return Le}),T=te.flatMap(Le=>[Le.startDate,Le.endDate]),J=new Date(Math.min(...T.map(Le=>Le.getTime()))),Ce=new Date(Math.max(...T.map(Le=>Le.getTime())));p?.({...e,segments:te},J,Ce),st(t,r);return}}else A==="resize-start"?(Oe=it(ae),Ae=e.endDate,Oe>Ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),I=false)):A==="resize-end"?(Oe=e.startDate,Ae=it(ae+K),Ae.setDate(Ae.getDate()-1),Ae<Oe&&(console.warn("Invalid date range: end date must be after or equal to start date"),I=false)):I=false;I&&Oe&&Ae&&(Ae.getTime()<Oe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,Oe,Ae));}f?.(e.id,0,false),st(t,r);}},[A,ae,K,e,p,X,m,t,r,s,it,Ue,ee,st,f]);react.useEffect(()=>{if(A==="none")return;let Z=Ae=>{ne(Ae);},Oe=()=>{me();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",Oe),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",Oe),k.current&&(window.clearInterval(k.current),k.current=null);}},[A,ne,me]);let $=ke&&!Bt?ae:t,Y=ke&&!Bt?K:r,Se=l.taskClass(e),Ze=24,gt=h?e.isCriticalPath?1:.25:1,Ft=react.useCallback(Z=>{if(!Ne)return;Z.stopPropagation(),Z.preventDefault();let Ae=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;D.current={barRect:Ae,initialPct:e.progress||0},Z.currentTarget.setPointerCapture(Z.pointerId),re(e.progress||0);},[Ne,e.progress,re]),Rt=react.useCallback(Z=>{let Oe=D.current;if(!Oe)return;let I=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??Oe.barRect;if(!I||I.width<=0)return;let xe=(Z.clientX-I.left)/I.width,te=Math.round(Math.max(0,Math.min(1,xe))*100);Z.shiftKey&&(te=Math.round(te/25)*25),re(te);},[re]),Mt=react.useCallback(Z=>{let Oe=D.current;if(!Oe)return;Z.stopPropagation(),Z.preventDefault();try{Z.currentTarget.releasePointerCapture(Z.pointerId);}catch{}let Ae=j;D.current=null,re(null),Ae!=null&&Ae!==Oe.initialPct&&C&&C(e,Ae);},[j,C,e,re]),Yt=react.useCallback(Z=>{Z.stopPropagation(),Z.preventDefault();},[]),Qt=j??(e.progress||0);return jsxRuntime.jsxs("g",{ref:S,"data-task-bar":"true",style:{opacity:gt,transition:"opacity 300ms ease"},onClick:()=>{!ke&&!M.current&&d?.(e),M.current=false;},onDoubleClick:Z=>{!ke&&!M.current&&(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!ke&&_e(true),onMouseMove:Z=>{x&&Xe&&!ke&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ve,showBelow:false,mouseX:Z.clientX,mouseY:Z.clientY});},onMouseLeave:()=>{ke||(_e(false),O(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+Ze,height:Ve,fill:"transparent",style:{pointerEvents:"all"}}),Xe&&!ke&&!Ct&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:pt,height:Ve,fill:Ge==="resize-start"?o.accent:"transparent",opacity:Ge==="resize-start"?.15:0,style:{cursor:ut,pointerEvents:"all"},onMouseEnter:()=>O("resize-start"),onMouseDown:Z=>mt(Z,"resize-start")}),jsxRuntime.jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:Ve,fill:Ge==="move"?o.accent:"transparent",opacity:Ge==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:Z=>mt(Z,"move")}),jsxRuntime.jsx("rect",{x:t+r-pt,y:a,width:pt,height:Ve,fill:Ge==="resize-end"?o.accent:"transparent",opacity:Ge==="resize-end"?.15:0,style:{cursor:ut,pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:Z=>mt(Z,"resize-end")})]}),Xe&&!ke&&Et&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ve,fill:Ge==="move"?o.accent:"transparent",opacity:Ge==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:Z=>mt(Z,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ve,fill:Ge==="resize-end"?o.accent:"transparent",opacity:Ge==="resize-end"?.2:0,style:{cursor:ut,pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:Z=>mt(Z,"resize-end")}),Xe&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ke&&!Bt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae,y:a,width:K,height:Ve,rx:Fe,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"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!ke&&(()=>{let Z=e.baselineStartDate.getTime(),Oe=e.baselineEndDate.getTime(),Ae=n.getTime(),I=864e5,xe=(Z-Ae)/I,te=(Oe-Z)/I,T=xe*s,J=Math.max(te*s,s),Ce=$+Y,Le=T+J,$t=e.endDate?.getTime()??0,Nt=Math.ceil(($t-Oe)/I),Jt=Nt>0,Ua=Nt<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:T,y:a,width:J,height:Ve,rx:Fe,fill:"none",stroke:Ke?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Jt&&Ce>Le&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Ce-Le,height:Ve,rx:0,fill:"#EF4444",opacity:.2}),Jt&&jsxRuntime.jsxs("text",{x:Math.max(Ce,Le)+6,y:a+Ve/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Nt,"d"]}),Ua&&jsxRuntime.jsxs("text",{x:Ce+6,y:a+Ve/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Nt,"d"]})]})})(),!e.segments&&tt&&W&&(()=>{let Oe=a+(Ve-8)/2,Ae=4,I=e.progress||0,xe=new Date;xe.setHours(0,0,0,0);let te=e.startDate&&xe>=e.startDate,T=e.endDate&&(()=>{let Jt=new Date(e.endDate);return Jt.setHours(0,0,0,0),xe>Jt})(),J=e.startDate&&xe<e.startDate,Ce=1;if(te&&e.startDate&&e.endDate&&!J){let Jt=new Date(e.startDate);Jt.setHours(0,0,0,0);let Ua=new Date(e.endDate);Ua.setHours(0,0,0,0);let ya=Math.max(1,(Ua.getTime()-Jt.getTime())/(1e3*60*60*24)),Sr=Math.min((xe.getTime()-Jt.getTime())/(1e3*60*60*24),ya)/ya*100;Ce=Sr>0?I/Sr:1;}let Le;I>=100?Le="#00E5CC":J?Le="#4B5563":T&&I<100?Le="#EF4444":Ce>=.95?Le="#22C55E":Ce>=.8?Le="#F59E0B":Le="#EF4444";let $t=Math.max(I/100*Y,I>0?Ae*2:0),Nt=Y>100&&I>0;return jsxRuntime.jsxs("g",{"data-task-class":Se,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:$,y:Oe,width:Y,height:8,rx:Ae,fill:"rgba(255,255,255,0.10)"}),I>0&&jsxRuntime.jsx("rect",{x:$,y:Oe,width:$t,height:8,rx:Ae,fill:Le}),Nt&&jsxRuntime.jsxs("text",{x:$+$t+6,y:Oe+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(I),"%"]})]})})(),!e.segments&&tt&&!W&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$,y:a,width:Y,height:Ve,rx:Fe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Se,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:ke&&!Bt?.15:e.parentId?.6:1,scale:Xe&&!ke?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>mt(Z),style:{cursor:ct,pointerEvents:"all"}}),!e.segments&&!tt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$,y:a,width:Y,height:Ve,rx:Fe,fill:Be,"data-task-class":Se,initial:{opacity:0,scale:.95},animate:{opacity:ke&&!Bt?.15:e.parentId?.6:Xe?.9:.8,scale:Xe&&!ke?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:W?void 0:Z=>mt(Z),style:{cursor:W?"default":ct,pointerEvents:"all"}}),tt&&(H||se)&&!e.segments&&jsxRuntime.jsx("rect",{x:$,y:a,width:Y,height:Ve,rx:Fe,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&&Qt>0&&!W&&jsxRuntime.jsx("rect",{x:$,y:a,width:Math.max(Y*(Qt/100),Fe*2),height:Ve,rx:Fe,fill:Be,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!W&&e.progress<100&&(()=>{let Z=e.progress>0?Y*(e.progress/100):0,Oe=$+Z,Ae=Y-Z,I=e.progress===0?Fe:0,xe=e.progress===0?$:Oe,te=e.progress===0?Y:Ae;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:xe,y:a,width:te,height:Ve,rx:I,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:xe,y:a,width:te,height:Ve,rx:I,fill:"none",stroke:"#00E5CC",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),tt&&!e.segments&&e.progress>0&&e.progress<100&&!W&&!ke&&j===null&&(()=>{let Z=$+Y*(e.progress/100),Oe=8,Ae=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:Z,cy:a+Ve/2,r:Oe,fill:Ae?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:Z,y:a+Ve/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Ae?.initials||Ae?.name?.charAt(0)?.toUpperCase()||""})]})})(),Ne&&!ke&&Y>=40&&(j!==null||Qt<88)&&(()=>{let Z=$+Y*(Qt/100),Oe=a+Ve/2,Ae=j!==null,I=Ae?7:Xe?6:5,xe=Ae||Xe?1:.35,te=$+Y-Z,T=Math.max(4,Math.min(12,te-10)),J=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Z-J,y:Oe-12,width:J+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Ft,onPointerMove:Rt,onPointerUp:Mt,onPointerCancel:Mt,onClick:Yt,onDoubleClick:Yt,onMouseDown:Ce=>Ce.stopPropagation()}),jsxRuntime.jsx("circle",{cx:Z,cy:Oe,r:I,fill:"#FFFFFF",stroke:Be,strokeWidth:2,opacity:xe,style:{pointerEvents:"none",filter:Ae?`drop-shadow(0 0 4px ${Be})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Ae&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Z-20,y:Oe-28,width:40,height:18,rx:4,fill:Ke?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Be,strokeWidth:1}),jsxRuntime.jsxs("text",{x:Z,y:Oe-16,textAnchor:"middle",dominantBaseline:"central",fill:Ke?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[j,"%"]})]})]})})(),e.segments&&e.segments.map((Z,Oe)=>{let Ae=(Z.startDate.getTime()-n.getTime())/864e5*s,xe=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ae+s,te=ke&&A==="move"&&ee===Oe,T=nt===Oe,J=te?Ae+Ue:Ae;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ke&&ce(Oe),onMouseLeave:()=>!ke&&ce(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:J,y:a,width:xe,height:Ve,rx:Fe,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:te||e.parentId?.6:T?.9:.8,scale:T&&!ke?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ce=>{Ce.stopPropagation(),ue(Oe),ve(Ae),mt(Ce,void 0,Ae);},style:{cursor:ct,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:J,y:a,width:xe*(e.progress/100),height:Ve,rx:Fe,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Oe}`)}),je&&(H||se)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[se&&!H&&jsxRuntime.jsx("rect",{x:$,y:a,width:Y,height:Ve,rx:Fe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),H&&jsxRuntime.jsx("rect",{x:$,y:a,width:Y,height:Ve,rx:Fe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Y>60&&!e.segments&&!(tt&&W)&&(()=>{let Z=l.taskLabel(e),Oe=typeof Z=="string"?Z:e.name,Ae=Oe.length>Math.floor(Y/8)?`${Oe.substring(0,Math.floor(Y/8))}...`:Oe;return jsxRuntime.jsx("text",{x:$+8,y:a+Ve/2,dominantBaseline:"middle",fill:we?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:we?"line-through":"none"},children:Ae})})(),!ke&&!e.segments&&!W&&e.progress>0&&e.progress<100&&(tt?jsxRuntime.jsxs("text",{x:$+Y+6,y:a+Ve/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Y>100?jsxRuntime.jsxs("text",{x:$+Y-12,y:a+Ve/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&&Y>80&&!ke&&!e.segments&&!(tt&&W)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:$+Y-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:$+Y-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Xe||bt)&&!Bt&&!e.segments&&!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:$-2,y:a,width:16,height:Ve,fill:"transparent",style:{cursor:ut},onMouseEnter:()=>O("resize-start"),onMouseLeave:()=>O(null),onMouseDown:Z=>{Z.stopPropagation(),mt(Z,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:$+4,y:a+8,width:3,height:Ve-16,rx:1.5,fill:Ge==="resize-start"||A==="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:$+Y-14,y:a,width:16,height:Ve,fill:"transparent",style:{cursor:ut},onMouseEnter:()=>O("resize-end"),onMouseLeave:()=>O(null),onMouseDown:Z=>{Z.stopPropagation(),mt(Z,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:$+Y-7,y:a+8,width:3,height:Ve-16,rx:1.5,fill:Ge==="resize-end"||A==="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:Xe&&!ke&&!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+Ve/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>O("connect"),onMouseLeave:()=>O(null),onMouseDown:Z=>{Z.stopPropagation(),mt(Z,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ve/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ge==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Bt&&z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ve/2,x2:z.x,y2:z.y,stroke:X?o.statusCompleted:o.accent,strokeWidth:X?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:X?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:z.x,cy:z.y,r:X?8:6,fill:X?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),X&&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"})]}),(Xe||ke)&&!Bt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:$-1,y:a-1,width:Y+2,height:Ve+2,rx:Fe+1,fill:"none",stroke:ke?o.accent:tt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:tt?1:2,opacity:ke||tt?.6:.4,initial:{opacity:0},animate:{opacity:ke||tt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:ae,y1:0,x2:ae,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:ae+K,y1:0,x2:ae+K,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&!ke&&!e.segments&&!x&&(()=>{let Ae=a<100,I=Ae?a+Ve+13:a-82-13,xe=Ae?`M ${$+Y/2-6} ${a+Ve+3} L ${$+Y/2} ${a+Ve+13} L ${$+Y/2+6} ${a+Ve+3}`:`M ${$+Y/2-6} ${a-13} L ${$+Y/2} ${a-3} L ${$+Y/2+6} ${a-13}`,te=I+22,T=I+40,J=I+55,Ce=I+70,Le=Ae?I+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:xe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:$+Y/2-120,y:I,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:$+Y/2,y:te,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:$+Y/2-110,y:T,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:$+Y/2-70,y:T,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt(e.startDate)}),jsxRuntime.jsx("text",{x:$+Y/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:$+Y/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt(e.endDate)}),jsxRuntime.jsx("text",{x:$+Y/2+10,y:T,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:$+Y/2+65,y:T,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:St()}),jsxRuntime.jsx("text",{x:$+Y/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:$+Y/2+65,y:J,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:$+Y/2-110,y:Ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:$+Y/2-50,y:Ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($t=>$t.name).join(", ").substring(0,30),e.assignees.map($t=>$t.name).join(", ").length>30?"...":""]})]}),!Ae&&jsxRuntime.jsx("text",{x:$+Y/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Et?"Left: move \u2022 Right: resize":Ct?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Hd=260,Vn=8,Tm=16,Bv=-12;function Nm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:v,mouseY:C}=e,N=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null,S=h.lastActivity!=null,M=(N?155:105)+(S?28:0),k=v+Tm,F=C+Bv-M;k+Hd>window.innerWidth-Vn&&(k=v-Hd-Tm),k<Vn&&(k=Vn);let A=F<Vn;A&&(F=C+20),F+M>window.innerHeight-Vn&&(F=window.innerHeight-Vn-M),o({left:k,top:F,showBelow:A});},[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"},d=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let v=Math.floor(h/60),C=h%60;return v===0?`${C}m`:C===0?`${v}h`:`${v}h ${C}m`},p=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",f=t.accent||"#00E5CC",x=t.bgSecondary||"#1F2937",y=t.border||"#374151",b=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Hd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,border:`1px solid ${y}`,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(Fi,{label:l.start,value:s.startDate?d(s.startDate):"N/A",labelColor:p,valueColor:m}),jsxRuntime.jsx(Fi,{label:l.duration,value:i(),labelColor:p,valueColor:m}),jsxRuntime.jsx(Fi,{label:l.end,value:s.endDate?d(s.endDate):"N/A",labelColor:p,valueColor:m}),jsxRuntime.jsx(Fi,{label:l.progress,value:`${s.progress}%`,labelColor:p,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:p},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.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:p},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:p},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:f,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:p},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(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:p,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(b,document.body)}function Pi({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 Ds({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:d,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:p,glowFilter:m}){let[,g]=react.useState(false),[f,x]=react.useState(null),y=r-t,b=y>0,h=Math.abs(y)<5,v=20,C=!h&&a<=e,N,S,M=a-e,k=e+M/2;S=k;let P=8;if(n==="squared")if(h)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let ve=e+15,Ue=a-v,$e=b?t+20:t-20;S=Ue;let nt=b?1:-1;N=`M ${e} ${t} L ${ve-P} ${t} Q ${ve} ${t} ${ve} ${t+nt*P} L ${ve} ${$e-nt*P} Q ${ve} ${$e} ${ve-P} ${$e} L ${Ue+P} ${$e} Q ${Ue} ${$e} ${Ue} ${$e+nt*P} L ${Ue} ${r-nt*P} Q ${Ue} ${r} ${Ue+P} ${r} L ${a} ${r}`;}else {S=a-v;let Te=b?1:-1;N=`M ${e} ${t} L ${S-P} ${t} Q ${S} ${t} ${S} ${t+Te*P} L ${S} ${r-Te*P} Q ${S} ${r} ${S+P} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let A=6,w=5,_=`M ${a} ${r} L ${a-A} ${r-w/2} L ${a-A} ${r+w/2} Z`,U=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),ae=u||(U?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=p||1,K=o.dependencyHover||(U?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),q="#f87171",z="rgba(248, 113, 113, 0.15)",B=S,X=(t+r)/2;if(f)if(n==="squared")if(h)B=Math.max(e+10,Math.min(a-10,f.x)),X=t;else if(C){let Te=e+15,ve=a-v,Ue=b?t+20:t-20,$e=[[e,t,Te,t],[Te,t,Te,Ue],[Te,Ue,ve,Ue],[ve,Ue,ve,r],[ve,r,a,r]],nt=1/0,ce={x:B,y:X};for(let Xe of $e){let _e=fe(f.x,f.y,Xe[0],Xe[1],Xe[2],Xe[3]),ke=Math.hypot(f.x-_e.x,f.y-_e.y);ke<nt&&(nt=ke,ce=_e);}B=ce.x,X=ce.y;}else {let Te=[[e,t,S,t],[S,t,S,r],[S,r,a,r]],ve=1/0,Ue={x:B,y:X};for(let $e of Te){let nt=fe(f.x,f.y,$e[0],$e[1],$e[2],$e[3]),ce=Math.hypot(f.x-nt.x,f.y-nt.y);ce<ve&&(ve=ce,Ue=nt);}B=Ue.x,X=Ue.y;}else {let Te=k,ve=t,Ue=k,$e=r,nt=1/0,ce=B,Xe=X;for(let _e=0;_e<=1;_e+=.02){let ke=1-_e,bt=ke*ke*ke*e+3*ke*ke*_e*Te+3*ke*_e*_e*Ue+_e*_e*_e*a,Bt=ke*ke*ke*t+3*ke*ke*_e*ve+3*ke*_e*_e*$e+_e*_e*_e*r,st=Math.hypot(f.x-bt,f.y-Bt);st<nt&&(nt=st,ce=bt,Xe=Bt);}B=ce,X=Xe;}function fe(Te,ve,Ue,$e,nt,ce){let Xe=nt-Ue,_e=ce-$e,ke=Xe*Xe+_e*_e;if(ke===0)return {x:Ue,y:$e};let bt=((Te-Ue)*Xe+(ve-$e)*_e)/ke;return bt=Math.max(0,Math.min(1,bt)),{x:Ue+bt*Xe,y:$e+bt*_e}}let Ge=Te=>{let ve=Te.currentTarget.ownerSVGElement;if(!ve)return;let Ue=ve.getScreenCTM();if(!Ue)return;let $e=Ue.inverse();x({x:$e.a*Te.clientX+$e.c*Te.clientY+$e.e,y:$e.b*Te.clientX+$e.d*Te.clientY+$e.f});},O=()=>{g(false),x(null),d?.(false);},ee=()=>{g(true),d?.(true);},ue=Te=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Te,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ve=>{ve.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:X,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:X,r:9,fill:z,stroke:q,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:X-3,x2:B+3,y2:X+3,stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:X-3,x2:B-3,y2:X+3,stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:O,onMouseMove:Ge,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:K,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:K,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:K,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:K,opacity:.9,style:{pointerEvents:"none"}}),ue({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ee,onMouseLeave:O,onMouseMove:Ge,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:K,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:K,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:K,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:K,style:{pointerEvents:"none"}}),ue({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:ee,onMouseLeave:O,onMouseMove:Ge,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:ae,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:_,fill:ae,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:ae,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Bi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,d=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:d(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 Ee={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(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,d=i=>{if(!n.has(i)){n.add(i),l.add(i);let u=r.get(i)||[];for(let p of u){if(!n.has(p)&&d(p))return true;if(l.has(p))return true}}return l.delete(i),false};return d(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=Ee.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ee.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ee.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=Ee.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=Ee.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=Ee.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)=>Ee.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ee.findTaskById(e,t);return !a||!a.dependencies?[]:Ee.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Ee.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ee.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=Ee.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=>Ee.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=Ee.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(d=>{let i=d.startDate&&d.endDate?Ee.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?Ee.formatDate(d.startDate):"N/A",d.endDate?Ee.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.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=Ee.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=y=>{if(!s||!y.assignees||y.assignees.length===0)return n;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?n:b.reduce((h,v)=>h+v,0)/b.length},d=new Map,i=(y,b="")=>{[...y].sort((v,C)=>(v.position??0)-(C.position??0)).forEach((v,C)=>{let N=b?`${b}.${C+1}`:`${C+1}`;d.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(e);let u=s&&Object.keys(s).length>0||o.some(y=>y._costRate>0),p=o.map(y=>{let b=y.startDate&&y.endDate?Ee.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,v=y.timeLoggedMinutes,C=y.soldEffortMinutes,N=typeof h=="number"?+(h/60).toFixed(1):0,S=typeof v=="number"?+(v/60).toFixed(1):0,M=typeof C=="number"?+(C/60).toFixed(1):0,k=y._costRate>0?y._costRate:l(y),P={WBS:d.get(y.id)||"","Task Name":y.name,"Start Date":y.startDate?Ee.formatDate(y.startDate):"","End Date":y.endDate?Ee.formatDate(y.endDate):"","Duration (days)":b>0?b:"","Progress (%)":y.progress,Status:y.status||"",Assignees:y.assignees?.map(w=>w.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":S||"","Quoted (h)":M||""};u&&(P["$ Estimated"]=N>0&&k>0?Math.round(N*k):"",P["$ Executed"]=S>0&&k>0?Math.round(S*k):"",P["$ Quoted"]=M>0&&k>0?Math.round(M*k):"",P["Rate ($/h)"]=k>0?k:"");let A=y.weight;return P["Weight (%)"]=typeof A=="number"&&A>0?A:"",P["Is Milestone"]=y.isMilestone?"Yes":"No",P}),m=a?.projectName||"";if(m||p.length>0){let y=0,b=0,h=0,v=0,C=0,N=0,S=0,M=0,k=o.filter(w=>w.startDate).map(w=>w.startDate.getTime()),P=o.filter(w=>w.endDate).map(w=>w.endDate.getTime());for(let w of p)typeof w["Estimated (h)"]=="number"&&(y+=w["Estimated (h)"]),typeof w["Logged (h)"]=="number"&&(b+=w["Logged (h)"]),typeof w["Quoted (h)"]=="number"&&(h+=w["Quoted (h)"]),u&&(typeof w["$ Estimated"]=="number"&&(v+=w["$ Estimated"]),typeof w["$ Executed"]=="number"&&(C+=w["$ Executed"]),typeof w["$ Quoted"]=="number"&&(N+=w["$ Quoted"])),typeof w["Progress (%)"]=="number"&&(S+=w["Progress (%)"],M++);let A={WBS:"0","Task Name":`\u{1F4CB} ${m||"PROJECT TOTAL"}`,"Start Date":k.length>0?Ee.formatDate(new Date(Math.min(...k))):"","End Date":P.length>0?Ee.formatDate(new Date(Math.max(...P))):"","Duration (days)":k.length>0&&P.length>0?Ee.calculateDuration(new Date(Math.min(...k)),new Date(Math.max(...P))):"","Progress (%)":M>0?Math.round(S/M):0,Status:"",Assignees:"","Estimated (h)":+y.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};u&&(A["$ Estimated"]=v||"",A["$ Executed"]=C||"",A["$ Quoted"]=N||"",A["Rate ($/h)"]=""),A["Is Milestone"]="No",p.unshift(A);}let g=r.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=f;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let y=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${y.getFullYear()}-${b(y.getMonth()+1)}-${b(y.getDate())}_${b(y.getHours())}${b(y.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ee.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Ee.getEarliestStartDate(e)||new Date,l=Ee.getLatestEndDate(e)||new Date,d=r.map((m,g)=>{let f=o.get(m.id),x=m.startDate&&m.endDate?Ee.calculateDuration(m.startDate,m.endDate):0,y=(m.dependencies||[]).filter(b=>o.has(b)).map(b=>`
130
+ `})]});return reactDom.createPortal(b,document.body)}function Fi({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 Ds({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:d,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:p,glowFilter:m}){let[,g]=react.useState(false),[f,x]=react.useState(null),y=r-t,b=y>0,h=Math.abs(y)<5,v=20,C=!h&&a<=e,N,S,M=a-e,k=e+M/2;S=k;let F=8;if(n==="squared")if(h)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let ve=e+15,Ue=a-v,$e=b?t+20:t-20;S=Ue;let nt=b?1:-1;N=`M ${e} ${t} L ${ve-F} ${t} Q ${ve} ${t} ${ve} ${t+nt*F} L ${ve} ${$e-nt*F} Q ${ve} ${$e} ${ve-F} ${$e} L ${Ue+F} ${$e} Q ${Ue} ${$e} ${Ue} ${$e+nt*F} L ${Ue} ${r-nt*F} Q ${Ue} ${r} ${Ue+F} ${r} L ${a} ${r}`;}else {S=a-v;let Te=b?1:-1;N=`M ${e} ${t} L ${S-F} ${t} Q ${S} ${t} ${S} ${t+Te*F} L ${S} ${r-Te*F} Q ${S} ${r} ${S+F} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let A=6,w=5,_=`M ${a} ${r} L ${a-A} ${r-w/2} L ${a-A} ${r+w/2} Z`,U=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),ae=u||(U?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=p||1,K=o.dependencyHover||(U?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),q="#f87171",z="rgba(248, 113, 113, 0.15)",B=S,X=(t+r)/2;if(f)if(n==="squared")if(h)B=Math.max(e+10,Math.min(a-10,f.x)),X=t;else if(C){let Te=e+15,ve=a-v,Ue=b?t+20:t-20,$e=[[e,t,Te,t],[Te,t,Te,Ue],[Te,Ue,ve,Ue],[ve,Ue,ve,r],[ve,r,a,r]],nt=1/0,ce={x:B,y:X};for(let Xe of $e){let _e=fe(f.x,f.y,Xe[0],Xe[1],Xe[2],Xe[3]),ke=Math.hypot(f.x-_e.x,f.y-_e.y);ke<nt&&(nt=ke,ce=_e);}B=ce.x,X=ce.y;}else {let Te=[[e,t,S,t],[S,t,S,r],[S,r,a,r]],ve=1/0,Ue={x:B,y:X};for(let $e of Te){let nt=fe(f.x,f.y,$e[0],$e[1],$e[2],$e[3]),ce=Math.hypot(f.x-nt.x,f.y-nt.y);ce<ve&&(ve=ce,Ue=nt);}B=Ue.x,X=Ue.y;}else {let Te=k,ve=t,Ue=k,$e=r,nt=1/0,ce=B,Xe=X;for(let _e=0;_e<=1;_e+=.02){let ke=1-_e,bt=ke*ke*ke*e+3*ke*ke*_e*Te+3*ke*_e*_e*Ue+_e*_e*_e*a,Bt=ke*ke*ke*t+3*ke*ke*_e*ve+3*ke*_e*_e*$e+_e*_e*_e*r,st=Math.hypot(f.x-bt,f.y-Bt);st<nt&&(nt=st,ce=bt,Xe=Bt);}B=ce,X=Xe;}function fe(Te,ve,Ue,$e,nt,ce){let Xe=nt-Ue,_e=ce-$e,ke=Xe*Xe+_e*_e;if(ke===0)return {x:Ue,y:$e};let bt=((Te-Ue)*Xe+(ve-$e)*_e)/ke;return bt=Math.max(0,Math.min(1,bt)),{x:Ue+bt*Xe,y:$e+bt*_e}}let Ge=Te=>{let ve=Te.currentTarget.ownerSVGElement;if(!ve)return;let Ue=ve.getScreenCTM();if(!Ue)return;let $e=Ue.inverse();x({x:$e.a*Te.clientX+$e.c*Te.clientY+$e.e,y:$e.b*Te.clientX+$e.d*Te.clientY+$e.f});},O=()=>{g(false),x(null),d?.(false);},ee=()=>{g(true),d?.(true);},ue=Te=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Te,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ve=>{ve.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:X,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:X,r:9,fill:z,stroke:q,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:X-3,x2:B+3,y2:X+3,stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:X-3,x2:B-3,y2:X+3,stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:O,onMouseMove:Ge,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:K,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:K,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:K,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:K,opacity:.9,style:{pointerEvents:"none"}}),ue({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ee,onMouseLeave:O,onMouseMove:Ge,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:K,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:K,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:K,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:K,style:{pointerEvents:"none"}}),ue({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:ee,onMouseLeave:O,onMouseMove:Ge,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:ae,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:_,fill:ae,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:ae,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Bi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,d=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:d(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 Ee={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(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,d=i=>{if(!n.has(i)){n.add(i),l.add(i);let u=r.get(i)||[];for(let p of u){if(!n.has(p)&&d(p))return true;if(l.has(p))return true}}return l.delete(i),false};return d(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=Ee.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ee.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ee.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=Ee.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=Ee.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=Ee.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)=>Ee.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ee.findTaskById(e,t);return !a||!a.dependencies?[]:Ee.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Ee.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ee.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=Ee.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=>Ee.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=Ee.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(d=>{let i=d.startDate&&d.endDate?Ee.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?Ee.formatDate(d.startDate):"N/A",d.endDate?Ee.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.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=Ee.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=y=>{if(!s||!y.assignees||y.assignees.length===0)return n;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?n:b.reduce((h,v)=>h+v,0)/b.length},d=new Map,i=(y,b="")=>{[...y].sort((v,C)=>(v.position??0)-(C.position??0)).forEach((v,C)=>{let N=b?`${b}.${C+1}`:`${C+1}`;d.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(e);let u=s&&Object.keys(s).length>0||o.some(y=>y._costRate>0),p=o.map(y=>{let b=y.startDate&&y.endDate?Ee.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,v=y.timeLoggedMinutes,C=y.soldEffortMinutes,N=typeof h=="number"?+(h/60).toFixed(1):0,S=typeof v=="number"?+(v/60).toFixed(1):0,M=typeof C=="number"?+(C/60).toFixed(1):0,k=y._costRate>0?y._costRate:l(y),F={WBS:d.get(y.id)||"","Task Name":y.name,"Start Date":y.startDate?Ee.formatDate(y.startDate):"","End Date":y.endDate?Ee.formatDate(y.endDate):"","Duration (days)":b>0?b:"","Progress (%)":y.progress,Status:y.status||"",Assignees:y.assignees?.map(w=>w.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":S||"","Quoted (h)":M||""};u&&(F["$ Estimated"]=N>0&&k>0?Math.round(N*k):"",F["$ Executed"]=S>0&&k>0?Math.round(S*k):"",F["$ Quoted"]=M>0&&k>0?Math.round(M*k):"",F["Rate ($/h)"]=k>0?k:"");let A=y.weight;return F["Weight (%)"]=typeof A=="number"&&A>0?A:"",F["Is Milestone"]=y.isMilestone?"Yes":"No",F}),m=a?.projectName||"";if(m||p.length>0){let y=0,b=0,h=0,v=0,C=0,N=0,S=0,M=0,k=o.filter(w=>w.startDate).map(w=>w.startDate.getTime()),F=o.filter(w=>w.endDate).map(w=>w.endDate.getTime());for(let w of p)typeof w["Estimated (h)"]=="number"&&(y+=w["Estimated (h)"]),typeof w["Logged (h)"]=="number"&&(b+=w["Logged (h)"]),typeof w["Quoted (h)"]=="number"&&(h+=w["Quoted (h)"]),u&&(typeof w["$ Estimated"]=="number"&&(v+=w["$ Estimated"]),typeof w["$ Executed"]=="number"&&(C+=w["$ Executed"]),typeof w["$ Quoted"]=="number"&&(N+=w["$ Quoted"])),typeof w["Progress (%)"]=="number"&&(S+=w["Progress (%)"],M++);let A={WBS:"0","Task Name":`\u{1F4CB} ${m||"PROJECT TOTAL"}`,"Start Date":k.length>0?Ee.formatDate(new Date(Math.min(...k))):"","End Date":F.length>0?Ee.formatDate(new Date(Math.max(...F))):"","Duration (days)":k.length>0&&F.length>0?Ee.calculateDuration(new Date(Math.min(...k)),new Date(Math.max(...F))):"","Progress (%)":M>0?Math.round(S/M):0,Status:"",Assignees:"","Estimated (h)":+y.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};u&&(A["$ Estimated"]=v||"",A["$ Executed"]=C||"",A["$ Quoted"]=N||"",A["Rate ($/h)"]=""),A["Is Milestone"]="No",p.unshift(A);}let g=r.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=f;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let y=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${y.getFullYear()}-${b(y.getMonth()+1)}-${b(y.getDate())}_${b(y.getHours())}${b(y.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ee.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Ee.getEarliestStartDate(e)||new Date,l=Ee.getLatestEndDate(e)||new Date,d=r.map((m,g)=>{let f=o.get(m.id),x=m.startDate&&m.endDate?Ee.calculateDuration(m.startDate,m.endDate):0,y=(m.dependencies||[]).filter(b=>o.has(b)).map(b=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${o.get(b)}</PredecessorUID>
134
134
  <Type>1</Type>
@@ -358,14 +358,14 @@
358
358
  </Calendars>
359
359
  <Tasks>${d}
360
360
  </Tasks>
361
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Ee.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 u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let f=t.find(x=>x.id===g);if(f){o(f);let x=r.get(g)?.ef||0;p=Math.max(p,x);}}let m=p+u;r.set(i.id,{es:p,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 u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),m=s;if(p.length>0)for(let f of p){l(f);let x=n.get(f.id)?.ls||0;m=Math.min(m,x);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let d=[];for(let i of a){let u=r.get(i.id),p=n.get(i.id);if(u&&p){let m=p.ls-u.es;Math.abs(m)<.01&&d.push(i.id);}}return d},calculateCriticalPathFull:e=>{let t=new Map,r=Ee.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 f=s.get(g);f&&f.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,d=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();d.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let f=Ee.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let b of g.dependencies){let h=l.get(b);h&&(x=Math.max(x,h.ef));}l.set(m,{es:x,ef:x+f});let y=s.get(m)||[];for(let b of y){let h=(n.get(b)||1)-1;n.set(b,h),h===0&&i.push(b);}}if(d.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(m=>m.ef)),p=new Map;for(let m=d.length-1;m>=0;m--){let g=d[m];if(!g)continue;let f=o.get(g);if(!f||!f.startDate||!f.endDate)continue;let x=Ee.calculateDuration(f.startDate,f.endDate),y=s.get(g)||[],b=u;if(y.length>0)for(let h of y){let v=p.get(h);v&&(b=Math.min(b,v.ls));}p.set(g,{ls:b-x,lf:b});}for(let m of d){let g=l.get(m),f=p.get(m),x=f.ls-g.es,y=s.get(m)||[],b;y.length>0?b=Math.min(...y.map(h=>l.get(h).es))-g.ef:b=u-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Ee.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ee.calculateCriticalPath(e).includes(t))return 0;let o=Ee.getDependentTasks(e,t);if(o.length===0){let l=Ee.getLatestEndDate(e);if(!l)return null;let d=Ee.calculateDuration(a.endDate,l);return Math.max(0,d)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,d)=>l-d)[0];if(!s)return null;let n=Ee.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ee.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=Ee.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Ee.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let d of n){if(o.has(d.id)||!d.startDate||!d.endDate)continue;let i=Ee.calculateDuration(d.startDate,d.endDate),u;if(a!==void 0?(u=new Date(d.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let g=new Date(s.endDate),f=new Date(g);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Ee.calculateEndDate(u,i),m=g=>g.map(f=>f.id===d.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:m(f.subtasks)}:f);l=m(l),l=Ee.autoScheduleDependents(l,d.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let d=[],i=o.getTime(),u=1e3*60*60*24,p=Ee.findTaskById(e,t);if(!p||!p.endDate)return [];let m=(g,f,x=new Set)=>{if(x.has(g))return;x.add(g);let y=Ee.getDependentTasks(e,g);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=r.findIndex(w=>w.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),N=(b.endDate.getTime()-v)/u,M=(v-i)/u*s,k=M+f*s,P=Math.max(N*s,s),A=l+h*n+(n-18)/2;d.push({taskId:b.id,taskName:b.name,originalX:M,previewX:k,width:P,y:A,rowIndex:h,daysDelta:f,color:b.color}),m(b.id,f,x);}};return m(t,a),d},splitTask:(e,t,a,r=3)=>{let o=Ee.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 d=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=u=>u.map(p=>p.id===o.id?{...p,endDate:l,segments:d}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function $i({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:d,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:C=true,canEditTask:N,onTaskProgressDrag:S}){let k=$r(),P=react.useRef(null),[A,w]=react.useState([]),[_,U]=react.useState(null),[ae,L]=react.useState(null),[K,q]=react.useState(null),z=react.useRef(false),[B,X]=react.useState(new Set),[fe,Ge]=react.useState(null),O=react.useCallback(W=>{if(K&&!z.current){let D=W.target,j=false;for(;D&&D!==W.currentTarget;){if(D.getAttribute?.("data-dependency-line")==="true"||D.getAttribute?.("data-dependency-hover-overlay")==="true"){j=true;break}D=D.parentElement;}j||q(null);}},[K]),ee=react.useCallback(W=>{L(W);},[]),ue=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Te=r==="day"?60:r==="week"?20:8,ve=ue*Te*n,Ue=W=>{let D=new Date(Date.UTC(W.getFullYear(),W.getMonth(),W.getDate())),j=D.getUTCDay()||7;D.setUTCDate(D.getUTCDate()+4-j);let re=new Date(Date.UTC(D.getUTCFullYear(),0,1));return Math.ceil(((D.getTime()-re.getTime())/864e5+1)/7)},$e=W=>{let D=W.getDay();return D===0||D===6},nt=react.useCallback(W=>{let D=Math.round(W/(Te*n)),j=new Date(o);return j.setDate(j.getDate()+D),j},[o,Te,n]),ce=react.useCallback((W,D)=>{if(D.startDate&&D.endDate)return;let j=W.currentTarget.ownerSVGElement;if(!j)return;let re=j.createSVGPoint();re.x=W.clientX,re.y=W.clientY;let Ne=re.matrixTransform(j.getScreenCTM()?.inverse()),H=nt(Ne.x),se=new Date(H);se.setDate(se.getDate()+1),Ge(null),f?.(D,H,se);},[nt,f]),Xe=react.useCallback((W,D,j)=>{let re=W.currentTarget.ownerSVGElement;if(!re)return;let Ne=re.createSVGPoint();Ne.x=W.clientX,Ne.y=W.clientY;let H=Ne.matrixTransform(re.getScreenCTM()?.inverse()),se=nt(H.x),we=Math.round(H.x/(Te*n))*Te*n;Ge({taskId:D.id,x:we,y:j*a+a/2,date:se});},[nt,Te,n,a]),_e=react.useCallback(()=>{Ge(null);},[]),ke=react.useMemo(()=>{let W=Ne=>Ne.map(H=>{if(H.subtasks&&H.subtasks.length>0){let se=W(H.subtasks),je=se.filter(we=>we.startDate&&we.endDate);if(je.length>0){let we=je.map(ct=>ct.startDate.getTime()),He=je.map(ct=>ct.endDate.getTime()),ze=new Date(Math.min(...we)),Be=new Date(Math.max(...He));return {...H,subtasks:se,startDate:ze,endDate:Be}}return {...H,subtasks:se}}return H}),D=(Ne,H=[])=>{let se=[...Ne].sort((je,we)=>(je.position??0)-(we.position??0));for(let je of se)H.push(je),je.subtasks&&je.subtasks.length>0&&(je.isExpanded===void 0||je.isExpanded)&&D(je.subtasks,H);return H},j=W(e);return D(j)},[e]),bt=react.useCallback(W=>{if(!W.startDate||!W.endDate)return {x:0,width:0};let D=W.startDate.getTime(),j=W.endDate.getTime(),re=o.getTime(),Ne=(D-re)/(1e3*60*60*24),H=(j-D)/(1e3*60*60*24)+1,se=Ne*Te*n,je=Math.max(Te*n,40),we=Math.max(H*Te*n,je);return {x:se,width:we}},[o,Te,n]),Bt=react.useMemo(()=>ke.filter(W=>W.startDate&&W.endDate).map(W=>{let{x:D,width:j}=bt(W),Ne=ke.findIndex(H=>H.id===W.id)*a+(a-18)/2;return {id:W.id,x:D,y:Ne,width:j,height:18}}),[ke,bt]),st=react.useCallback((W,D,j)=>{if(!j){w([]),U(null);return}if(U({taskId:W,daysDelta:D}),D===0){w([]);return}let re=Ee.calculateCascadePreview(e,W,D,ke,o,Te*n,a,48);w(re);},[e,ke,o,Te,n,a,48]),Ve=react.useCallback((W,D)=>{if(!_)return D;let j=Te*n,re=_.daysDelta*j;if(W===_.taskId)return {x:D.x+re,width:D.width};let Ne=A.find(H=>H.taskId===W);return Ne?{x:Ne.previewX,width:Ne.width}:D},[_,A,Te,n]),tt=react.useMemo(()=>{let W=[],D=new Date(o);for(;D<=s;){let Ne=(D.getTime()-o.getTime())/864e5*Te*n;if(r==="day")W.push({date:new Date(D),label:D.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ne}),D.setDate(D.getDate()+1);else if(r==="week"){let H=Ue(D);W.push({date:new Date(D),label:`${k.labels.week} ${H}`,x:Ne}),D.setDate(D.getDate()+7);}else W.push({date:new Date(D),label:D.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ne}),D.setMonth(D.getMonth()+1);}return W},[o,s,r,Te,n,l,k.labels.week]),Ke=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Te*n,[o,Te,n]),Pe=Math.max(ke.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(ve,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ve,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),tt.map((W,D)=>jsxRuntime.jsxs("g",{children:[D>0&&jsxRuntime.jsx("line",{x1:W.x,y1:0,x2:W.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:W.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:W.label})]},`header-${D}`)),Ke>=0&&Ke<=ve&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:Ke,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:Ke,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${Ke-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:P,width:Math.max(ve,1e3),height:Pe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:O,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(ve,1e3),height:Pe,fill:t.bgPrimary}),ke.map((W,D)=>jsxRuntime.jsx("rect",{x:0,y:D*a,width:Math.max(ve,1e3),height:a,fill:D%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${W.id}`)),tt.map((W,D)=>D>0?jsxRuntime.jsx("line",{x1:W.x,y1:0,x2:W.x,y2:ke.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${D}`):null),C&&tt.map((W,D)=>{let j=tt[D+1]?.x||ve;return $e(W.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:W.x,y:0,width:j-W.x,height:ke.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:W.x,y:0,width:j-W.x,height:ke.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${D}`):null}),ke.map((W,D)=>{let j=W.startDate&&W.endDate;return jsxRuntime.jsx("g",{children:!j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:D*a,width:ve,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:re=>ce(re,W),onMouseMove:re=>Xe(re,W,D),onMouseLeave:()=>{_e();}},`clickable-${W.id}`),fe&&fe.taskId===W.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:fe.x,y1:D*a+4,x2:fe.x,y2:D*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:fe.x,cy:fe.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:fe.x,cy:fe.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${fe.x}, ${D*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:fe.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!fe||fe.taskId!==W.id)&&jsxRuntime.jsx("text",{x:Ke>0?Ke:100,y:D*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-${W.id}`)]})},`row-group-${W.id}`)}),ke.map((W,D)=>{if(!W.startDate||!W.endDate)return null;let{x:j,width:re}=bt(W),Ne=D*a+(a-18)/2,H=W.subtasks&&W.subtasks.length>0&&!W.isMilestone;if(W.isMilestone)return jsxRuntime.jsx(Bi,{task:W,x:j+re/2,y:Ne+12,theme:t,onClick:p},W.id);if(H){let se=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),je=8,we=Ne+(a-18)/2+(18-je)/2,He=4,ze=W.progress||0,Be=new Date;Be.setHours(0,0,0,0);let ct=W.startDate&&Be>=W.startDate,ut=W.endDate&&(()=>{let it=new Date(W.endDate);return it.setHours(0,0,0,0),Be>it})(),ht=W.startDate&&Be<W.startDate,pt=1;if(ct&&W.startDate&&W.endDate&&!ht){let it=new Date(W.startDate);it.setHours(0,0,0,0);let jt=new Date(W.endDate);jt.setHours(0,0,0,0);let mt=Math.max(1,(jt.getTime()-it.getTime())/(1e3*60*60*24)),ne=Math.min((Be.getTime()-it.getTime())/(1e3*60*60*24),mt)/mt*100;pt=ne>0?ze/ne:1;}let Ct;ze>=100?Ct="#00E5CC":ht?Ct="#4B5563":ut&&ze<100?Ct="#EF4444":pt>=.95?Ct="#22C55E":pt>=.8?Ct="#F59E0B":Ct="#EF4444";let Et=Math.max(ze/100*re,ze>0?He*2:0),Wt=re>100&&ze>0,St=W.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>p?.(W),onContextMenu:it=>{it.preventDefault(),it.stopPropagation(),g?.(W,it);},onMouseMove:it=>{ee({task:W,x:j,y:we,width:re,height:je,showBelow:we<100,mouseX:it.clientX,mouseY:it.clientY});},onMouseLeave:()=>ee(null),style:{cursor:"default",opacity:h?St?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:j,y:Ne,width:re,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:j,y:we,width:re,height:je,rx:He,fill:se?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),ze>0&&jsxRuntime.jsx("rect",{x:j,y:we,width:Et,height:je,rx:He,fill:Ct}),h&&St&&jsxRuntime.jsx("rect",{x:j,y:we,width:re,height:je,rx:He,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Wt&&jsxRuntime.jsxs("text",{x:j+Et+6,y:we+je/2,dominantBaseline:"central",fill:se?"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(ze),"%"]})]},W.id)}return jsxRuntime.jsx(Fi,{task:W,x:j,y:Ne,width:re,theme:t,dayWidth:Te*n,startDate:o,templates:d,onClick:p,onDoubleClick:m,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:Bt,onDragMove:st,onHoverChange:ee,showBaseline:b,showTaskBarLabels:u,showCriticalPath:h,readOnly:N?!N(W):false,onProgressChange:S},W.id)}),v&&ke.map((W,D)=>!W.dependencies||W.dependencies.length===0||!W.startDate||!W.endDate?null:W.dependencies.map(j=>{let re=ke.find(Ct=>Ct.id===j);if(!re||!re.startDate||!re.endDate)return null;let Ne=ke.findIndex(Ct=>Ct.id===j),H=Ve(re.id,bt(re)),se=Ve(W.id,bt(W)),je=H.x+H.width,we=Ne*a+26,He=se.x,ze=D*a+26,Be=`dep-${j}-${W.id}`;if(B.has(Be))return null;let ct=h&&W.isCriticalPath&&re.isCriticalPath;return jsxRuntime.jsx(Ds,{x1:je,y1:we,x2:He,y2:ze,theme:t,lineStyle:i,colorOverride:h?ct?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?ct?2:1:void 0,glowFilter:ct?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(W.id,j),onHoverChange:Ct=>{z.current=Ct,Ct&&q({key:Be,fromId:j,toId:W.id,exitX:je,exitY:we,enterX:He,enterY:ze});}},Be)})),A.map(W=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:W.previewX,y:W.y-48,width:W.width,height:18,rx:6,fill:W.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(W.daysDelta)>0&&jsxRuntime.jsx("text",{x:W.previewX+W.width/2,y:W.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:W.daysDelta>0?`+${W.daysDelta}d`:`${W.daysDelta}d`})]},`cascade-preview-${W.taskId}`)),v&&K&&jsxRuntime.jsx(Ds,{x1:K.exitX,y1:K.exitY,x2:K.enterX,y2:K.enterY,theme:t,lineStyle:i,onDelete:()=>{let W=K.key;q(null),z.current=false,X(D=>new Set(D).add(W)),y?.(K.toId,K.fromId);},hoverOverlayOnly:true,onHoverChange:W=>{z.current=W,W||q(null);}},`${K.key}-hover-overlay`),Ke>=0&&Ke<=ve&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:Ke,y1:0,x2:Ke,y2:Pe,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:Ke,y1:0,x2:Ke,y2:Pe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),ae&&jsxRuntime.jsx(Nm,{tooltipData:ae,theme:t,locale:l==="es"?"es":"en"})]})}var Hv=['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"'],Em=({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"})}),zv=()=>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"})}),Uv=()=>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"})}),Wv=()=>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"})}),Vv=()=>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 zi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:d}){let[i,u]=react.useState(false),[p,m]=react.useState(false),[g,f]=react.useState([]),[x,y]=react.useState(""),[b,h]=react.useState(false),[v,C]=react.useState(true),[N,S]=react.useState(""),[M,k]=react.useState(-1),[P,A]=react.useState(false),[w,_]=react.useState(0),U=react.useRef(null),ae=react.useRef(null),L=react.useRef(null),K=react.useRef(null),{enabled:q=true,placeholder:z='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:X,suggestions:fe=Hv,maxHistory:Ge=50,persistHistory:O,mentionableUsers:ee=[]}=a,ue=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Te=ue?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ve=ue?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ue=ue?"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)",$e=ue?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",nt=ue?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ce=ue?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Xe=ue?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",_e=ue?"rgba(46, 148, 255, 0.9)":"#2E94FF",ke=ue?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",bt=ue?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Bt=ue?"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)",st=ue?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",Ve=ue?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=ue?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Ke=ue?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Pe=ue?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",W=ue?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=ue?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",j=ue?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",re=ue?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ne="rgba(46, 148, 255, 0.04)",H=ue?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",se=ue?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",je=ue?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",we=ue?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=ue?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",ze=ue?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Be=ue?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ct=ue?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ut="rgba(46, 148, 255, 0.06)",ht=ue?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=ue?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Ct=ue?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Et=ue?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Wt=ue?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",St=ue?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",zt=ue?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",it=ue?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",jt=ue?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",mt=ue?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",lt=ue?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=ue?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",me=ue?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",$=ue?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Y=ue?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Se=O?.storageKey||"gantt-ai-history",Ze=O?.maxMessages??5,gt=ee.filter(I=>{if(!N)return true;let xe=N.toLowerCase();return I.name.toLowerCase().includes(xe)||I.email&&I.email.toLowerCase().includes(xe)}).slice(0,5),Pt=react.useCallback(I=>{if(y(I),ee.length===0)return;let xe=U.current;if(!xe)return;let te=xe.selectionStart||I.length,T=I.slice(0,te),J=T.lastIndexOf("@");if(J>=0&&((J>0?T[J-1]:" ")===" "||J===0)){let Le=T.slice(J+1);if(Le.length<=40){S(Le),k(J),A(true),_(0);return}}A(false),S(""),k(-1);},[ee.length]),Rt=react.useCallback(I=>{let xe=x.slice(0,M),te=x.slice(M+1+N.length),T=`${xe}@${I.name} ${te}`;y(T),A(false),S(""),k(-1),setTimeout(()=>U.current?.focus(),0);},[x,M,N]),Mt=react.useCallback(I=>{if(!P||gt.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),_(xe=>xe<gt.length-1?xe+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),_(xe=>xe>0?xe-1:gt.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let xe=gt[w];return xe&&Rt(xe),true}return I.key==="Escape"?(A(false),true):false},[P,gt,w,Rt]);react.useEffect(()=>{if(O?.enabled)try{let I=localStorage.getItem(Se);if(I){let te=JSON.parse(I).map(T=>({...T,timestamp:new Date(T.timestamp)}));f(te.slice(-Ze));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[O?.enabled,Se,Ze]),react.useEffect(()=>{if(O?.enabled&&g.length>0)try{let I=g.filter(xe=>!xe.isLoading).slice(-Ze);localStorage.setItem(Se,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,O?.enabled,Se,Ze]),react.useEffect(()=>{ae.current&&ae.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!p&&U.current&&setTimeout(()=>U.current?.focus(),100);},[i,p]);let Yt=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&l?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&d?.(I.taskId,I.dependencyFrom);break}},[o,s,n,l,d]),Qt=react.useCallback(async I=>{if(!I.trim()||b)return;let xe={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};f(T=>[...T.slice(-(Ge-1)),xe]),y(""),C(false),h(true);let te={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(T=>[...T,te]);try{if(X){let T=await X(I,e);f(J=>{let Ce=J.filter($t=>!$t.isLoading),Le={id:`assistant-${Date.now()}`,role:"assistant",content:T.message,timestamp:new Date,command:T};return [...Ce,Le]}),Yt(T);}else f(T=>[...T.filter(Ce=>!Ce.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(T){f(J=>[...J.filter(Le=>!Le.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,Ge,X,e,Yt]),Z=I=>{I.preventDefault(),Qt(x);},Oe=I=>{y(I),U.current?.focus();};if(react.useEffect(()=>{let I=xe=>{(xe.metaKey||xe.ctrlKey)&&xe.key==="k"&&(xe.preventDefault(),u(te=>!te),i||m(false)),xe.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[i]),react.useEffect(()=>{if(!i)return;let I=te=>{let T=te.target;L.current&&!L.current.contains(T)&&u(false);},xe=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(xe),document.removeEventListener("mousedown",I);}},[i]),!q)return null;let Ae={"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(ta,{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 ${Ae[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Te,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ve}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ue,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${$e}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${nt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Em,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:_e,background:ce,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Xe}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
361
+ </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Ee.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 u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let f=t.find(x=>x.id===g);if(f){o(f);let x=r.get(g)?.ef||0;p=Math.max(p,x);}}let m=p+u;r.set(i.id,{es:p,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 u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),m=s;if(p.length>0)for(let f of p){l(f);let x=n.get(f.id)?.ls||0;m=Math.min(m,x);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let d=[];for(let i of a){let u=r.get(i.id),p=n.get(i.id);if(u&&p){let m=p.ls-u.es;Math.abs(m)<.01&&d.push(i.id);}}return d},calculateCriticalPathFull:e=>{let t=new Map,r=Ee.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 f=s.get(g);f&&f.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,d=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();d.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let f=Ee.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let b of g.dependencies){let h=l.get(b);h&&(x=Math.max(x,h.ef));}l.set(m,{es:x,ef:x+f});let y=s.get(m)||[];for(let b of y){let h=(n.get(b)||1)-1;n.set(b,h),h===0&&i.push(b);}}if(d.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(m=>m.ef)),p=new Map;for(let m=d.length-1;m>=0;m--){let g=d[m];if(!g)continue;let f=o.get(g);if(!f||!f.startDate||!f.endDate)continue;let x=Ee.calculateDuration(f.startDate,f.endDate),y=s.get(g)||[],b=u;if(y.length>0)for(let h of y){let v=p.get(h);v&&(b=Math.min(b,v.ls));}p.set(g,{ls:b-x,lf:b});}for(let m of d){let g=l.get(m),f=p.get(m),x=f.ls-g.es,y=s.get(m)||[],b;y.length>0?b=Math.min(...y.map(h=>l.get(h).es))-g.ef:b=u-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Ee.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ee.calculateCriticalPath(e).includes(t))return 0;let o=Ee.getDependentTasks(e,t);if(o.length===0){let l=Ee.getLatestEndDate(e);if(!l)return null;let d=Ee.calculateDuration(a.endDate,l);return Math.max(0,d)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,d)=>l-d)[0];if(!s)return null;let n=Ee.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ee.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=Ee.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Ee.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let d of n){if(o.has(d.id)||!d.startDate||!d.endDate)continue;let i=Ee.calculateDuration(d.startDate,d.endDate),u;if(a!==void 0?(u=new Date(d.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let g=new Date(s.endDate),f=new Date(g);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Ee.calculateEndDate(u,i),m=g=>g.map(f=>f.id===d.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:m(f.subtasks)}:f);l=m(l),l=Ee.autoScheduleDependents(l,d.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let d=[],i=o.getTime(),u=1e3*60*60*24,p=Ee.findTaskById(e,t);if(!p||!p.endDate)return [];let m=(g,f,x=new Set)=>{if(x.has(g))return;x.add(g);let y=Ee.getDependentTasks(e,g);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=r.findIndex(w=>w.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),N=(b.endDate.getTime()-v)/u,M=(v-i)/u*s,k=M+f*s,F=Math.max(N*s,s),A=l+h*n+(n-18)/2;d.push({taskId:b.id,taskName:b.name,originalX:M,previewX:k,width:F,y:A,rowIndex:h,daysDelta:f,color:b.color}),m(b.id,f,x);}};return m(t,a),d},splitTask:(e,t,a,r=3)=>{let o=Ee.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 d=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=u=>u.map(p=>p.id===o.id?{...p,endDate:l,segments:d}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function $i({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:d,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:C=true,canEditTask:N,onTaskProgressDrag:S}){let k=$r(),F=react.useRef(null),[A,w]=react.useState([]),[_,U]=react.useState(null),[ae,L]=react.useState(null),[K,q]=react.useState(null),z=react.useRef(false),[B,X]=react.useState(new Set),[fe,Ge]=react.useState(null),O=react.useCallback(W=>{if(K&&!z.current){let D=W.target,j=false;for(;D&&D!==W.currentTarget;){if(D.getAttribute?.("data-dependency-line")==="true"||D.getAttribute?.("data-dependency-hover-overlay")==="true"){j=true;break}D=D.parentElement;}j||q(null);}},[K]),ee=react.useCallback(W=>{L(W);},[]),ue=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Te=r==="day"?60:r==="week"?20:8,ve=ue*Te*n,Ue=W=>{let D=new Date(Date.UTC(W.getFullYear(),W.getMonth(),W.getDate())),j=D.getUTCDay()||7;D.setUTCDate(D.getUTCDate()+4-j);let re=new Date(Date.UTC(D.getUTCFullYear(),0,1));return Math.ceil(((D.getTime()-re.getTime())/864e5+1)/7)},$e=W=>{let D=W.getDay();return D===0||D===6},nt=react.useCallback(W=>{let D=Math.round(W/(Te*n)),j=new Date(o);return j.setDate(j.getDate()+D),j},[o,Te,n]),ce=react.useCallback((W,D)=>{if(D.startDate&&D.endDate)return;let j=W.currentTarget.ownerSVGElement;if(!j)return;let re=j.createSVGPoint();re.x=W.clientX,re.y=W.clientY;let Ne=re.matrixTransform(j.getScreenCTM()?.inverse()),H=nt(Ne.x),se=new Date(H);se.setDate(se.getDate()+1),Ge(null),f?.(D,H,se);},[nt,f]),Xe=react.useCallback((W,D,j)=>{let re=W.currentTarget.ownerSVGElement;if(!re)return;let Ne=re.createSVGPoint();Ne.x=W.clientX,Ne.y=W.clientY;let H=Ne.matrixTransform(re.getScreenCTM()?.inverse()),se=nt(H.x),we=Math.round(H.x/(Te*n))*Te*n;Ge({taskId:D.id,x:we,y:j*a+a/2,date:se});},[nt,Te,n,a]),_e=react.useCallback(()=>{Ge(null);},[]),ke=react.useMemo(()=>{let W=Ne=>Ne.map(H=>{if(H.subtasks&&H.subtasks.length>0){let se=W(H.subtasks),je=se.filter(we=>we.startDate&&we.endDate);if(je.length>0){let we=je.map(ct=>ct.startDate.getTime()),He=je.map(ct=>ct.endDate.getTime()),ze=new Date(Math.min(...we)),Be=new Date(Math.max(...He));return {...H,subtasks:se,startDate:ze,endDate:Be}}return {...H,subtasks:se}}return H}),D=(Ne,H=[])=>{let se=[...Ne].sort((je,we)=>(je.position??0)-(we.position??0));for(let je of se)H.push(je),je.subtasks&&je.subtasks.length>0&&(je.isExpanded===void 0||je.isExpanded)&&D(je.subtasks,H);return H},j=W(e);return D(j)},[e]),bt=react.useCallback(W=>{if(!W.startDate||!W.endDate)return {x:0,width:0};let D=W.startDate.getTime(),j=W.endDate.getTime(),re=o.getTime(),Ne=(D-re)/(1e3*60*60*24),H=(j-D)/(1e3*60*60*24)+1,se=Ne*Te*n,je=Math.max(Te*n,40),we=Math.max(H*Te*n,je);return {x:se,width:we}},[o,Te,n]),Bt=react.useMemo(()=>ke.filter(W=>W.startDate&&W.endDate).map(W=>{let{x:D,width:j}=bt(W),Ne=ke.findIndex(H=>H.id===W.id)*a+(a-18)/2;return {id:W.id,x:D,y:Ne,width:j,height:18}}),[ke,bt]),st=react.useCallback((W,D,j)=>{if(!j){w([]),U(null);return}if(U({taskId:W,daysDelta:D}),D===0){w([]);return}let re=Ee.calculateCascadePreview(e,W,D,ke,o,Te*n,a,48);w(re);},[e,ke,o,Te,n,a,48]),Ve=react.useCallback((W,D)=>{if(!_)return D;let j=Te*n,re=_.daysDelta*j;if(W===_.taskId)return {x:D.x+re,width:D.width};let Ne=A.find(H=>H.taskId===W);return Ne?{x:Ne.previewX,width:Ne.width}:D},[_,A,Te,n]),tt=react.useMemo(()=>{let W=[],D=new Date(o);for(;D<=s;){let Ne=(D.getTime()-o.getTime())/864e5*Te*n;if(r==="day")W.push({date:new Date(D),label:D.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ne}),D.setDate(D.getDate()+1);else if(r==="week"){let H=Ue(D);W.push({date:new Date(D),label:`${k.labels.week} ${H}`,x:Ne}),D.setDate(D.getDate()+7);}else W.push({date:new Date(D),label:D.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ne}),D.setMonth(D.getMonth()+1);}return W},[o,s,r,Te,n,l,k.labels.week]),Ke=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Te*n,[o,Te,n]),Fe=Math.max(ke.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(ve,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ve,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),tt.map((W,D)=>jsxRuntime.jsxs("g",{children:[D>0&&jsxRuntime.jsx("line",{x1:W.x,y1:0,x2:W.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:W.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:W.label})]},`header-${D}`)),Ke>=0&&Ke<=ve&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:Ke,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:Ke,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${Ke-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:F,width:Math.max(ve,1e3),height:Fe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:O,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ve,1e3),height:Fe,fill:t.bgPrimary}),ke.map((W,D)=>jsxRuntime.jsx("rect",{x:0,y:D*a,width:Math.max(ve,1e3),height:a,fill:D%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${W.id}`)),tt.map((W,D)=>D>0?jsxRuntime.jsx("line",{x1:W.x,y1:0,x2:W.x,y2:ke.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${D}`):null),C&&tt.map((W,D)=>{let j=tt[D+1]?.x||ve;return $e(W.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:W.x,y:0,width:j-W.x,height:ke.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:W.x,y:0,width:j-W.x,height:ke.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${D}`):null}),ke.map((W,D)=>{let j=W.startDate&&W.endDate;return jsxRuntime.jsx("g",{children:!j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:D*a,width:ve,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:re=>ce(re,W),onMouseMove:re=>Xe(re,W,D),onMouseLeave:()=>{_e();}},`clickable-${W.id}`),fe&&fe.taskId===W.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:fe.x,y1:D*a+4,x2:fe.x,y2:D*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:fe.x,cy:fe.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:fe.x,cy:fe.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${fe.x}, ${D*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:fe.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!fe||fe.taskId!==W.id)&&jsxRuntime.jsx("text",{x:Ke>0?Ke:100,y:D*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-${W.id}`)]})},`row-group-${W.id}`)}),ke.map((W,D)=>{if(!W.startDate||!W.endDate)return null;let{x:j,width:re}=bt(W),Ne=D*a+(a-18)/2,H=W.subtasks&&W.subtasks.length>0&&!W.isMilestone;if(W.isMilestone)return jsxRuntime.jsx(Bi,{task:W,x:j+re/2,y:Ne+12,theme:t,onClick:p},W.id);if(H){let se=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),je=8,we=Ne+(a-18)/2+(18-je)/2,He=4,ze=W.progress||0,Be=new Date;Be.setHours(0,0,0,0);let ct=W.startDate&&Be>=W.startDate,ut=W.endDate&&(()=>{let it=new Date(W.endDate);return it.setHours(0,0,0,0),Be>it})(),ht=W.startDate&&Be<W.startDate,pt=1;if(ct&&W.startDate&&W.endDate&&!ht){let it=new Date(W.startDate);it.setHours(0,0,0,0);let jt=new Date(W.endDate);jt.setHours(0,0,0,0);let mt=Math.max(1,(jt.getTime()-it.getTime())/(1e3*60*60*24)),ne=Math.min((Be.getTime()-it.getTime())/(1e3*60*60*24),mt)/mt*100;pt=ne>0?ze/ne:1;}let Ct;ze>=100?Ct="#00E5CC":ht?Ct="#4B5563":ut&&ze<100?Ct="#EF4444":pt>=.95?Ct="#22C55E":pt>=.8?Ct="#F59E0B":Ct="#EF4444";let Et=Math.max(ze/100*re,ze>0?He*2:0),Wt=re>100&&ze>0,St=W.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>p?.(W),onContextMenu:it=>{it.preventDefault(),it.stopPropagation(),g?.(W,it);},onMouseMove:it=>{ee({task:W,x:j,y:we,width:re,height:je,showBelow:we<100,mouseX:it.clientX,mouseY:it.clientY});},onMouseLeave:()=>ee(null),style:{cursor:"default",opacity:h?St?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:j,y:Ne,width:re,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:j,y:we,width:re,height:je,rx:He,fill:se?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),ze>0&&jsxRuntime.jsx("rect",{x:j,y:we,width:Et,height:je,rx:He,fill:Ct}),h&&St&&jsxRuntime.jsx("rect",{x:j,y:we,width:re,height:je,rx:He,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Wt&&jsxRuntime.jsxs("text",{x:j+Et+6,y:we+je/2,dominantBaseline:"central",fill:se?"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(ze),"%"]})]},W.id)}return jsxRuntime.jsx(Pi,{task:W,x:j,y:Ne,width:re,theme:t,dayWidth:Te*n,startDate:o,templates:d,onClick:p,onDoubleClick:m,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:Bt,onDragMove:st,onHoverChange:ee,showBaseline:b,showTaskBarLabels:u,showCriticalPath:h,readOnly:N?!N(W):false,onProgressChange:S},W.id)}),v&&ke.map((W,D)=>!W.dependencies||W.dependencies.length===0||!W.startDate||!W.endDate?null:W.dependencies.map(j=>{let re=ke.find(Ct=>Ct.id===j);if(!re||!re.startDate||!re.endDate)return null;let Ne=ke.findIndex(Ct=>Ct.id===j),H=Ve(re.id,bt(re)),se=Ve(W.id,bt(W)),je=H.x+H.width,we=Ne*a+26,He=se.x,ze=D*a+26,Be=`dep-${j}-${W.id}`;if(B.has(Be))return null;let ct=h&&W.isCriticalPath&&re.isCriticalPath;return jsxRuntime.jsx(Ds,{x1:je,y1:we,x2:He,y2:ze,theme:t,lineStyle:i,colorOverride:h?ct?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?ct?2:1:void 0,glowFilter:ct?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(W.id,j),onHoverChange:Ct=>{z.current=Ct,Ct&&q({key:Be,fromId:j,toId:W.id,exitX:je,exitY:we,enterX:He,enterY:ze});}},Be)})),A.map(W=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:W.previewX,y:W.y-48,width:W.width,height:18,rx:6,fill:W.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(W.daysDelta)>0&&jsxRuntime.jsx("text",{x:W.previewX+W.width/2,y:W.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:W.daysDelta>0?`+${W.daysDelta}d`:`${W.daysDelta}d`})]},`cascade-preview-${W.taskId}`)),v&&K&&jsxRuntime.jsx(Ds,{x1:K.exitX,y1:K.exitY,x2:K.enterX,y2:K.enterY,theme:t,lineStyle:i,onDelete:()=>{let W=K.key;q(null),z.current=false,X(D=>new Set(D).add(W)),y?.(K.toId,K.fromId);},hoverOverlayOnly:true,onHoverChange:W=>{z.current=W,W||q(null);}},`${K.key}-hover-overlay`),Ke>=0&&Ke<=ve&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:Ke,y1:0,x2:Ke,y2:Fe,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:Ke,y1:0,x2:Ke,y2:Fe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),ae&&jsxRuntime.jsx(Nm,{tooltipData:ae,theme:t,locale:l==="es"?"es":"en"})]})}var Hv=['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"'],Em=({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"})}),zv=()=>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"})}),Uv=()=>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"})}),Wv=()=>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"})}),Vv=()=>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 zi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:d}){let[i,u]=react.useState(false),[p,m]=react.useState(false),[g,f]=react.useState([]),[x,y]=react.useState(""),[b,h]=react.useState(false),[v,C]=react.useState(true),[N,S]=react.useState(""),[M,k]=react.useState(-1),[F,A]=react.useState(false),[w,_]=react.useState(0),U=react.useRef(null),ae=react.useRef(null),L=react.useRef(null),K=react.useRef(null),{enabled:q=true,placeholder:z='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:X,suggestions:fe=Hv,maxHistory:Ge=50,persistHistory:O,mentionableUsers:ee=[]}=a,ue=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Te=ue?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ve=ue?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Ue=ue?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",$e=ue?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",nt=ue?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ce=ue?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Xe=ue?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",_e=ue?"rgba(0, 229, 204, 0.9)":"#00E5CC",ke=ue?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",bt=ue?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Bt=ue?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",st=ue?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ve=ue?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",tt=ue?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Ke=ue?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Fe=ue?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",W=ue?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=ue?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",j=ue?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",re=ue?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ne="rgba(0, 229, 204, 0.04)",H=ue?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",se=ue?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",je=ue?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",we=ue?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",He=ue?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ze=ue?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Be=ue?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ct=ue?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ut="rgba(0, 229, 204, 0.06)",ht=ue?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=ue?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Ct=ue?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Et=ue?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Wt=ue?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",St=ue?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",zt=ue?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",it=ue?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",jt=ue?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",mt=ue?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",lt=ue?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ne=ue?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",me=ue?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",$=ue?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Y=ue?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Se=O?.storageKey||"gantt-ai-history",Ze=O?.maxMessages??5,gt=ee.filter(I=>{if(!N)return true;let xe=N.toLowerCase();return I.name.toLowerCase().includes(xe)||I.email&&I.email.toLowerCase().includes(xe)}).slice(0,5),Ft=react.useCallback(I=>{if(y(I),ee.length===0)return;let xe=U.current;if(!xe)return;let te=xe.selectionStart||I.length,T=I.slice(0,te),J=T.lastIndexOf("@");if(J>=0&&((J>0?T[J-1]:" ")===" "||J===0)){let Le=T.slice(J+1);if(Le.length<=40){S(Le),k(J),A(true),_(0);return}}A(false),S(""),k(-1);},[ee.length]),Rt=react.useCallback(I=>{let xe=x.slice(0,M),te=x.slice(M+1+N.length),T=`${xe}@${I.name} ${te}`;y(T),A(false),S(""),k(-1),setTimeout(()=>U.current?.focus(),0);},[x,M,N]),Mt=react.useCallback(I=>{if(!F||gt.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),_(xe=>xe<gt.length-1?xe+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),_(xe=>xe>0?xe-1:gt.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let xe=gt[w];return xe&&Rt(xe),true}return I.key==="Escape"?(A(false),true):false},[F,gt,w,Rt]);react.useEffect(()=>{if(O?.enabled)try{let I=localStorage.getItem(Se);if(I){let te=JSON.parse(I).map(T=>({...T,timestamp:new Date(T.timestamp)}));f(te.slice(-Ze));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[O?.enabled,Se,Ze]),react.useEffect(()=>{if(O?.enabled&&g.length>0)try{let I=g.filter(xe=>!xe.isLoading).slice(-Ze);localStorage.setItem(Se,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,O?.enabled,Se,Ze]),react.useEffect(()=>{ae.current&&ae.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!p&&U.current&&setTimeout(()=>U.current?.focus(),100);},[i,p]);let Yt=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&l?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&d?.(I.taskId,I.dependencyFrom);break}},[o,s,n,l,d]),Qt=react.useCallback(async I=>{if(!I.trim()||b)return;let xe={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};f(T=>[...T.slice(-(Ge-1)),xe]),y(""),C(false),h(true);let te={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(T=>[...T,te]);try{if(X){let T=await X(I,e);f(J=>{let Ce=J.filter($t=>!$t.isLoading),Le={id:`assistant-${Date.now()}`,role:"assistant",content:T.message,timestamp:new Date,command:T};return [...Ce,Le]}),Yt(T);}else f(T=>[...T.filter(Ce=>!Ce.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(T){f(J=>[...J.filter(Le=>!Le.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,Ge,X,e,Yt]),Z=I=>{I.preventDefault(),Qt(x);},Oe=I=>{y(I),U.current?.focus();};if(react.useEffect(()=>{let I=xe=>{(xe.metaKey||xe.ctrlKey)&&xe.key==="k"&&(xe.preventDefault(),u(te=>!te),i||m(false)),xe.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[i]),react.useEffect(()=>{if(!i)return;let I=te=>{let T=te.target;L.current&&!L.current.contains(T)&&u(false);},xe=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(xe),document.removeEventListener("mousedown",I);}},[i]),!q)return null;let Ae={"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(ta,{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 ${Ae[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Te,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ve}`,color:"#00E5CC",cursor:"pointer",boxShadow:Ue,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${$e}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${nt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Em,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:_e,background:ce,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Xe}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ae[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ke,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${bt}`,boxShadow:Bt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:st,borderBottom:`1px solid ${Ve}`},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 ${Ke}`,color:"#2E94FF"},children:jsxRuntime.jsx(Em,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Pe},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:W},onMouseEnter:I=>{I.currentTarget.style.background=j,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=W;},children:jsxRuntime.jsx(Wv,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:W},onMouseEnter:I=>{I.currentTarget.style.background=j,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=W;},children:jsxRuntime.jsx(Uv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!p&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:re,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:fe.slice(0,4).map((I,xe)=>jsxRuntime.jsx("button",{onClick:()=>Oe(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ne,color:se,border:`1px solid ${H}`},onMouseEnter:te=>{te.currentTarget.style.borderColor=je,te.currentTarget.style.color="#2E94FF";},onMouseLeave:te=>{te.currentTarget.style.borderColor=H,te.currentTarget.style.color=se;},children:I.length>30?I.slice(0,30)+"...":I},xe))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?we:ze,color:I.role==="user"?"#2E94FF":ct,border:I.role==="user"?`1px solid ${He}`:`1px solid ${Be}`},children:[I.isLoading?jsxRuntime.jsx(Vv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:ae})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(P&&gt.length>0){I.preventDefault();return}Z(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ut}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&gt.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:K,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 ${jt}`,boxShadow:mt,backdropFilter:"blur(12px)"},children:gt.map((I,xe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Rt(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:xe===w?lt:"transparent",color:ne},onMouseEnter:()=>_(xe),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:$,border:`1px solid ${Y}`,color:"#2E94FF"},children:I.name.split(" ").map(te=>te[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:me},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ht,border:`1px solid ${pt}`},children:[jsxRuntime.jsx("input",{ref:U,type:"text",value:x,onChange:I=>Pt(I.target.value),onKeyDown:I=>{Mt(I);},placeholder:z,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Ct,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Et:"transparent",color:x.trim()?"#2E94FF":St,border:x.trim()?`1px solid ${Wt}`:"1px solid transparent"},children:jsxRuntime.jsx(zv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:zt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Mm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(p=>{let m=typeof i=="function"?i(p.present):i;if(o.current)return {...p,present:m};if(!u)return {...p,present:m};let g=[...p.past,p.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 u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),d=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:d}}function Fm({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,d=l?n.metaKey:n.ctrlKey;if(d&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&d&&n.key==="y"){n.preventDefault(),t();return}if(l&&d&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Kv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ee.formatDate(e.startDate)} - ${Ee.formatDate(e.endDate)}`);let a=Ee.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=>Ee.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Pm(e){return {...Kv,...e}}var t2=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Im=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:d=true,showExportButton:i=true,onExportSuccess:u,projectName:p,availableUsers:m=[],templates:g,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:y,clearFiltersKey:b,aiAssistant:h,locale:v="en",customTranslations:C,showCreateTaskButton:N=false,createTaskLabel:S,onCreateTask:M,taskFilter:k,onTaskFilterChange:P,toolbarRightContent:A,showBaseline:w,viewMode:_,onViewModeChange:U,projectForecast:ae,onThemeChange:L,onTaskClick:K,onTaskDblClick:q,onTaskContextMenu:z,onTaskUpdate:B,onDependentTasksScheduled:X,onProgressChange:fe,onTaskEdit:Ge,onTaskAddSubtask:O,onTaskMarkIncomplete:ee,onTaskSetInProgress:ue,onDependencyCreate:Te,onDependencyDelete:ve,onBeforeTaskAdd:Ue,onAfterTaskAdd:$e,onBeforeTaskUpdate:nt,onAfterTaskUpdate:ce,onBeforeTaskDelete:Xe,onAfterTaskDelete:_e,permissions:ke,onCopySnapshotLink:bt}=a,st=react.useContext(Ti)?.theme,[Ve,tt]=react.useState(st||s||"dark"),[Ke,Pe]=react.useState(n),[W,D]=react.useState(l),[j,re]=react.useState(1),[Ne,H]=react.useState("all"),[se,je]=react.useState(_||"execution"),we=_??se,He=react.useCallback(F=>{je(F),U?.(F);},[U]),ze=w??we==="oracle",[Be,ct]=react.useState(a.showCriticalPath!==false),[ut,ht]=react.useState(a.showDependencies!==false),[pt,Ct]=react.useState(a.highlightWeekends!==false),Et=react.useCallback(F=>{ct(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Wt=react.useCallback(F=>{ht(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),St=react.useCallback(F=>{Ct(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(Ke);},[Ke]),react.useEffect(()=>{a.onZoomChange?.(j);},[j]);let zt=react.useRef(a.onDateRangeChange);zt.current=a.onDateRangeChange;let it=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[jt,mt]=react.useState(()=>{if(!y)return "all";try{let F=typeof y=="string"?y:"gantt-filter-state",R=localStorage.getItem(F);if(R){let G=JSON.parse(R);if(G.taskFilter)return G.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),lt=k??jt,ne=P??mt,[me,$]=react.useState(()=>{if(!y)return false;try{let F=typeof y=="string"?y:"gantt-filter-state",R=localStorage.getItem(F);if(R){let G=JSON.parse(R);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});react.useEffect(()=>{let F=it();if(F)try{let R={taskFilter:lt,hideCompleted:me};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[lt,me,it]);let Y=react.useRef(b);react.useEffect(()=>{if(Y.current!==b&&b!==void 0){mt("all"),$(false);let F=it();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}Y.current=b;},[b,it]);let[Se,Ze]=react.useState(0),[gt,Pt]=react.useState(false),[Rt,Mt]=react.useState(null),[Yt,Qt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Z,Oe]=react.useState(null),[Ae,I]=react.useState(null);react.useEffect(()=>{st&&st!==Ve&&tt(st);},[st]),react.useEffect(()=>{s&&s!==Ve&&tt(s);},[s]);let xe=react.useCallback(F=>{tt(F),L?.(F);},[L]),{state:te,setState:T,undo:J,redo:Ce,canUndo:Le,canRedo:$t,clearHistory:Nt}=Mm(t,50),Jt=react.useMemo(()=>{let F=(R,G=0)=>{let Q=G;for(let he of R)he.subtasks?.length&&(Q=Math.max(Q,F(he.subtasks,G+1)));return Q};return F(te)+1},[te]),Ua=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ya=react.useRef(new Map),Ma=react.useRef(false);if(!Ma.current&&x){Ma.current=true;let F=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let G=JSON.parse(R);Array.isArray(G)&&(ya.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Sr=react.useCallback(()=>{let F=Ua();if(F)try{let R=Array.from(ya.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Ua]),Wr=react.useRef(0),wn=react.useRef(te);react.useEffect(()=>{wn.current=te;},[te]);let Vr=react.useRef(false),as=react.useCallback(F=>{H(F),Wr.current+=1,T(R=>{let G=(he,De=0)=>he.map(yt=>{let at=F==="all"||De<F-1;return yt.subtasks?.length&&ya.current.set(yt.id,at),{...yt,isExpanded:at,subtasks:yt.subtasks?G(yt.subtasks,De+1):void 0}}),Q=G(R);return Sr(),Q});},[T,Sr]);react.useEffect(()=>{if(Wr.current>0){Wr.current-=1;return}let F=G=>{let Q=new Map;for(let he of G){let De=he.id;Q.get(De)||Q.set(De,he);}return Array.from(Q.values())},R=G=>G.map(Q=>{let he=ya.current.get(Q.id),De=he!==void 0?{...Q,isExpanded:he}:Q;if(De.subtasks?.length){let yt=F(De.subtasks);return {...De,subtasks:R(yt)}}return De});if(ya.current.size>0)T(Or(R(t)));else {let G=Q=>Q.map(he=>he.subtasks?.length?{...he,subtasks:F(G(he.subtasks))}:he);T(Or(G(t)));}},[t,T]);let So=react.useRef(t),Jo=react.useRef(true);react.useEffect(()=>{if(Jo.current){Jo.current=false,So.current=te;return}if(Vr.current){Vr.current=false,So.current=te;return}if(!r)return;let F=JSON.stringify(So.current),R=JSON.stringify(te);F!==R&&(So.current=te,r(te));},[te,r]);let E=react.useMemo(()=>Dd(v,C),[v,C]),le=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ge,Me]=react.useState(()=>le(E));react.useEffect(()=>{Me(F=>F.map(R=>({...R,label:E.columns[R.id==="name"?"taskName":R.id]||R.label})));},[E]);let Ie=react.useMemo(()=>ge.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[ge]),ot=react.useRef(ge.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=ge.filter(Q=>Q.visible),R=F.map(Q=>Q.id).join(","),G=ot.current;if(R!==G){let Q=F.some(De=>De.id!=="name"),he=G.includes(",");Q?!he&&Q&&Mt(null):Mt(null),ot.current=R;}},[ge]);let be=60,Je=.6,et=react.useMemo(()=>{let R=Ie+be,G=typeof window<"u"?window.innerWidth*Je:800,Q=Math.max(R,G);return Rt!==null?Math.max(200,Math.min(Rt,Q)):Math.max(200,R)},[Rt,Ie]),dt=react.useRef(null),Zt=react.useRef(null),Dt=react.useRef(null),Vt=react.useRef(null),ia=react.useRef(null),wt=react.useMemo(()=>qp(Ve),[Ve]),rr=react.useMemo(()=>({theme:wt,themeName:Ve}),[wt,Ve]),Da=react.useMemo(()=>Pm(g),[g]),dr=react.useMemo(()=>{if(!f)return te;let F=Ee.calculateCriticalPathFull(te),R=G=>G.map(Q=>{let he=F.get(Q.id),De=Q.subtasks?R(Q.subtasks):void 0,yt=De?.some(ua=>ua.isCriticalPath||ua.subtasks&&ua.subtasks.some(ea=>ea.isCriticalPath))||false,at=he?he.isCritical:yt;return {...Q,isCriticalPath:at,cpmData:he||void 0,subtasks:De}});return R(te)},[te,f]),Qo=react.useMemo(()=>Ee.flattenTasks(te).some(R=>R.dependencies&&R.dependencies.length>0),[te]),Ar=react.useMemo(()=>{let F=(R,G="")=>[...R].sort((he,De)=>(he.position??0)-(De.position??0)).map((he,De)=>{let yt=De+1,at=G?`${G}.${yt}`:`${yt}.0`,ua=G?`${G}.${yt}`:`${yt}`;return {...he,wbsCode:at,subtasks:he.subtasks?.length?F(he.subtasks,ua):he.subtasks}});return F(dr)},[dr]),bo=react.useMemo(()=>{if(lt==="all"&&!me)return Ar;let F=R=>{let G=[];for(let Q of R){let he=Q.subtasks?.length?F(Q.subtasks):void 0,De=false;if(me)De=Q.progress<100;else switch(lt){case "all":De=true;break;case "incomplete":De=Q.progress<100;break;case "in_progress":De=Q.progress>0&&Q.progress<100;break;case "completed":De=Q.progress===100;break}(De||he&&he.length>0)&&G.push({...Q,subtasks:he});}return G};return F(Ar)},[Ar,lt,me]),ao=t2(W);Fm({undo:J,redo:Ce,canUndo:Le,canRedo:$t,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>Ee.findTaskById(te,F),addTask:(F,R)=>{T(G=>{if(!R)return [...G,{...F,level:0}];let Q=he=>he.map(De=>De.id===R?{...De,subtasks:[...De.subtasks||[],{...F,parentId:R,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:Q(De.subtasks)}:De);return Q(G)});},updateTask:(F,R)=>{T(G=>{let Q=he=>he.map(De=>De.id===F?{...De,...R}:De.subtasks?{...De,subtasks:Q(De.subtasks)}:De);return Q(G)});},deleteTask:F=>{T(R=>{let G=Q=>Q.filter(he=>he.id===F?false:(he.subtasks&&(he.subtasks=G(he.subtasks)),true));return G(R)});},deleteTasks:F=>{T(R=>Bd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Ee.findTaskById(te,F);R&&a.onTaskDuplicate(R);}else T(R=>Ts(R,[F]).tasks);},splitTask:(F,R,G=3)=>{T(Q=>Ee.splitTask(Q,F,R,G));},calculateEndDate:Ee.calculateEndDate,calculateDuration:Ee.calculateDuration,validateDependency:(F,R)=>!Ee.validateDependencies(te,F,R),getAllTasks:()=>Ee.flattenTasks(te),getTasksByStatus:F=>Ee.flattenTasks(te).filter(R=>R.status===F),getTasksByParent:F=>F?Ee.findTaskById(te,F)?.subtasks||[]:te.filter(G=>!G.parentId),getCriticalPath:()=>Ee.flattenTasks(te).filter(F=>F.isCriticalPath),indentTask:F=>{T(R=>Or(Ad(R,[F])));},outdentTask:F=>{T(R=>Or(Ld(R,[F])));},moveTask:(F,R)=>{T(G=>Id(G,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:G}=Od(te,F);if(Ue){let Q=Ue({...G,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}T(Or(R)),$e&&$e({...G,parentId:F});},scrollToTask:F=>{let G=Ee.flattenTasks(te).findIndex(Q=>Q.id===F);if(G!==-1&&dt.current){let Q=G*ao;dt.current.scrollTo({top:Q,behavior:"smooth"}),Dt.current&&Dt.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{T(R=>{let G=Q=>Q.map(he=>he.id===F?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:G(he.subtasks)}:he);return G(R)});},collapseTask:F=>{T(R=>{let G=Q=>Q.map(he=>he.id===F?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:G(he.subtasks)}:he);return G(R)});},expandAll:()=>{T(F=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{T(F=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{as(F);},undo:J,redo:Ce,canUndo:()=>Le,canRedo:()=>$t,clearHistory:Nt,exportToPNG:async()=>{if(!Vt.current||!dt.current||!Dt.current)throw new Error("Gantt container not found");let F=Vt.current,R=dt.current,G=Zt.current||R.querySelector(".gantt-grid-scroll"),Q=Dt.current,he=G?.scrollTop||0,De=Q.scrollTop,yt=F.style.overflow,at=F.style.height,ua=R.style.overflow;try{let ea=G?.querySelector(".gantt-taskgrid-content"),fa=Q.querySelector("svg"),lr=ea?.scrollHeight||G?.scrollHeight||600,Er=fa?.getBoundingClientRect().height||Q.scrollHeight,Zo=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(lr,Er)+20;G&&(G.scrollTop=0),Q.scrollTop=0,F.style.overflow="visible",F.style.height=`${Zo}px`,R.style.overflow="visible",await new Promise(Tn=>setTimeout(Tn,100));let ro=await htmlToImage.toPng(F,{backgroundColor:wt.bgPrimary,pixelRatio:2,filter:Tn=>{if(!(Tn instanceof Element))return !0;let Ks=window.getComputedStyle(Tn),os=parseInt(Ks.zIndex,10);return (isNaN(os)||os<50)&&Ks.position!=="fixed"}});return await(await fetch(ro)).blob()}finally{F.style.overflow=yt,F.style.height=at,R.style.overflow=ua,G&&(G.scrollTop=he),Q.scrollTop=De;}},exportToPDF:async F=>{await Ee.exportToPDF(te,F);},exportToExcel:async F=>{await Ee.exportToExcel(te,F,yl.current);},exportToJSON:()=>Ee.exportToJSON(te),exportToCSV:()=>Ee.exportToCSV(te),importFromJSON:F=>{let R=Ee.importFromJSON(F);T(R);},getTasks:()=>te,refresh:()=>{T(F=>[...F]);},clearAll:()=>{T([]);},scrollToToday:()=>{let F=Dt.current,R=ia.current;if(!F||!R)return;let Q=(new Date().getTime()-R.startDate.getTime())/(1e3*60*60*24),he=R.timeScale==="day"?60:R.timeScale==="week"?20:8,De=Q*he*R.zoom,yt=F.clientWidth,at=Math.max(0,De-yt/2);F.scrollTo({left:at,behavior:"smooth"});}}),[te,J,Ce,Le,$t,Nt,wt,ao]);let gf=react.useCallback(F=>{Me(R=>R.map(G=>G.id===F?{...G,visible:!G.visible}:G));},[]),ff=react.useCallback((F,R)=>{Me(G=>G.map(Q=>{if(Q.id!==F)return Q;let he=Q.minWidth??100,De=Q.maxWidth??800,yt=Math.max(he,Math.min(De,R));return {...Q,width:yt}}));},[]),bf=react.useCallback(F=>{T(R=>{let G=$d(R,F),Q=he=>{for(let De of he){if(De.id===F){ya.current.set(F,De.isExpanded??true);return}De.subtasks?.length&&Q(De.subtasks);}};return Q(G),Sr(),G}),a.onTaskToggleExpand?.(F);},[a,Sr]),Eo=react.useCallback((F,R)=>{if(nt&&nt(F,R)===false)return;let Q=Ee.findTaskById(te,F)?.progress,he=yt=>yt.map(at=>at.id===F?{...at,...R}:at.subtasks?{...at,subtasks:he(at.subtasks)}:at);T(he(te));let De=Ee.findTaskById(he(te),F);De&&(B?.(De),ce?.(De),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&fe?.(F,Q,R.progress));},[te,B,nt,ce,fe]),hf=react.useCallback(F=>{F.length!==0&&(Wr.current+=1,Vr.current=true,T(R=>Or(Ad(R,F))),a.onTaskIndent?.(F[0]));},[a]),yf=react.useCallback(F=>{F.length!==0&&(Wr.current+=1,Vr.current=true,T(R=>Or(Ld(R,F))),a.onTaskOutdent?.(F[0]));},[a]),xf=react.useCallback((F,R,G)=>{Wr.current+=1,Vr.current=true,T(Q=>Or(bm(Q,F,R,G))),a.onTaskReparent?.(F,R,G);},[a]),vf=react.useCallback((F,R)=>{F.length!==0&&(Wr.current+=1,Vr.current=true,T(G=>Id(G,F,R)),a.onTaskMove?.(F[0],R));},[a]),fl=react.useCallback(async F=>{let R=[];for(let G of F)Xe&&await Promise.resolve(Xe(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(T(G=>Or(Bd(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),_e&&R.forEach(G=>_e(G)));},[a,Xe,_e]),wf=react.useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let G=Ee.findTaskById(te,R);G&&a.onTaskDuplicate(G);}):T(R=>Ts(R,F).tasks);},[a,te]),kf=react.useCallback((F,R)=>{T(G=>{let{tasks:Q,newTask:he}=fm(G,F,R);return Ue&&Ue(he)===false?G:(a.onTaskCreate?.(he.parentId,he.position||0),$e?.(he),Q)});},[a,Ue,$e]),Cf=react.useCallback((F,R)=>{T(G=>Rd(G,F,R)),a.onTaskRename?.(F,R);},[a]),bl=react.useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let G=Un(te,F);if(G){R(G);return}}T(G=>{let{tasks:Q}=Od(G,F);return a.onTaskCreate?.(F,0),Q});},[a,te]),Tf=react.useCallback((F,R)=>{let G=Math.max(0,Math.min(100,Math.round(R))),Q={progress:G};G===100?Q.status="completed":G>0?Q.status="in-progress":Q.status="todo",Eo(F.id,Q);},[Eo]),Nf=react.useCallback((F,R,G)=>{let Q=!F.startDate&&!F.endDate,he=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,De=ea=>ea.map(fa=>fa.id===F.id?{...fa,startDate:R,endDate:G,...F.segments&&{segments:F.segments}}:fa.subtasks?{...fa,subtasks:De(fa.subtasks)}:fa),yt=De(te),at=yt;yt=Ee.autoScheduleDependents(yt,F.id,he),yt=Or(yt),T(yt);let ua={...F,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,G):B?.(ua),X&&he!==0){let ea=Ee.flattenTasks(at),fa=Ee.flattenTasks(yt),lr=[];for(let Er of fa){if(Er.id===F.id)continue;let Mo=ea.find(ro=>ro.id===Er.id);if(!Mo)continue;let Cn=Er.startDate?.getTime()!==Mo.startDate?.getTime(),Zo=Er.endDate?.getTime()!==Mo.endDate?.getTime();(Cn||Zo)&&lr.push(Er);}lr.length>0&&X(lr);}},[te,B,X,a]),Df=react.useCallback((F,R)=>{z?.(F,R),Qt({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[z]),Sf=react.useCallback((F,R)=>{let G=Ee.splitTask(te,F.id,R);T(G),Qt({isOpen:false,x:0,y:0,task:null});},[te]),eu=react.useCallback(F=>{let R=Ee.findTaskById(te,F.id)||F;q?.(R),Ge||Oe(R);},[te,q,Ge]),tu=react.useCallback((F,R,G)=>{let Q=new Map,he=ea=>{ea.forEach(fa=>{fa.dependencies&&Q.set(fa.id,fa.dependencies),fa.subtasks&&he(fa.subtasks);});};he(G);let De=Q.get(R)||[];Q.set(R,[...De,F]);let yt=new Set,at=new Set,ua=ea=>{if(!yt.has(ea)){yt.add(ea),at.add(ea);let fa=Q.get(ea)||[];for(let lr of fa){if(!yt.has(lr)&&ua(lr))return true;if(at.has(lr))return true}}return at.delete(ea),false};return ua(R)},[]),au=react.useCallback((F,R)=>{if(tu(F.id,R,wn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
366
+ `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ae[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ke,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${bt}`,boxShadow:Bt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:st,borderBottom:`1px solid ${Ve}`},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 ${Ke}`,color:"#00E5CC"},children:jsxRuntime.jsx(Em,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Fe},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:W},onMouseEnter:I=>{I.currentTarget.style.background=j,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=W;},children:jsxRuntime.jsx(Wv,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:W},onMouseEnter:I=>{I.currentTarget.style.background=j,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=W;},children:jsxRuntime.jsx(Uv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!p&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:re,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:fe.slice(0,4).map((I,xe)=>jsxRuntime.jsx("button",{onClick:()=>Oe(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ne,color:se,border:`1px solid ${H}`},onMouseEnter:te=>{te.currentTarget.style.borderColor=je,te.currentTarget.style.color="#00E5CC";},onMouseLeave:te=>{te.currentTarget.style.borderColor=H,te.currentTarget.style.color=se;},children:I.length>30?I.slice(0,30)+"...":I},xe))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?we:ze,color:I.role==="user"?"#00E5CC":ct,border:I.role==="user"?`1px solid ${He}`:`1px solid ${Be}`},children:[I.isLoading?jsxRuntime.jsx(Vv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:ae})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(F&&gt.length>0){I.preventDefault();return}Z(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ut}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&gt.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:K,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 ${jt}`,boxShadow:mt,backdropFilter:"blur(12px)"},children:gt.map((I,xe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Rt(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:xe===w?lt:"transparent",color:ne},onMouseEnter:()=>_(xe),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:$,border:`1px solid ${Y}`,color:"#00E5CC"},children:I.name.split(" ").map(te=>te[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:me},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ht,border:`1px solid ${pt}`},children:[jsxRuntime.jsx("input",{ref:U,type:"text",value:x,onChange:I=>Ft(I.target.value),onKeyDown:I=>{Mt(I);},placeholder:z,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Ct,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Et:"transparent",color:x.trim()?"#00E5CC":St,border:x.trim()?`1px solid ${Wt}`:"1px solid transparent"},children:jsxRuntime.jsx(zv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:zt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Mm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(p=>{let m=typeof i=="function"?i(p.present):i;if(o.current)return {...p,present:m};if(!u)return {...p,present:m};let g=[...p.past,p.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 u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),d=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:d}}function Pm({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,d=l?n.metaKey:n.ctrlKey;if(d&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&d&&n.key==="y"){n.preventDefault(),t();return}if(l&&d&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Kv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ee.formatDate(e.startDate)} - ${Ee.formatDate(e.endDate)}`);let a=Ee.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=>Ee.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Fm(e){return {...Kv,...e}}var t2=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Im=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:d=true,showExportButton:i=true,onExportSuccess:u,projectName:p,availableUsers:m=[],templates:g,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:y,clearFiltersKey:b,aiAssistant:h,locale:v="en",customTranslations:C,showCreateTaskButton:N=false,createTaskLabel:S,onCreateTask:M,taskFilter:k,onTaskFilterChange:F,toolbarRightContent:A,showBaseline:w,viewMode:_,onViewModeChange:U,projectForecast:ae,onThemeChange:L,onTaskClick:K,onTaskDblClick:q,onTaskContextMenu:z,onTaskUpdate:B,onDependentTasksScheduled:X,onProgressChange:fe,onTaskEdit:Ge,onTaskAddSubtask:O,onTaskMarkIncomplete:ee,onTaskSetInProgress:ue,onDependencyCreate:Te,onDependencyDelete:ve,onBeforeTaskAdd:Ue,onAfterTaskAdd:$e,onBeforeTaskUpdate:nt,onAfterTaskUpdate:ce,onBeforeTaskDelete:Xe,onAfterTaskDelete:_e,permissions:ke,onCopySnapshotLink:bt}=a,st=react.useContext(Ti)?.theme,[Ve,tt]=react.useState(st||s||"dark"),[Ke,Fe]=react.useState(n),[W,D]=react.useState(l),[j,re]=react.useState(1),[Ne,H]=react.useState("all"),[se,je]=react.useState(_||"execution"),we=_??se,He=react.useCallback(P=>{je(P),U?.(P);},[U]),ze=w??we==="oracle",[Be,ct]=react.useState(a.showCriticalPath!==false),[ut,ht]=react.useState(a.showDependencies!==false),[pt,Ct]=react.useState(a.highlightWeekends!==false),Et=react.useCallback(P=>{ct(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Wt=react.useCallback(P=>{ht(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),St=react.useCallback(P=>{Ct(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(Ke);},[Ke]),react.useEffect(()=>{a.onZoomChange?.(j);},[j]);let zt=react.useRef(a.onDateRangeChange);zt.current=a.onDateRangeChange;let it=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[jt,mt]=react.useState(()=>{if(!y)return "all";try{let P=typeof y=="string"?y:"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"}),lt=k??jt,ne=F??mt,[me,$]=react.useState(()=>{if(!y)return false;try{let P=typeof y=="string"?y:"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=it();if(P)try{let R={taskFilter:lt,hideCompleted:me};localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[lt,me,it]);let Y=react.useRef(b);react.useEffect(()=>{if(Y.current!==b&&b!==void 0){mt("all"),$(false);let P=it();if(P)try{localStorage.removeItem(P);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}Y.current=b;},[b,it]);let[Se,Ze]=react.useState(0),[gt,Ft]=react.useState(false),[Rt,Mt]=react.useState(null),[Yt,Qt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Z,Oe]=react.useState(null),[Ae,I]=react.useState(null);react.useEffect(()=>{st&&st!==Ve&&tt(st);},[st]),react.useEffect(()=>{s&&s!==Ve&&tt(s);},[s]);let xe=react.useCallback(P=>{tt(P),L?.(P);},[L]),{state:te,setState:T,undo:J,redo:Ce,canUndo:Le,canRedo:$t,clearHistory:Nt}=Mm(t,50),Jt=react.useMemo(()=>{let P=(R,G=0)=>{let Q=G;for(let he of R)he.subtasks?.length&&(Q=Math.max(Q,P(he.subtasks,G+1)));return Q};return P(te)+1},[te]),Ua=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ya=react.useRef(new Map),Ma=react.useRef(false);if(!Ma.current&&x){Ma.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)&&(ya.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Sr=react.useCallback(()=>{let P=Ua();if(P)try{let R=Array.from(ya.current.entries());localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Ua]),Wr=react.useRef(0),wn=react.useRef(te);react.useEffect(()=>{wn.current=te;},[te]);let Vr=react.useRef(false),as=react.useCallback(P=>{H(P),Wr.current+=1,T(R=>{let G=(he,De=0)=>he.map(yt=>{let at=P==="all"||De<P-1;return yt.subtasks?.length&&ya.current.set(yt.id,at),{...yt,isExpanded:at,subtasks:yt.subtasks?G(yt.subtasks,De+1):void 0}}),Q=G(R);return Sr(),Q});},[T,Sr]);react.useEffect(()=>{if(Wr.current>0){Wr.current-=1;return}let P=G=>{let Q=new Map;for(let he of G){let De=he.id;Q.get(De)||Q.set(De,he);}return Array.from(Q.values())},R=G=>G.map(Q=>{let he=ya.current.get(Q.id),De=he!==void 0?{...Q,isExpanded:he}:Q;if(De.subtasks?.length){let yt=P(De.subtasks);return {...De,subtasks:R(yt)}}return De});if(ya.current.size>0)T(Or(R(t)));else {let G=Q=>Q.map(he=>he.subtasks?.length?{...he,subtasks:P(G(he.subtasks))}:he);T(Or(G(t)));}},[t,T]);let So=react.useRef(t),Jo=react.useRef(true);react.useEffect(()=>{if(Jo.current){Jo.current=false,So.current=te;return}if(Vr.current){Vr.current=false,So.current=te;return}if(!r)return;let P=JSON.stringify(So.current),R=JSON.stringify(te);P!==R&&(So.current=te,r(te));},[te,r]);let E=react.useMemo(()=>Dd(v,C),[v,C]),le=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}],[]),[ge,Me]=react.useState(()=>le(E));react.useEffect(()=>{Me(P=>P.map(R=>({...R,label:E.columns[R.id==="name"?"taskName":R.id]||R.label})));},[E]);let Ie=react.useMemo(()=>ge.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[ge]),ot=react.useRef(ge.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=ge.filter(Q=>Q.visible),R=P.map(Q=>Q.id).join(","),G=ot.current;if(R!==G){let Q=P.some(De=>De.id!=="name"),he=G.includes(",");Q?!he&&Q&&Mt(null):Mt(null),ot.current=R;}},[ge]);let be=60,Je=.6,et=react.useMemo(()=>{let R=Ie+be,G=typeof window<"u"?window.innerWidth*Je:800,Q=Math.max(R,G);return Rt!==null?Math.max(200,Math.min(Rt,Q)):Math.max(200,R)},[Rt,Ie]),dt=react.useRef(null),Zt=react.useRef(null),Dt=react.useRef(null),Vt=react.useRef(null),ia=react.useRef(null),wt=react.useMemo(()=>qp(Ve),[Ve]),rr=react.useMemo(()=>({theme:wt,themeName:Ve}),[wt,Ve]),Da=react.useMemo(()=>Fm(g),[g]),dr=react.useMemo(()=>{if(!f)return te;let P=Ee.calculateCriticalPathFull(te),R=G=>G.map(Q=>{let he=P.get(Q.id),De=Q.subtasks?R(Q.subtasks):void 0,yt=De?.some(ua=>ua.isCriticalPath||ua.subtasks&&ua.subtasks.some(ea=>ea.isCriticalPath))||false,at=he?he.isCritical:yt;return {...Q,isCriticalPath:at,cpmData:he||void 0,subtasks:De}});return R(te)},[te,f]),Qo=react.useMemo(()=>Ee.flattenTasks(te).some(R=>R.dependencies&&R.dependencies.length>0),[te]),Ar=react.useMemo(()=>{let P=(R,G="")=>[...R].sort((he,De)=>(he.position??0)-(De.position??0)).map((he,De)=>{let yt=De+1,at=G?`${G}.${yt}`:`${yt}.0`,ua=G?`${G}.${yt}`:`${yt}`;return {...he,wbsCode:at,subtasks:he.subtasks?.length?P(he.subtasks,ua):he.subtasks}});return P(dr)},[dr]),bo=react.useMemo(()=>{if(lt==="all"&&!me)return Ar;let P=R=>{let G=[];for(let Q of R){let he=Q.subtasks?.length?P(Q.subtasks):void 0,De=false;if(me)De=Q.progress<100;else switch(lt){case "all":De=true;break;case "incomplete":De=Q.progress<100;break;case "in_progress":De=Q.progress>0&&Q.progress<100;break;case "completed":De=Q.progress===100;break}(De||he&&he.length>0)&&G.push({...Q,subtasks:he});}return G};return P(Ar)},[Ar,lt,me]),ao=t2(W);Pm({undo:J,redo:Ce,canUndo:Le,canRedo:$t,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>Ee.findTaskById(te,P),addTask:(P,R)=>{T(G=>{if(!R)return [...G,{...P,level:0}];let Q=he=>he.map(De=>De.id===R?{...De,subtasks:[...De.subtasks||[],{...P,parentId:R,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:Q(De.subtasks)}:De);return Q(G)});},updateTask:(P,R)=>{T(G=>{let Q=he=>he.map(De=>De.id===P?{...De,...R}:De.subtasks?{...De,subtasks:Q(De.subtasks)}:De);return Q(G)});},deleteTask:P=>{T(R=>{let G=Q=>Q.filter(he=>he.id===P?false:(he.subtasks&&(he.subtasks=G(he.subtasks)),true));return G(R)});},deleteTasks:P=>{T(R=>Bd(R,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let R=Ee.findTaskById(te,P);R&&a.onTaskDuplicate(R);}else T(R=>Ts(R,[P]).tasks);},splitTask:(P,R,G=3)=>{T(Q=>Ee.splitTask(Q,P,R,G));},calculateEndDate:Ee.calculateEndDate,calculateDuration:Ee.calculateDuration,validateDependency:(P,R)=>!Ee.validateDependencies(te,P,R),getAllTasks:()=>Ee.flattenTasks(te),getTasksByStatus:P=>Ee.flattenTasks(te).filter(R=>R.status===P),getTasksByParent:P=>P?Ee.findTaskById(te,P)?.subtasks||[]:te.filter(G=>!G.parentId),getCriticalPath:()=>Ee.flattenTasks(te).filter(P=>P.isCriticalPath),indentTask:P=>{T(R=>Or(Ad(R,[P])));},outdentTask:P=>{T(R=>Or(Ld(R,[P])));},moveTask:(P,R)=>{T(G=>Id(G,[P],R));},createSubtask:async P=>{let{tasks:R,newTask:G}=Od(te,P);if(Ue){let Q=Ue({...G,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}T(Or(R)),$e&&$e({...G,parentId:P});},scrollToTask:P=>{let G=Ee.flattenTasks(te).findIndex(Q=>Q.id===P);if(G!==-1&&dt.current){let Q=G*ao;dt.current.scrollTo({top:Q,behavior:"smooth"}),Dt.current&&Dt.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,R=2e3)=>{},expandTask:P=>{T(R=>{let G=Q=>Q.map(he=>he.id===P?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:G(he.subtasks)}:he);return G(R)});},collapseTask:P=>{T(R=>{let G=Q=>Q.map(he=>he.id===P?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:G(he.subtasks)}:he);return G(R)});},expandAll:()=>{T(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseAll:()=>{T(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseToLevel:P=>{as(P);},undo:J,redo:Ce,canUndo:()=>Le,canRedo:()=>$t,clearHistory:Nt,exportToPNG:async()=>{if(!Vt.current||!dt.current||!Dt.current)throw new Error("Gantt container not found");let P=Vt.current,R=dt.current,G=Zt.current||R.querySelector(".gantt-grid-scroll"),Q=Dt.current,he=G?.scrollTop||0,De=Q.scrollTop,yt=P.style.overflow,at=P.style.height,ua=R.style.overflow;try{let ea=G?.querySelector(".gantt-taskgrid-content"),fa=Q.querySelector("svg"),lr=ea?.scrollHeight||G?.scrollHeight||600,Er=fa?.getBoundingClientRect().height||Q.scrollHeight,Zo=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(lr,Er)+20;G&&(G.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${Zo}px`,R.style.overflow="visible",await new Promise(Tn=>setTimeout(Tn,100));let ro=await htmlToImage.toPng(P,{backgroundColor:wt.bgPrimary,pixelRatio:2,filter:Tn=>{if(!(Tn instanceof Element))return !0;let Ks=window.getComputedStyle(Tn),os=parseInt(Ks.zIndex,10);return (isNaN(os)||os<50)&&Ks.position!=="fixed"}});return await(await fetch(ro)).blob()}finally{P.style.overflow=yt,P.style.height=at,R.style.overflow=ua,G&&(G.scrollTop=he),Q.scrollTop=De;}},exportToPDF:async P=>{await Ee.exportToPDF(te,P);},exportToExcel:async P=>{await Ee.exportToExcel(te,P,yl.current);},exportToJSON:()=>Ee.exportToJSON(te),exportToCSV:()=>Ee.exportToCSV(te),importFromJSON:P=>{let R=Ee.importFromJSON(P);T(R);},getTasks:()=>te,refresh:()=>{T(P=>[...P]);},clearAll:()=>{T([]);},scrollToToday:()=>{let P=Dt.current,R=ia.current;if(!P||!R)return;let Q=(new Date().getTime()-R.startDate.getTime())/(1e3*60*60*24),he=R.timeScale==="day"?60:R.timeScale==="week"?20:8,De=Q*he*R.zoom,yt=P.clientWidth,at=Math.max(0,De-yt/2);P.scrollTo({left:at,behavior:"smooth"});}}),[te,J,Ce,Le,$t,Nt,wt,ao]);let gf=react.useCallback(P=>{Me(R=>R.map(G=>G.id===P?{...G,visible:!G.visible}:G));},[]),ff=react.useCallback((P,R)=>{Me(G=>G.map(Q=>{if(Q.id!==P)return Q;let he=Q.minWidth??100,De=Q.maxWidth??800,yt=Math.max(he,Math.min(De,R));return {...Q,width:yt}}));},[]),bf=react.useCallback(P=>{T(R=>{let G=$d(R,P),Q=he=>{for(let De of he){if(De.id===P){ya.current.set(P,De.isExpanded??true);return}De.subtasks?.length&&Q(De.subtasks);}};return Q(G),Sr(),G}),a.onTaskToggleExpand?.(P);},[a,Sr]),Eo=react.useCallback((P,R)=>{if(nt&&nt(P,R)===false)return;let Q=Ee.findTaskById(te,P)?.progress,he=yt=>yt.map(at=>at.id===P?{...at,...R}:at.subtasks?{...at,subtasks:he(at.subtasks)}:at);T(he(te));let De=Ee.findTaskById(he(te),P);De&&(B?.(De),ce?.(De),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&fe?.(P,Q,R.progress));},[te,B,nt,ce,fe]),hf=react.useCallback(P=>{P.length!==0&&(Wr.current+=1,Vr.current=true,T(R=>Or(Ad(R,P))),a.onTaskIndent?.(P[0]));},[a]),yf=react.useCallback(P=>{P.length!==0&&(Wr.current+=1,Vr.current=true,T(R=>Or(Ld(R,P))),a.onTaskOutdent?.(P[0]));},[a]),xf=react.useCallback((P,R,G)=>{Wr.current+=1,Vr.current=true,T(Q=>Or(bm(Q,P,R,G))),a.onTaskReparent?.(P,R,G);},[a]),vf=react.useCallback((P,R)=>{P.length!==0&&(Wr.current+=1,Vr.current=true,T(G=>Id(G,P,R)),a.onTaskMove?.(P[0],R));},[a]),fl=react.useCallback(async P=>{let R=[];for(let G of P)Xe&&await Promise.resolve(Xe(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(T(G=>Or(Bd(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),_e&&R.forEach(G=>_e(G)));},[a,Xe,_e]),wf=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(R=>{let G=Ee.findTaskById(te,R);G&&a.onTaskDuplicate(G);}):T(R=>Ts(R,P).tasks);},[a,te]),kf=react.useCallback((P,R)=>{T(G=>{let{tasks:Q,newTask:he}=fm(G,P,R);return Ue&&Ue(he)===false?G:(a.onTaskCreate?.(he.parentId,he.position||0),$e?.(he),Q)});},[a,Ue,$e]),Cf=react.useCallback((P,R)=>{T(G=>Rd(G,P,R)),a.onTaskRename?.(P,R);},[a]),bl=react.useCallback(P=>{let{onTaskAddSubtask:R}=a;if(R){let G=Un(te,P);if(G){R(G);return}}T(G=>{let{tasks:Q}=Od(G,P);return a.onTaskCreate?.(P,0),Q});},[a,te]),Tf=react.useCallback((P,R)=>{let G=Math.max(0,Math.min(100,Math.round(R))),Q={progress:G};G===100?Q.status="completed":G>0?Q.status="in-progress":Q.status="todo",Eo(P.id,Q);},[Eo]),Nf=react.useCallback((P,R,G)=>{let Q=!P.startDate&&!P.endDate,he=P.startDate?Math.round((R.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,De=ea=>ea.map(fa=>fa.id===P.id?{...fa,startDate:R,endDate:G,...P.segments&&{segments:P.segments}}:fa.subtasks?{...fa,subtasks:De(fa.subtasks)}:fa),yt=De(te),at=yt;yt=Ee.autoScheduleDependents(yt,P.id,he),yt=Or(yt),T(yt);let ua={...P,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,R,G):B?.(ua),X&&he!==0){let ea=Ee.flattenTasks(at),fa=Ee.flattenTasks(yt),lr=[];for(let Er of fa){if(Er.id===P.id)continue;let Mo=ea.find(ro=>ro.id===Er.id);if(!Mo)continue;let Cn=Er.startDate?.getTime()!==Mo.startDate?.getTime(),Zo=Er.endDate?.getTime()!==Mo.endDate?.getTime();(Cn||Zo)&&lr.push(Er);}lr.length>0&&X(lr);}},[te,B,X,a]),Df=react.useCallback((P,R)=>{z?.(P,R),Qt({isOpen:true,x:R.clientX,y:R.clientY,task:P});},[z]),Sf=react.useCallback((P,R)=>{let G=Ee.splitTask(te,P.id,R);T(G),Qt({isOpen:false,x:0,y:0,task:null});},[te]),eu=react.useCallback(P=>{let R=Ee.findTaskById(te,P.id)||P;q?.(R),Ge||Oe(R);},[te,q,Ge]),tu=react.useCallback((P,R,G)=>{let Q=new Map,he=ea=>{ea.forEach(fa=>{fa.dependencies&&Q.set(fa.id,fa.dependencies),fa.subtasks&&he(fa.subtasks);});};he(G);let De=Q.get(R)||[];Q.set(R,[...De,P]);let yt=new Set,at=new Set,ua=ea=>{if(!yt.has(ea)){yt.add(ea),at.add(ea);let fa=Q.get(ea)||[];for(let lr of fa){if(!yt.has(lr)&&ua(lr))return true;if(at.has(lr))return true}}return at.delete(ea),false};return ua(R)},[]),au=react.useCallback((P,R)=>{if(tu(P.id,R,wn.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(he=>{if(he.id===R){let De=he.dependencies||[];if(!De.includes(F.id))return {...he,dependencies:[...De,F.id]}}return he.subtasks?{...he,subtasks:G(he.subtasks)}:he});Wr.current+=1,T(Q=>G(Q)),Te?.(F.id,R);},[Te,tu]),ru=react.useCallback((F,R)=>{let G=Q=>Q.map(he=>{if(he.id===F&&he.dependencies){let De=he.dependencies.filter(yt=>yt!==R);return {...he,dependencies:De}}return he.subtasks?{...he,subtasks:G(he.subtasks)}:he});Wr.current+=1,T(Q=>G(Q)),ve?.(F,R);},[ve]),{startDate:ho,endDate:hl}=react.useMemo(()=>{let F=te.filter(De=>De.startDate&&De.endDate);if(F.length===0){let De=new Date,yt=new Date(De);yt.setDate(yt.getDate()-30);let at=new Date(De);return at.setDate(at.getDate()+60),{startDate:yt,endDate:at}}let R=F.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),G=new Date(Math.min(...R.map(De=>De.getTime()))),Q=new Date(Math.max(...R.map(De=>De.getTime()))),he=Ke==="day"?7:Ke==="week"?14:30;return G.setDate(G.getDate()-he),Q.setDate(Q.getDate()+he),{startDate:G,endDate:Q}},[te,Ke]);react.useEffect(()=>{zt.current?.(ho,hl);},[ho,hl]);let Ef=react.useCallback(async()=>{if(!Vt.current||!dt.current||!Dt.current)return;await new Promise(Zo=>setTimeout(Zo,200));let F=Vt.current,R=dt.current,G=Zt.current||R.querySelector(".gantt-grid-scroll"),Q=Dt.current,he=G?.scrollTop||0,De=G?.scrollLeft||0,yt=Q.scrollTop,at=Q.scrollLeft,ua=F.style.overflow,ea=F.style.height,fa=G?.style.overflow||"",lr=Q.style.overflow,Er=R.style.overflow,Mo=F.style.width,Cn=Q.style.width;try{let Zo=G?.querySelector(".gantt-taskgrid-content"),ro=Q.querySelector("svg"),wl=ro?.getAttribute("height")?parseInt(ro.getAttribute("height"),10):ro?.getBoundingClientRect().height||0,Tn=Zo?.scrollHeight||G?.scrollHeight||600,Ks=Math.max(wl,Q.scrollHeight),os=ro?.getAttribute("width")?parseInt(ro.getAttribute("width"),10):ro?.getBoundingClientRect().width||Q.scrollWidth,Rf=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,kl=Math.max(Tn,Ks,wl),iu=Rf+kl+50,lu=(G?.offsetWidth||R.offsetWidth||300)+os+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,F.style.overflow="visible",F.style.height=`${iu}px`,F.style.width=`${lu}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${kl+50}px`),Q.style.overflow="visible",Q.style.height=`${kl+50}px`,Q.style.width=`${os+10}px`,await new Promise(qs=>setTimeout(qs,150));let $f=await htmlToImage.toPng(F,{backgroundColor:wt.bgPrimary,pixelRatio:2,width:lu,height:iu,skipFonts:!1,filter:qs=>{if(!(qs instanceof Element))return !0;let du=window.getComputedStyle(qs),cu=parseInt(du.zIndex,10);return !(!isNaN(cu)&&cu>=50||du.position==="fixed")}}),Cl=document.createElement("a");Cl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Cl.href=$f,Cl.click();}finally{F.style.overflow=ua,F.style.height=ea,F.style.width=Mo,R.style.overflow=Er,G&&(G.style.overflow=fa,G.style.height="",G.scrollTop=he,G.scrollLeft=De),Q.style.overflow=lr,Q.style.height="",Q.style.width=Cn,Q.scrollTop=yt,Q.scrollLeft=at;}u?.("png");},[wt,u]),Mf=react.useCallback(async()=>{await Ee.exportToPDF(te),u?.("pdf");},[te,u]),yl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});yl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let Ff=react.useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let F=new Date,R=he=>String(he).padStart(2,"0"),G=`${F.getFullYear()}-${R(F.getMonth()+1)}-${R(F.getDate())}_${R(F.getHours())}${R(F.getMinutes())}`,Q=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ee.exportToExcel(te,`${Q}_${G}.xlsx`,yl.current),u?.("excel");},[te,p,u,a.onExportExcel]),Pf=react.useCallback(()=>{let F=Ee.exportToCSV(te),R=new Blob([F],{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),u?.("csv");},[te,u]),Af=react.useCallback(()=>{let F=Ee.exportToJSON(te),R=new Blob([F],{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),u?.("json");},[te,u]),Lf=react.useCallback(()=>{Ee.exportToMSProject(te,"Gantt Project","project.xml"),u?.("msproject");},[te,u]),If=F=>{F.preventDefault(),Pt(true);},kn=react.useRef(false),[xl,ou]=react.useState(false),rs=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let F=Dt.current,R=dt.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let G=()=>{if(kn.current)return;kn.current=true;let at=F.scrollTop;Ze(at),R.scrollTop=at,requestAnimationFrame(()=>{kn.current=false;});},Q=()=>{if(kn.current)return;kn.current=true;let at=R.scrollTop;Ze(at),F.scrollTop=at,requestAnimationFrame(()=>{kn.current=false;});},he=at=>{if(gt&&R){let ea=R.parentElement?.getBoundingClientRect()?.left||0,fa=at.clientX-ea,lr=200,Er=Ie+be,Mo=window.innerWidth*Je,Cn=Math.max(Er,Mo);fa>=lr&&fa<=Cn&&Mt(fa);}if(xl&&F){let ua=at.clientX-rs.current.x,ea=at.clientY-rs.current.y;F.scrollLeft=rs.current.scrollLeft-ua,F.scrollTop=rs.current.scrollTop-ea;}},De=()=>{Pt(false),ou(false);},yt=at=>{if(at.button!==0)return;let ua=at.target;ua.closest("[data-task-bar]")||ua.closest("[data-dependency-line]")||ua.closest("button")||ua.closest('[role="button"]')||ua.tagName==="rect"&&ua.getAttribute("data-clickable")==="true"||(ou(true),rs.current={x:at.clientX,y:at.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},at.preventDefault());};return F.addEventListener("scroll",G),R.addEventListener("scroll",Q),F.addEventListener("mousedown",yt),document.addEventListener("mousemove",he),document.addEventListener("mouseup",De),()=>{F.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",De);}},[gt,xl,Ie]),ia.current={startDate:ho,timeScale:Ke,zoom:j};let vl=a.onTodayVisibilityChange,nu=react.useRef(null);react.useEffect(()=>{if(!vl)return;let F=Dt.current;if(!F)return;let R=Ke==="day"?60:Ke==="week"?20:8,G=()=>{let De=(new Date().getTime()-ho.getTime())/(1e3*60*60*24)*R*j,yt=F.scrollLeft,at=yt+F.clientWidth,ua=De>=yt&&De<=at;nu.current!==ua&&(nu.current=ua,vl(ua));};return G(),F.addEventListener("scroll",G,{passive:true}),window.addEventListener("resize",G),()=>{F.removeEventListener("scroll",G),window.removeEventListener("resize",G);}},[vl,ho,Ke,j]);let su=react.useRef(false),Bf=react.useRef(null);return react.useLayoutEffect(()=>{if(su.current||te.length===0||!Dt.current)return;su.current=true,Bf.current=ho;let F=Dt.current,R=new Date,G=Ke==="day"?60:Ke==="week"?20:8,Q=(R.getTime()-ho.getTime())/(1e3*60*60*24),he=F.clientWidth,yt=Q*G*j-he/2;Q>=0&&he>0&&(F.scrollLeft=Math.max(0,yt));},[te.length,ho,Ke,j]),jsxRuntime.jsx($n.Provider,{value:E,children:jsxRuntime.jsx(El.Provider,{value:rr,children:jsxRuntime.jsxs("div",{ref:Vt,className:"flex flex-col h-full w-full",style:{backgroundColor:wt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...wt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${wt.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(Di,{theme:wt,timeScale:Ke,onTimeScaleChange:Pe,zoom:j,onZoomChange:re,currentTheme:Ve,onThemeChange:xe,rowDensity:W,onRowDensityChange:D,showThemeSelector:d,showCreateTaskButton:N&&ke?.canCreateTask!==false&&!ke?.canCreateSubtaskOnly,createTaskLabel:S,onCreateTask:M,taskFilter:lt,onTaskFilterChange:ne,hideCompleted:me,onHideCompletedChange:$,toolbarRightContent:A,wbsLevel:Ne,onWbsLevelChange:as,maxWbsDepth:Jt,viewMode:we,onViewModeChange:He,projectForecast:ae,onExportPNG:i?Ef:void 0,onExportPDF:i?Mf:void 0,onExportExcel:i?Ff:void 0,onExportCSV:i?Pf:void 0,onExportJSON:i?Af:void 0,onExportMSProject:i?Lf:void 0,showCriticalPath:Be,onShowCriticalPathChange:Et,showDependencies:ut,onShowDependenciesChange:Wt,highlightWeekends:pt,onHighlightWeekendsChange:St,showBaseline:ze,onShowBaselineChange:F=>{F&&we!=="oracle"&&He("oracle"),!F&&we==="oracle"&&He("execution");},onCopySnapshotLink:bt,hasDependencies:Qo})}),jsxRuntime.jsxs("div",{ref:dt,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Zt,className:"gantt-grid-scroll flex-shrink-0",style:{width:et,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Mi,{tasks:bo,theme:wt,rowHeight:ao,availableUsers:m,templates:Da,showCriticalPath:Be,onTaskClick:K,onTaskDblClick:eu,onTaskContextMenu:z,onTaskToggle:bf,scrollTop:Se,columns:ge,onToggleColumn:gf,onColumnResize:ff,onTaskUpdate:Eo,onTaskIndent:hf,onTaskOutdent:yf,onTaskMove:vf,onMultiTaskDelete:fl,onTaskDuplicate:wf,onTaskCreate:kf,onTaskRename:Cf,onCreateSubtask:bl,onOpenTaskModal:K?F=>K(F):void 0,onDeleteRequest:(F,R)=>I({taskId:F,taskName:R}),onTaskReparent:xf,scrollContainerRef:Zt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:wt.border,zIndex:15},onMouseDown:If}),jsxRuntime.jsx("div",{ref:Dt,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:xl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx($i,{tasks:bo,theme:wt,rowHeight:ao,timeScale:Ke,startDate:ho,endDate:hl,zoom:j,locale:v,templates:Da,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:K,onTaskDblClick:eu,onTaskContextMenu:Df,onTaskDateChange:Nf,onTaskProgressDrag:Tf,onDependencyCreate:au,onDependencyDelete:ru,showBaseline:ze,showCriticalPath:Be,showDependencies:ut,highlightWeekends:pt,canEditTask:ke?.canEditTask})})]}),Yt.task&&jsxRuntime.jsx(Hn,{isOpen:Yt.isOpen,x:Yt.x,y:Yt.y,theme:wt,onClose:()=>Qt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Yt.task;if(!F)return [];let R=Ee.findTaskById(te,F.id)||F,G=R.subtasks&&R.subtasks.length>0,Q=ke?.canCreateTask!==false,he=ke?.canDeleteTask!==false;if(G){let ea=[],fa=ke?.canDuplicateTask!==false;return Q&&ea.push({id:"addSubtask",label:E.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(R):bl(R.id);}}),fa&&ea.push({id:"duplicate",label:E.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):T(lr=>Ts(lr,[R.id]).tasks),Qt({isOpen:false,x:0,y:0,task:null});}}),he&&(ea.length>0&&ea.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ea.push({id:"delete",label:E.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),ea}let De=ke?.canUpdateTask!==false,yt=ke?.canDuplicateTask!==false,at=[];return De&&at.push({id:"edit",label:E.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{Ge?Ge(R):Oe(R);}}),Q&&at.push({id:"addSubtask",label:E.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(R):bl(R.id);}}),at.length>0&&De&&at.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),De&&(at.push({id:"markIncomplete",label:E.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{ee?ee(R):Eo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),at.push({id:"setInProgress",label:E.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{ue?ue(R):Eo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),at.push({id:"markComplete",label:E.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{Eo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(yt||De&&R.startDate&&R.endDate)&&at.length>0&&at.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),yt&&at.push({id:"duplicate",label:E.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):T(ea=>Ts(ea,[R.id]).tasks),Qt({isOpen:false,x:0,y:0,task:null});}}),De&&R.startDate&&R.endDate&&at.push({id:"split",label:E.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let ea=R.startDate.getTime(),fa=R.endDate.getTime(),lr=ea+(fa-ea)/2,Er=new Date(lr);Sf(R,Er);}}),he&&(at.length>0&&at.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),at.push({id:"delete",label:E.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),at})()}),jsxRuntime.jsx(vo,{task:Z,isOpen:!!Z,onClose:()=>Oe(null),onTaskUpdate:F=>{Z&&(Eo(Z.id,F),Oe(null));},theme:Ve==="light"?"light":"dark",locale:v==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ae&&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:()=>I(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:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:wt.bgSecondary,border:`1px solid ${wt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${wt.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:wt.textPrimary,fontFamily:"Inter, sans-serif"},children:[E.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:wt.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:wt.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:wt.textPrimary},children:['"',Ae.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:wt.bgPrimary,borderTop:`1px solid ${wt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:wt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=wt.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{fl([Ae.taskId]),I(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),h?.enabled&&jsxRuntime.jsx(zi,{tasks:te,theme:wt,config:h,onTasksUpdate:T,onTaskUpdate:Eo,onTaskCreate:F=>{T(R=>[...R,F]);},onTaskDelete:F=>{fl([F]);},onDependencyCreate:(F,R)=>{let G=Ee.findTaskById(te,F);G&&au(G,R);},onDependencyDelete:ru})]})})})});function p2(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 m2(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),d=parseInt(a[2],10);return l*60+d}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 Ud=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Wd=[{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 $m({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:d="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:p,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:f,defaultStatus:x}){let y=[...Ud,...i.filter(D=>!Ud.some(j=>j.id===D.id))],b=xt[d]||xt.dark,[h,v]=react.useState(false),[C,N]=react.useState(false),[S,M]=react.useState(false),[k,P]=react.useState(false),[A,w]=react.useState({top:0,left:0}),[_,U]=react.useState(null),[ae,L]=react.useState(new Date),[K,q]=react.useState({top:0,left:0}),[z,B]=react.useState(false),[X,fe]=react.useState([]),[Ge,O]=react.useState(false),[ee,ue]=react.useState(""),Te=react.useRef(null),ve=react.useRef(null),Ue=react.useRef(null),$e=react.useRef(null),nt=react.useRef(null),[ce,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[_e,ke]=react.useState({});react.useEffect(()=>{a?(Xe({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)):(Xe({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),fe([]));},[a,e,x]),react.useEffect(()=>{let D=j=>{Te.current&&!Te.current.contains(j.target)&&v(false),ve.current&&!ve.current.contains(j.target)&&N(false),Ue.current&&!Ue.current.contains(j.target)&&M(false),$e.current&&!$e.current.contains(j.target)&&P(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let bt=()=>{let D={};return ce.name.trim()||(D.name="El nombre es requerido"),ce.startDate&&ce.endDate&&ce.startDate>ce.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),ke(D),Object.keys(D).length===0},Bt=async D=>{if(D.preventDefault(),!!bt())try{let j=l==="create"&&X.length>0?{...ce,pendingFiles:X}:ce;await s(j),fe([]),t();}catch(j){console.error("Error submitting task:",j);}},st=(D,j)=>{Xe(re=>{let Ne={...re,[D]:j};if(D==="status"){let H=j;H==="todo"?Ne.progress=0:H==="in-progress"?(re.progress===0||re.progress===100)&&(Ne.progress=50):H==="completed"||H==="closed"?Ne.progress=100:(H==="in-review"||H==="review")&&(Ne.progress=75);}if(D==="progress"){let H=typeof j=="number"?j:parseInt(j,10);H===100&&re.status!=="completed"?Ne.status="completed":H>0&&H<100&&re.status==="todo"?Ne.status="in-progress":H===0&&re.status!=="todo"&&(Ne.status="todo");}return Ne}),_e[D]&&ke(re=>{let Ne={...re};return delete Ne[D],Ne});},Ve=y.find(D=>D.id===ce.status)??Ud[0],tt=Wd.find(D=>D.id===ce.priority)??Wd[1],Ke=nn.find(D=>D.value===ce.color)??nn[0],Pe=d==="dark",W={backgroundColor:Pe?"#1d1f27":b.bgSecondary,border:`1px solid ${Pe?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Pe?"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":d,style:{backgroundColor:Pe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Pe?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Pe?"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:Bt,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:ce.name,onChange:D=>st("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),_e.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),_e.name]}),jsxRuntime.jsx("textarea",{value:ce.description||"",onChange:D=>st("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:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.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:Te,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...W,borderColor:Ve.color,backgroundColor:`${Ve.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Ve.color}}),jsxRuntime.jsx("span",{style:{color:Ve.color},children:Ve.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Ve.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:Pe?"#0a0a0a":b.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":b.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.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:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("status",D.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ce.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:ve,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:W,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:b.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:Pe?"#0a0a0a":b.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":b.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Wd.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:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("priority",D.id),N(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,ce.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ue,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&M(!S),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:W,disabled:n,children:[ce.assignees&&ce.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ce.assignees.slice(0,3).map((D,j)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||b.accent,borderColor:b.bgSecondary},children:D.initials},j))}),ce.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",ce.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&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:Pe?"#0a0a0a":b.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":b.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let j=ce.assignees?.some(re=>re.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:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{let re=j?(ce.assignees||[]).filter(Ne=>Ne.name!==D.name):[...ce.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:b.accent}];st("assignees",re);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children: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:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:$e,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)P(false);else {if($e.current){let D=$e.current.getBoundingClientRect(),j=window.innerHeight,re=120,H=j-D.bottom<re?D.top-re-8:D.bottom+8;w({top:H,left:D.left});}P(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:W,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ce.color}}),jsxRuntime.jsx("span",{children:Ke.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(ta,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>P(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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:Pe?"#0a0a0a":b.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":b.border}`,boxShadow:Pe?"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:nn.slice(0,18).map(D=>{let j=ce.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:re=>{re.preventDefault(),re.stopPropagation(),st("color",D.value),P(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:j?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),u.length>0||p?jsxRuntime.jsx(Lo,{selectedTags:ce.tags||[],availableTags:u,onChange:D=>st("tags",D),onCreateTag:p,theme:b,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:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Pe?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Pe?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:nt,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ce.isMilestone)if(_==="start")U(null);else {if(nt.current){let D=nt.current.getBoundingClientRect();q({top:D.bottom+8,left:Math.max(16,D.left-40)});}U("start"),L(ce.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...W,opacity:ce.isMilestone?.5:1,cursor:ce.isMilestone?"not-allowed":"pointer"},disabled:n||ce.isMilestone,children:ce.startDate?ce.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ce.isMilestone)if(_==="end")U(null);else {if(nt.current){let D=nt.current.getBoundingClientRect();q({top:D.bottom+8,left:Math.max(16,D.left-40)});}U("end"),L(ce.endDate||ce.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...W,opacity:ce.isMilestone?.5:1,cursor:ce.isMilestone?"not-allowed":"pointer"},disabled:n||ce.isMilestone,children:ce.endDate?ce.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(ta,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(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:`${K.top}px`,left:`${K.left}px`,zIndex:99999,backgroundColor:Pe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Pe?"#262626":b.border}`,boxShadow:Pe?"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 ${Pe?"#262626":b.border}`},children:[(()=>{let D=new Date,j=new Date(D);j.setDate(D.getDate()+1);let re=new Date(D);re.setDate(D.getDate()+7);let Ne=new Date(D);return Ne.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:j},{label:"Pr\xF3xima semana",date:re},{label:"2 semanas",date:Ne}].map((se,je)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:we=>we.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{_==="start"?(st("startDate",se.date),(!ce.endDate||se.date>ce.endDate)&&st("endDate",se.date),U("end")):(st("endDate",se.date),(!ce.startDate||se.date<ce.startDate)&&st("startDate",se.date),U(null));},children:se.label},je))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("startDate",void 0),st("endDate",void 0),U(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ae.getFullYear(),ae.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ae.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ae.getFullYear(),ae.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,j)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:D},j))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=ae.getFullYear(),j=ae.getMonth(),re=new Date(D,j,1).getDay(),Ne=new Date(D,j+1,0).getDate(),H=new Date,se=[];for(let we=re-1;we>=0;we--)se.push({day:new Date(D,j,-we).getDate(),date:new Date(D,j-1,new Date(D,j,-we).getDate()),isCurrentMonth:false});for(let we=1;we<=Ne;we++)se.push({day:we,date:new Date(D,j,we),isCurrentMonth:true});let je=42-se.length;for(let we=1;we<=je;we++)se.push({day:we,date:new Date(D,j+1,we),isCurrentMonth:false});return se.map((we,He)=>{let ze=we.date.toDateString()===H.toDateString(),Be=ce.startDate?.toDateString()===we.date.toDateString(),ct=ce.endDate?.toDateString()===we.date.toDateString(),ut=ce.startDate&&ce.endDate&&we.date>=ce.startDate&&we.date<=ce.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:we.isCurrentMonth?Be||ct?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Be?b.accent:ct?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ze&&!Be&&!ct?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{_==="start"?(st("startDate",we.date),ce.endDate&&we.date>ce.endDate&&st("endDate",we.date),U("end")):(st("endDate",we.date),ce.startDate&&we.date<ce.startDate&&st("startDate",we.date),U(null));},children:we.day},He)})})()})]})]})]})})]}),_e.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:_e.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ce.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Pe?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let j=D.currentTarget.getBoundingClientRect(),re=Math.round((D.clientX-j.left)/j.width*100/5)*5;st("progress",Math.max(0,Math.min(100,re)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ce.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Pe?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!z),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${z?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ce.effortMinutes?p2(ce.effortMinutes):"",onChange:D=>{let j=m2(D.target.value);st("effortMinutes",j);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),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:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ce.parentId||"",onChange:D=>st("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled: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:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ce.location||"",onChange:D=>st("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled: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:b.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ce.equipment||"",onChange:D=>st("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled: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:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?X.length>0&&`(${X.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(lo,{cardId:"pending",attachments:X.map((D,j)=>({id:`pending-${j}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>fe(j=>[...j,...D]),onDelete:D=>{let j=parseInt(D.replace("pending-",""),10);fe(re=>re.filter((Ne,H)=>H!==j));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(lo,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&X.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[X.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=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ce.isMilestone,onChange:D=>st("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ce.dependencies&&ce.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ce.dependencies.map(D=>{let j=r.find(re=>re.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:`${b.accent}20`,color:b.accent},children:[j?.name||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let re=(ce.dependencies||[]).filter(Ne=>Ne!==D);st("dependencies",re);},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:()=>{O(!Ge),ue("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),ue("");}}),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:Pe?"#0a0a0a":b.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":b.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:ee,onChange:D=>ue(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>ee===""||D.name.toLowerCase().includes(ee.toLowerCase())).map(D=>{let j=ce.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let re=ce.dependencies||[],Ne;j?Ne=re.filter(H=>H!==D.id):Ne=[...re,D.id],st("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:j?`${b.accent}10`:"transparent"},onMouseEnter:re=>{j||(re.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:re=>{re.currentTarget.style.backgroundColor=j?`${b.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:j?b.accent:"transparent",borderColor:j?b.accent:b.borderLight},children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.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:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Pe?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Pe?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=b.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=b.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 Om=`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 G=Q=>Q.map(he=>{if(he.id===R){let De=he.dependencies||[];if(!De.includes(P.id))return {...he,dependencies:[...De,P.id]}}return he.subtasks?{...he,subtasks:G(he.subtasks)}:he});Wr.current+=1,T(Q=>G(Q)),Te?.(P.id,R);},[Te,tu]),ru=react.useCallback((P,R)=>{let G=Q=>Q.map(he=>{if(he.id===P&&he.dependencies){let De=he.dependencies.filter(yt=>yt!==R);return {...he,dependencies:De}}return he.subtasks?{...he,subtasks:G(he.subtasks)}:he});Wr.current+=1,T(Q=>G(Q)),ve?.(P,R);},[ve]),{startDate:ho,endDate:hl}=react.useMemo(()=>{let P=te.filter(De=>De.startDate&&De.endDate);if(P.length===0){let De=new Date,yt=new Date(De);yt.setDate(yt.getDate()-30);let at=new Date(De);return at.setDate(at.getDate()+60),{startDate:yt,endDate:at}}let R=P.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),G=new Date(Math.min(...R.map(De=>De.getTime()))),Q=new Date(Math.max(...R.map(De=>De.getTime()))),he=Ke==="day"?7:Ke==="week"?14:30;return G.setDate(G.getDate()-he),Q.setDate(Q.getDate()+he),{startDate:G,endDate:Q}},[te,Ke]);react.useEffect(()=>{zt.current?.(ho,hl);},[ho,hl]);let Ef=react.useCallback(async()=>{if(!Vt.current||!dt.current||!Dt.current)return;await new Promise(Zo=>setTimeout(Zo,200));let P=Vt.current,R=dt.current,G=Zt.current||R.querySelector(".gantt-grid-scroll"),Q=Dt.current,he=G?.scrollTop||0,De=G?.scrollLeft||0,yt=Q.scrollTop,at=Q.scrollLeft,ua=P.style.overflow,ea=P.style.height,fa=G?.style.overflow||"",lr=Q.style.overflow,Er=R.style.overflow,Mo=P.style.width,Cn=Q.style.width;try{let Zo=G?.querySelector(".gantt-taskgrid-content"),ro=Q.querySelector("svg"),wl=ro?.getAttribute("height")?parseInt(ro.getAttribute("height"),10):ro?.getBoundingClientRect().height||0,Tn=Zo?.scrollHeight||G?.scrollHeight||600,Ks=Math.max(wl,Q.scrollHeight),os=ro?.getAttribute("width")?parseInt(ro.getAttribute("width"),10):ro?.getBoundingClientRect().width||Q.scrollWidth,Rf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,kl=Math.max(Tn,Ks,wl),iu=Rf+kl+50,lu=(G?.offsetWidth||R.offsetWidth||300)+os+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${iu}px`,P.style.width=`${lu}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${kl+50}px`),Q.style.overflow="visible",Q.style.height=`${kl+50}px`,Q.style.width=`${os+10}px`,await new Promise(qs=>setTimeout(qs,150));let $f=await htmlToImage.toPng(P,{backgroundColor:wt.bgPrimary,pixelRatio:2,width:lu,height:iu,skipFonts:!1,filter:qs=>{if(!(qs instanceof Element))return !0;let du=window.getComputedStyle(qs),cu=parseInt(du.zIndex,10);return !(!isNaN(cu)&&cu>=50||du.position==="fixed")}}),Cl=document.createElement("a");Cl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Cl.href=$f,Cl.click();}finally{P.style.overflow=ua,P.style.height=ea,P.style.width=Mo,R.style.overflow=Er,G&&(G.style.overflow=fa,G.style.height="",G.scrollTop=he,G.scrollLeft=De),Q.style.overflow=lr,Q.style.height="",Q.style.width=Cn,Q.scrollTop=yt,Q.scrollLeft=at;}u?.("png");},[wt,u]),Mf=react.useCallback(async()=>{await Ee.exportToPDF(te),u?.("pdf");},[te,u]),yl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});yl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let Pf=react.useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let P=new Date,R=he=>String(he).padStart(2,"0"),G=`${P.getFullYear()}-${R(P.getMonth()+1)}-${R(P.getDate())}_${R(P.getHours())}${R(P.getMinutes())}`,Q=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ee.exportToExcel(te,`${Q}_${G}.xlsx`,yl.current),u?.("excel");},[te,p,u,a.onExportExcel]),Ff=react.useCallback(()=>{let P=Ee.exportToCSV(te),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),u?.("csv");},[te,u]),Af=react.useCallback(()=>{let P=Ee.exportToJSON(te),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),u?.("json");},[te,u]),Lf=react.useCallback(()=>{Ee.exportToMSProject(te,"Gantt Project","project.xml"),u?.("msproject");},[te,u]),If=P=>{P.preventDefault(),Ft(true);},kn=react.useRef(false),[xl,ou]=react.useState(false),rs=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=Dt.current,R=dt.current?.querySelector(".gantt-grid-scroll");if(!P||!R)return;let G=()=>{if(kn.current)return;kn.current=true;let at=P.scrollTop;Ze(at),R.scrollTop=at,requestAnimationFrame(()=>{kn.current=false;});},Q=()=>{if(kn.current)return;kn.current=true;let at=R.scrollTop;Ze(at),P.scrollTop=at,requestAnimationFrame(()=>{kn.current=false;});},he=at=>{if(gt&&R){let ea=R.parentElement?.getBoundingClientRect()?.left||0,fa=at.clientX-ea,lr=200,Er=Ie+be,Mo=window.innerWidth*Je,Cn=Math.max(Er,Mo);fa>=lr&&fa<=Cn&&Mt(fa);}if(xl&&P){let ua=at.clientX-rs.current.x,ea=at.clientY-rs.current.y;P.scrollLeft=rs.current.scrollLeft-ua,P.scrollTop=rs.current.scrollTop-ea;}},De=()=>{Ft(false),ou(false);},yt=at=>{if(at.button!==0)return;let ua=at.target;ua.closest("[data-task-bar]")||ua.closest("[data-dependency-line]")||ua.closest("button")||ua.closest('[role="button"]')||ua.tagName==="rect"&&ua.getAttribute("data-clickable")==="true"||(ou(true),rs.current={x:at.clientX,y:at.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},at.preventDefault());};return P.addEventListener("scroll",G),R.addEventListener("scroll",Q),P.addEventListener("mousedown",yt),document.addEventListener("mousemove",he),document.addEventListener("mouseup",De),()=>{P.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),P.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",De);}},[gt,xl,Ie]),ia.current={startDate:ho,timeScale:Ke,zoom:j};let vl=a.onTodayVisibilityChange,nu=react.useRef(null);react.useEffect(()=>{if(!vl)return;let P=Dt.current;if(!P)return;let R=Ke==="day"?60:Ke==="week"?20:8,G=()=>{let De=(new Date().getTime()-ho.getTime())/(1e3*60*60*24)*R*j,yt=P.scrollLeft,at=yt+P.clientWidth,ua=De>=yt&&De<=at;nu.current!==ua&&(nu.current=ua,vl(ua));};return G(),P.addEventListener("scroll",G,{passive:true}),window.addEventListener("resize",G),()=>{P.removeEventListener("scroll",G),window.removeEventListener("resize",G);}},[vl,ho,Ke,j]);let su=react.useRef(false),Bf=react.useRef(null);return react.useLayoutEffect(()=>{if(su.current||te.length===0||!Dt.current)return;su.current=true,Bf.current=ho;let P=Dt.current,R=new Date,G=Ke==="day"?60:Ke==="week"?20:8,Q=(R.getTime()-ho.getTime())/(1e3*60*60*24),he=P.clientWidth,yt=Q*G*j-he/2;Q>=0&&he>0&&(P.scrollLeft=Math.max(0,yt));},[te.length,ho,Ke,j]),jsxRuntime.jsx($n.Provider,{value:E,children:jsxRuntime.jsx(El.Provider,{value:rr,children:jsxRuntime.jsxs("div",{ref:Vt,className:"flex flex-col h-full w-full",style:{backgroundColor:wt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...wt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${wt.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(Di,{theme:wt,timeScale:Ke,onTimeScaleChange:Fe,zoom:j,onZoomChange:re,currentTheme:Ve,onThemeChange:xe,rowDensity:W,onRowDensityChange:D,showThemeSelector:d,showCreateTaskButton:N&&ke?.canCreateTask!==false&&!ke?.canCreateSubtaskOnly,createTaskLabel:S,onCreateTask:M,taskFilter:lt,onTaskFilterChange:ne,hideCompleted:me,onHideCompletedChange:$,toolbarRightContent:A,wbsLevel:Ne,onWbsLevelChange:as,maxWbsDepth:Jt,viewMode:we,onViewModeChange:He,projectForecast:ae,onExportPNG:i?Ef:void 0,onExportPDF:i?Mf:void 0,onExportExcel:i?Pf:void 0,onExportCSV:i?Ff:void 0,onExportJSON:i?Af:void 0,onExportMSProject:i?Lf:void 0,showCriticalPath:Be,onShowCriticalPathChange:Et,showDependencies:ut,onShowDependenciesChange:Wt,highlightWeekends:pt,onHighlightWeekendsChange:St,showBaseline:ze,onShowBaselineChange:P=>{P&&we!=="oracle"&&He("oracle"),!P&&we==="oracle"&&He("execution");},onCopySnapshotLink:bt,hasDependencies:Qo})}),jsxRuntime.jsxs("div",{ref:dt,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Zt,className:"gantt-grid-scroll flex-shrink-0",style:{width:et,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Mi,{tasks:bo,theme:wt,rowHeight:ao,availableUsers:m,templates:Da,showCriticalPath:Be,onTaskClick:K,onTaskDblClick:eu,onTaskContextMenu:z,onTaskToggle:bf,scrollTop:Se,columns:ge,onToggleColumn:gf,onColumnResize:ff,onTaskUpdate:Eo,onTaskIndent:hf,onTaskOutdent:yf,onTaskMove:vf,onMultiTaskDelete:fl,onTaskDuplicate:wf,onTaskCreate:kf,onTaskRename:Cf,onCreateSubtask:bl,onOpenTaskModal:K?P=>K(P):void 0,onDeleteRequest:(P,R)=>I({taskId:P,taskName:R}),onTaskReparent:xf,scrollContainerRef:Zt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:wt.border,zIndex:15},onMouseDown:If}),jsxRuntime.jsx("div",{ref:Dt,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:xl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx($i,{tasks:bo,theme:wt,rowHeight:ao,timeScale:Ke,startDate:ho,endDate:hl,zoom:j,locale:v,templates:Da,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:K,onTaskDblClick:eu,onTaskContextMenu:Df,onTaskDateChange:Nf,onTaskProgressDrag:Tf,onDependencyCreate:au,onDependencyDelete:ru,showBaseline:ze,showCriticalPath:Be,showDependencies:ut,highlightWeekends:pt,canEditTask:ke?.canEditTask})})]}),Yt.task&&jsxRuntime.jsx(Hn,{isOpen:Yt.isOpen,x:Yt.x,y:Yt.y,theme:wt,onClose:()=>Qt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Yt.task;if(!P)return [];let R=Ee.findTaskById(te,P.id)||P,G=R.subtasks&&R.subtasks.length>0,Q=ke?.canCreateTask!==false,he=ke?.canDeleteTask!==false;if(G){let ea=[],fa=ke?.canDuplicateTask!==false;return Q&&ea.push({id:"addSubtask",label:E.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(R):bl(R.id);}}),fa&&ea.push({id:"duplicate",label:E.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):T(lr=>Ts(lr,[R.id]).tasks),Qt({isOpen:false,x:0,y:0,task:null});}}),he&&(ea.length>0&&ea.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ea.push({id:"delete",label:E.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),ea}let De=ke?.canUpdateTask!==false,yt=ke?.canDuplicateTask!==false,at=[];return De&&at.push({id:"edit",label:E.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{Ge?Ge(R):Oe(R);}}),Q&&at.push({id:"addSubtask",label:E.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(R):bl(R.id);}}),at.length>0&&De&&at.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),De&&(at.push({id:"markIncomplete",label:E.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{ee?ee(R):Eo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),at.push({id:"setInProgress",label:E.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{ue?ue(R):Eo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),at.push({id:"markComplete",label:E.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{Eo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(yt||De&&R.startDate&&R.endDate)&&at.length>0&&at.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),yt&&at.push({id:"duplicate",label:E.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):T(ea=>Ts(ea,[R.id]).tasks),Qt({isOpen:false,x:0,y:0,task:null});}}),De&&R.startDate&&R.endDate&&at.push({id:"split",label:E.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let ea=R.startDate.getTime(),fa=R.endDate.getTime(),lr=ea+(fa-ea)/2,Er=new Date(lr);Sf(R,Er);}}),he&&(at.length>0&&at.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),at.push({id:"delete",label:E.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),at})()}),jsxRuntime.jsx(vo,{task:Z,isOpen:!!Z,onClose:()=>Oe(null),onTaskUpdate:P=>{Z&&(Eo(Z.id,P),Oe(null));},theme:Ve==="light"?"light":"dark",locale:v==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ae&&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:()=>I(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:wt.bgSecondary,border:`1px solid ${wt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${wt.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:wt.textPrimary,fontFamily:"Inter, sans-serif"},children:[E.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:wt.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:wt.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:wt.textPrimary},children:['"',Ae.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:wt.bgPrimary,borderTop:`1px solid ${wt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:wt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=wt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{fl([Ae.taskId]),I(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"]})]})]})})}),h?.enabled&&jsxRuntime.jsx(zi,{tasks:te,theme:wt,config:h,onTasksUpdate:T,onTaskUpdate:Eo,onTaskCreate:P=>{T(R=>[...R,P]);},onTaskDelete:P=>{fl([P]);},onDependencyCreate:(P,R)=>{let G=Ee.findTaskById(te,P);G&&au(G,R);},onDependencyDelete:ru})]})})})});function p2(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 m2(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),d=parseInt(a[2],10);return l*60+d}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 Ud=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Wd=[{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 $m({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:d="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:p,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:f,defaultStatus:x}){let y=[...Ud,...i.filter(D=>!Ud.some(j=>j.id===D.id))],b=xt[d]||xt.dark,[h,v]=react.useState(false),[C,N]=react.useState(false),[S,M]=react.useState(false),[k,F]=react.useState(false),[A,w]=react.useState({top:0,left:0}),[_,U]=react.useState(null),[ae,L]=react.useState(new Date),[K,q]=react.useState({top:0,left:0}),[z,B]=react.useState(false),[X,fe]=react.useState([]),[Ge,O]=react.useState(false),[ee,ue]=react.useState(""),Te=react.useRef(null),ve=react.useRef(null),Ue=react.useRef(null),$e=react.useRef(null),nt=react.useRef(null),[ce,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[_e,ke]=react.useState({});react.useEffect(()=>{a?(Xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),fe([]));},[a,e,x]),react.useEffect(()=>{let D=j=>{Te.current&&!Te.current.contains(j.target)&&v(false),ve.current&&!ve.current.contains(j.target)&&N(false),Ue.current&&!Ue.current.contains(j.target)&&M(false),$e.current&&!$e.current.contains(j.target)&&F(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let bt=()=>{let D={};return ce.name.trim()||(D.name="El nombre es requerido"),ce.startDate&&ce.endDate&&ce.startDate>ce.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),ke(D),Object.keys(D).length===0},Bt=async D=>{if(D.preventDefault(),!!bt())try{let j=l==="create"&&X.length>0?{...ce,pendingFiles:X}:ce;await s(j),fe([]),t();}catch(j){console.error("Error submitting task:",j);}},st=(D,j)=>{Xe(re=>{let Ne={...re,[D]:j};if(D==="status"){let H=j;H==="todo"?Ne.progress=0:H==="in-progress"?(re.progress===0||re.progress===100)&&(Ne.progress=50):H==="completed"||H==="closed"?Ne.progress=100:(H==="in-review"||H==="review")&&(Ne.progress=75);}if(D==="progress"){let H=typeof j=="number"?j:parseInt(j,10);H===100&&re.status!=="completed"?Ne.status="completed":H>0&&H<100&&re.status==="todo"?Ne.status="in-progress":H===0&&re.status!=="todo"&&(Ne.status="todo");}return Ne}),_e[D]&&ke(re=>{let Ne={...re};return delete Ne[D],Ne});},Ve=y.find(D=>D.id===ce.status)??Ud[0],tt=Wd.find(D=>D.id===ce.priority)??Wd[1],Ke=nn.find(D=>D.value===ce.color)??nn[0],Fe=d==="dark",W={backgroundColor:Fe?"#1d1f27":b.bgSecondary,border:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Fe?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":d,style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Fe?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:Bt,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:ce.name,onChange:D=>st("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),_e.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),_e.name]}),jsxRuntime.jsx("textarea",{value:ce.description||"",onChange:D=>st("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:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.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:Te,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...W,borderColor:Ve.color,backgroundColor:`${Ve.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Ve.color}}),jsxRuntime.jsx("span",{style:{color:Ve.color},children:Ve.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Ve.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.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:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("status",D.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ce.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:ve,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:W,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:b.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:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Wd.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:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("priority",D.id),N(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,ce.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ue,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&M(!S),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:W,disabled:n,children:[ce.assignees&&ce.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ce.assignees.slice(0,3).map((D,j)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||b.accent,borderColor:b.bgSecondary},children:D.initials},j))}),ce.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",ce.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let j=ce.assignees?.some(re=>re.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:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{let re=j?(ce.assignees||[]).filter(Ne=>Ne.name!==D.name):[...ce.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:b.accent}];st("assignees",re);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children: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:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:$e,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)F(false);else {if($e.current){let D=$e.current.getBoundingClientRect(),j=window.innerHeight,re=120,H=j-D.bottom<re?D.top-re-8:D.bottom+8;w({top:H,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:W,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ce.color}}),jsxRuntime.jsx("span",{children:Ke.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(ta,{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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick: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:nn.slice(0,18).map(D=>{let j=ce.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:re=>{re.preventDefault(),re.stopPropagation(),st("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:j?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),u.length>0||p?jsxRuntime.jsx(Lo,{selectedTags:ce.tags||[],availableTags:u,onChange:D=>st("tags",D),onCreateTag:p,theme:b,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:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Fe?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Fe?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:nt,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ce.isMilestone)if(_==="start")U(null);else {if(nt.current){let D=nt.current.getBoundingClientRect();q({top:D.bottom+8,left:Math.max(16,D.left-40)});}U("start"),L(ce.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...W,opacity:ce.isMilestone?.5:1,cursor:ce.isMilestone?"not-allowed":"pointer"},disabled:n||ce.isMilestone,children:ce.startDate?ce.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ce.isMilestone)if(_==="end")U(null);else {if(nt.current){let D=nt.current.getBoundingClientRect();q({top:D.bottom+8,left:Math.max(16,D.left-40)});}U("end"),L(ce.endDate||ce.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...W,opacity:ce.isMilestone?.5:1,cursor:ce.isMilestone?"not-allowed":"pointer"},disabled:n||ce.isMilestone,children:ce.endDate?ce.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(ta,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(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:`${K.top}px`,left:`${K.left}px`,zIndex:99999,backgroundColor:Fe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Fe?"#262626":b.border}`},children:[(()=>{let D=new Date,j=new Date(D);j.setDate(D.getDate()+1);let re=new Date(D);re.setDate(D.getDate()+7);let Ne=new Date(D);return Ne.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:j},{label:"Pr\xF3xima semana",date:re},{label:"2 semanas",date:Ne}].map((se,je)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:we=>we.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{_==="start"?(st("startDate",se.date),(!ce.endDate||se.date>ce.endDate)&&st("endDate",se.date),U("end")):(st("endDate",se.date),(!ce.startDate||se.date<ce.startDate)&&st("startDate",se.date),U(null));},children:se.label},je))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("startDate",void 0),st("endDate",void 0),U(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ae.getFullYear(),ae.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ae.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ae.getFullYear(),ae.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,j)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:D},j))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=ae.getFullYear(),j=ae.getMonth(),re=new Date(D,j,1).getDay(),Ne=new Date(D,j+1,0).getDate(),H=new Date,se=[];for(let we=re-1;we>=0;we--)se.push({day:new Date(D,j,-we).getDate(),date:new Date(D,j-1,new Date(D,j,-we).getDate()),isCurrentMonth:false});for(let we=1;we<=Ne;we++)se.push({day:we,date:new Date(D,j,we),isCurrentMonth:true});let je=42-se.length;for(let we=1;we<=je;we++)se.push({day:we,date:new Date(D,j+1,we),isCurrentMonth:false});return se.map((we,He)=>{let ze=we.date.toDateString()===H.toDateString(),Be=ce.startDate?.toDateString()===we.date.toDateString(),ct=ce.endDate?.toDateString()===we.date.toDateString(),ut=ce.startDate&&ce.endDate&&we.date>=ce.startDate&&we.date<=ce.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:we.isCurrentMonth?Be||ct?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Be?b.accent:ct?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ze&&!Be&&!ct?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{_==="start"?(st("startDate",we.date),ce.endDate&&we.date>ce.endDate&&st("endDate",we.date),U("end")):(st("endDate",we.date),ce.startDate&&we.date<ce.startDate&&st("startDate",we.date),U(null));},children:we.day},He)})})()})]})]})]})})]}),_e.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:_e.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[ce.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Fe?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let j=D.currentTarget.getBoundingClientRect(),re=Math.round((D.clientX-j.left)/j.width*100/5)*5;st("progress",Math.max(0,Math.min(100,re)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ce.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Fe?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!z),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${z?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ce.effortMinutes?p2(ce.effortMinutes):"",onChange:D=>{let j=m2(D.target.value);st("effortMinutes",j);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),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:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ce.parentId||"",onChange:D=>st("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled: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:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ce.location||"",onChange:D=>st("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled: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:b.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ce.equipment||"",onChange:D=>st("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled: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:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?X.length>0&&`(${X.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(lo,{cardId:"pending",attachments:X.map((D,j)=>({id:`pending-${j}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>fe(j=>[...j,...D]),onDelete:D=>{let j=parseInt(D.replace("pending-",""),10);fe(re=>re.filter((Ne,H)=>H!==j));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(lo,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&X.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[X.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=b.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ce.isMilestone,onChange:D=>st("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ce.dependencies&&ce.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ce.dependencies.map(D=>{let j=r.find(re=>re.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:`${b.accent}20`,color:b.accent},children:[j?.name||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let re=(ce.dependencies||[]).filter(Ne=>Ne!==D);st("dependencies",re);},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:()=>{O(!Ge),ue("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),ue("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:ee,onChange:D=>ue(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>ee===""||D.name.toLowerCase().includes(ee.toLowerCase())).map(D=>{let j=ce.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let re=ce.dependencies||[],Ne;j?Ne=re.filter(H=>H!==D.id):Ne=[...re,D.id],st("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:j?`${b.accent}10`:"transparent"},onMouseEnter:re=>{j||(re.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:re=>{re.currentTarget.style.backgroundColor=j?`${b.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:j?b.accent:"transparent",borderColor:j?b.accent:b.borderLight},children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.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:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Fe?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=b.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=b.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:"#00E5CC",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 Om=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function Hm(e){return
410
410
  ${zm(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 zm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function No(e,t){let a=zm(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 d=l.name.toLowerCase();return n.every(i=>d.includes(i))})}function Vd(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 f=new Date(r),x=f.getDay(),y=g-x;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),f=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?f.setDate(f.getDate()+m):g==="week"||g==="semana"||g==="semanas"?f.setDate(f.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&f.setMonth(f.getMonth()+m),f}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,f=parseInt(l[3],10);return new Date(f,g,m)}let d={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=d[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(f,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let m=u[p[1].toLowerCase()],g=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,g)}return null}function Gd(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 jd(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 Um(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 Wm(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(),u=r[2].trim(),p=No(t,i),m=Vd(u);if(!p)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(m);return f.setDate(f.getDate()+g),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:m,endDate:f},message:`Moved "${p.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(),u=o[2].trim(),p=No(t,i),m=Gd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(p.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:g},message:`Extended "${p.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(),u=s[2].trim(),p=No(t,i),m=jd(u);return p?m===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:m},message:`Set "${p.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(),u=n[2].trim(),p=No(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),p=No(t,i),m=No(t,u);return p?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:p.id,dependencyTo:m.id,message:`Linked "${p.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),u=No(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Vm(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 g2(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 f2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Vi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let p=a.find(m=>m.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Vi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},l=n(e.startDate),d=n(e.endDate),i=e.metadata?.isMilestone===true||l&&d&&Math.abs(d.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:d,progress:e.progress||0,status:g2(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 Gm(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:f2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function jm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Vi(r,e,t))}var _d={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"}},Kd={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"}},Gi={en:_d,es:Kd};function qd(e){return Gi[e]||Gi.en}function ji(e,t){let a=qd(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 Yd=[{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 _m(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 Km({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=f=>{l.current&&!l.current.contains(f.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let d=_m(e),i=Yd[0],u=Yd.find(g=>g.value===d)??i,p=u.icon,m=g=>{switch(_m(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(p,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:c("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:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(p,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:c("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:Yd.map(g=>{let f=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:c("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",d===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:c("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Xd=[{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 Ym({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 u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let d=Xd.find(u=>u.value===e)??Xd[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:c("w-4 h-4",d.color)}),jsxRuntime.jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:c("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:c("w-4 h-4",d.color)}),jsxRuntime.jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:c("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:Xd.map(u=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),t(u.value),n(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:c("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function Fs(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 Qd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[d,i]=react.useState(""),u=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{let x=y=>{u.current&&!u.current.contains(y.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&p.current&&p.current.focus();},[n]);let m=t.filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),g=x=>e.some(y=>y.name===x),f=x=>{if(a){if(g(x.name))a(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Fs(x.name),color:x.color||Jd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,y]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:c("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,y)=>jsxRuntime.jsx("div",{className:c("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||Fs(x.name)},`${x.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),l(!n);},className:c("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:c("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:c("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,y)=>jsxRuntime.jsx("div",{className:c("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||Fs(x.name)},`${x.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:c("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:p,type:"text",value:d,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,y)=>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||Fs(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(h=>h.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}-${y}`))}),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 y=g(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?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:b=>{y||(b.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#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"}):Fs(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function tg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:d}){let[i,u]=react.useState(false),[p,m]=react.useState(o),[g,f]=react.useState(()=>{let w=o==="start"?e:t;if(w){let _=w instanceof Date?w:new Date(w);return new Date(_.getFullYear(),_.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),y=react.useRef(null),b=react.useRef(null),[h,v]=react.useState(null),C=e?e instanceof Date?e:new Date(e):null,N=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let w=_=>{let U=_.target;x.current&&x.current.contains(U)||b.current&&b.current.contains(U)||u(false);};return i&&document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[i]),react.useLayoutEffect(()=>{if(!i){v(null);return}let w=()=>{let _=y.current?.getBoundingClientRect();if(!_)return;let U=520,ae=360,L=window.innerHeight-_.bottom,K=L<ae&&_.top>L,q=K?_.top-4:_.bottom+4,z=Math.min(Math.max(_.left,8),window.innerWidth-U-8);v({top:q,left:z,flipUp:K});};return w(),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let S=w=>w?w.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):d||"-",M=react.useCallback(()=>{let w=g.getFullYear(),_=g.getMonth(),U=new Date(w,_,1),L=new Date(w,_+1,0).getDate(),K=U.getDay(),q=[],B=new Date(w,_,0).getDate();for(let fe=K-1;fe>=0;fe--)q.push({date:new Date(w,_-1,B-fe),isCurrentMonth:false});for(let fe=1;fe<=L;fe++)q.push({date:new Date(w,_,fe),isCurrentMonth:true});let X=42-q.length;for(let fe=1;fe<=X;fe++)q.push({date:new Date(w,_+1,fe),isCurrentMonth:false});return q},[g]),k=w=>{if(r)o==="start"?a(w,N||void 0):a(C||void 0,w),u(false);else if(p==="start"){let _=N&&w>N?w:N;a(w,_||void 0),m("end");}else {let _=C&&w<C?w:C;a(_||void 0,w),u(false);}},P=()=>{let w=new Date,_=new Date(w);_.setDate(w.getDate()+1);let U=new Date(w);U.setDate(w.getDate()+((6-w.getDay()+7)%7||7));let ae=new Date(w);ae.setDate(w.getDate()+((1-w.getDay()+7)%7||7));let L=new Date(w);L.setDate(w.getDate()+(6-w.getDay()+7)%7+7);let K=new Date(w);K.setDate(w.getDate()+14);let q=new Date(w);return q.setDate(w.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:_,display:_.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:U,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ae,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let w=r&&o==="start"?C:N;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:S(w)})]})}let A=r&&o==="start"?C:N;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,onClick:w=>{w.stopPropagation(),u(!i);let _=o==="start"?C:N;_&&f(new Date(_.getFullYear(),_.getMonth(),1));},className:c("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:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:S(A)})]}),i&&h&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:b,className:c("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:c("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[P().map((w,_)=>jsxRuntime.jsxs("button",{className:c("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:()=>k(w.date),children:[jsxRuntime.jsx("span",{children:w.label}),jsxRuntime.jsx("span",{className:c("text-xs",s?"text-white/30":"text-gray-400"),children:w.display})]},_)),jsxRuntime.jsx("div",{className:c("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,N||void 0):a(C||void 0,void 0):a(void 0,void 0),u(false);},className:c("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:c("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:p==="start"?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:c("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:()=>f(new Date),className:c("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:()=>f(new Date(g.getFullYear(),g.getMonth()-1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()+1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:c("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(w=>jsxRuntime.jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:w},w))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:M().map((w,_)=>{let U=w.date.toDateString()===new Date().toDateString(),ae=C?.toDateString()===w.date.toDateString(),L=N?.toDateString()===w.date.toDateString(),K=ae||L,q=!r&&C&&N&&w.date>=C&&w.date<=N;return jsxRuntime.jsx("button",{onClick:()=>k(new Date(w.date)),className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!w.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),w.isCurrentMonth&&(s?"text-white":"text-gray-900"),U&&"ring-2 ring-[#007BFF]",ae&&"bg-[#007BFF] text-white",L&&!ae&&"bg-[#7C3AED] text-white",q&&!K&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:w.date.getDate()},_)})})]})]}),document.body)]})}function Yi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let d=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(tg,{startDate:s==="start"?d:n||null,endDate:s==="end"?d:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function qn(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 Xi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,d]=react.useState(false),i=react.useRef(e),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let p=i.current??0,m=e,g=m-p,f=r/o;d(true);for(let x=1;x<=o;x++){let y=setTimeout(()=>{let b=x/o,h=1-Math.pow(1-b,3),v=Math.round(p+g*h);n(v),x===o&&(d(false),n(m));},f*x);u.current.push(y);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function ag(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),d=react.useRef(null),i=react.useRef(null),u=react.useCallback(g=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(g),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,y=Math.min(x/a*100,100);l(y);},16),d.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),p=react.useCallback(()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:p}}function og({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[d,i]=react.useState(""),u=react.useRef(null),{isFlashing:p,triggerFlash:m}=qn(),{displayValue:g,isAnimating:f}=Xi(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),S=C.clientX-N.left,M=Math.round(S/N.width*100),k=Math.max(0,Math.min(100,M));k!==e&&(t(k),s&&m());},y=react.useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&u.current&&(u.current.focus(),u.current.select());},[n]);let b=react.useCallback(()=>{l(false);let C=parseInt(d,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&m());}},[d,t,e,s,m]),h=react.useCallback(C=>{C.key==="Enter"&&b(),C.key==="Escape"&&l(false);},[b]),v=g??e;return jsxRuntime.jsxs("div",{className:c("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:c("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:c("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"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:u,value:d,onChange:C=>i(C.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:c("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:c("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:y,className:c("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]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function ig({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,d]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{d(e);},[e]);let u=()=>{l!==e&&t?.(l),n(false);},p=m=>{m.key==="Enter"?u():m.key==="Escape"&&(d(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:c("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=>d(m.target.value),onBlur:u,onKeyDown:p,onClick:m=>m.stopPropagation(),className:c("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:c("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 cg({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:d=true}){let[i,u]=react.useState(false),[p,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:f,triggerFlash:x}=qn(),{displayValue:y,isAnimating:b}=Xi(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let h=()=>{let C=parseFloat(p);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),d&&x());}u(false);},v=C=>{C.key==="Enter"?h():C.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:p,onChange:C=>m(C.target.value),onBlur:h,onKeyDown:v,onClick:C=>C.stopPropagation(),min:o,max:s,className:c("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(),u(true);},className:c("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",y===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:r})}function ug({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),d=react.useRef(null);return react.useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:c("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:c("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:c("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:c("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:c("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:c("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:c("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 mg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:d,startChange:i,cancelChange:u}=ag(t,{delay:s}),p=g=>{g.stopPropagation(),!r&&t&&(o?l?u():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:p,disabled:r||!t,className:c("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:`${d/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(),u();},className:c("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 bg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:c("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:c("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 Z2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function e1(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),d=parseInt(a[2],10);return l*60+d}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),d=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+d}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 Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:d="hours",hourlyRate:i=0,financialOverride:u}){let[p,m]=react.useState(false),[g,f]=react.useState(""),x=react.useRef(null),{isFlashing:y,triggerFlash:b}=qn(),h=d==="financial"&&(i>0||u!=null),v=u??(e?e/60*i:0),C=h&&(u!=null?u>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Z2(e,r);react.useEffect(()=>{p&&x.current&&(x.current.focus(),x.current.select());},[p]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),P=e%60;k>0&&P>0?f(`${k}h ${P}m`):k>0?f(`${k}h`):f(`${P}m`);}else f("");},[e,p]);let N=()=>{let k=e1(g);k!==e&&(t?.(k),n&&b()),m(false);},S=k=>{k.key==="Enter"?N():k.key==="Escape"&&m(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:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("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 M=h?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(M,{className:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:C})]}):p?jsxRuntime.jsx("input",{ref:x,type:"text",value:g,onChange:k=>f(k.target.value),onBlur:N,onKeyDown:S,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:c("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:k=>{k.stopPropagation(),m(true);},className:c("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",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(M,{className:c("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:C})]})}function vg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:c("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let d=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:d?"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:d?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:c("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 kg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:d=0}){let i=a==="es",u=l==="financial"&&d>0,p=q=>u?`$${Math.round(q*d).toLocaleString("en-US")}`:`${q}h`,[m,g]=react.useState(false),[f,x]=react.useState(false),[y,b]=react.useState(null),h=react.useRef(null),v=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,S=Math.round(v/60*10)/10,M=Math.round(C/60*10)/10,k=C>0?v/C*100:0,P=k>100?Math.round((v-C)/60*10)/10:0,A=k>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!y)return;let q=z=>{h.current&&!h.current.contains(z.target)&&(x(false),b(null));};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[f,y]);let w=q=>{if(q.stopPropagation(),r&&!o&&!s){b("log");return}if(r||o||s){x(z=>!z),b(null);return}n&&n(e);},_=q=>{x(false),b(q);},U=async(q,z)=>{y==="log"&&r&&q?r(e,q,z):y==="estimate"&&o?o(e,q):y==="quoted"&&s&&s(e,q),b(null);},ae=r||o||s||n,L=[{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(q=>q.show),K=y==="estimate"?C:y==="quoted"?N:void 0;return C===0&&v===0&&N===0?jsxRuntime.jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:q=>q.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:c("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&ae&&jsxRuntime.jsx("button",{onClick:w,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:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",q.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",q.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(q=>jsxRuntime.jsxs("button",{onClick:z=>{z.stopPropagation(),_(q.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:z=>{z.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:z=>{z.target.style.background="transparent";},children:[jsxRuntime.jsx(q.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),q.label]},q.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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(no,{mode:y,locale:a,isDark:t,currentValue:K||void 0,onSave:U,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:q=>q.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 q=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:q?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(S)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(M)]}),P>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(P)," ",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(k,100)}%`,backgroundColor:A,borderRadius:2,transition:"width 0.3s"}})})]}),ae&&jsxRuntime.jsx("button",{onClick:w,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:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",q.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",q.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(q=>jsxRuntime.jsxs("button",{onClick:z=>{z.stopPropagation(),_(q.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:z=>{z.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:z=>{z.target.style.background="transparent";},children:[jsxRuntime.jsx(q.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),q.label]},q.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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(no,{mode:y,locale:a,isDark:t,currentValue:K||void 0,onSave:U,onClose:()=>b(null)})})})})]})}function i1(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 l1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Cg({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:c(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:c(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 Tg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let u=i1(e);if(u.length===0)return null;let p=u.slice(0,3),m=u.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:p.map((g,f)=>jsxRuntime.jsx(Cg,{assignee:g,size:24,isDark:t},g.name+f))}),m>0&&jsxRuntime.jsxs("span",{className:c("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.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:c("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:c("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,d=!!n&&l>0,i=d?l1(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(Cg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:c("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),d&&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 d1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Dg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:c("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:c("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",d1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function T1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function N1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Ag({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:d,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:f,onTaskIndent:x,onTaskOutdent:y}){let b=react.useRef(null),h=r==="es"?Mg.es:Mg.en;if(react.useEffect(()=>{let M=P=>{b.current&&!b.current.contains(P.target)&&t();},k=P=>{P.key==="Escape"&&t();};return document.addEventListener("mousedown",M),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let M=[];return o&&M.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),M.push({id:"sep1",label:"",icon:null,separator:true}),l&&(M.push({id:"status",label:h.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.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:h.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:h.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),M.push({id:"priority",label:h.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.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:h.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:h.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:h.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&M.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.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:k.name.charAt(0).toUpperCase()}),onClick:()=>{let P=e.task.assignees||[],w=P.some(_=>_.name===k.name)?P.filter(_=>_.name!==k.name):[...P,{name:k.name,initials:T1(k.name),color:k.color||N1(k.name),avatar:k.avatarUrl}];l({...e.task,assignees:w}),t();}}))})),p&&M.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),m&&M.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&M.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),M.push({id:"sep2",label:"",icon:null,separator:true}),s&&M.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||y)&&(M.push({id:"sep3",label:"",icon:null,separator:true}),f&&(M.push({id:"move-up",label:h.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),M.push({id:"move-down",label:h.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&M.push({id:"indent",label:h.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&M.push({id:"outdent",label:h.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),n&&M.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),M},C=()=>{if(!e.columnId)return [];let M=[];return i&&(M.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),M.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),d&&e.columnId!=="name"&&(M.push({id:"sep-hide",label:"",icon:null,separator:true}),M.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{d(e.columnId),t();}})),M},N=e.type==="task"?v():C(),S={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:S,className:c("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(M=>M.separator?jsxRuntime.jsx("div",{className:c("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},M.id):M.submenu?jsxRuntime.jsx(D1,{item:M,isDark:a},M.id):jsxRuntime.jsxs("button",{onClick:M.onClick,className:c("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",M.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:c(M.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:M.icon}),M.label]},M.id))})}function D1({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:c("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:c("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:c("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:c("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 Mg={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 zg={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"})},V1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Wg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[d,i]=react.useState(""),[u,p]=react.useState(null),[m,g]=react.useState(null),f=react.useRef(null),x=l==="es"?Ug.es:Ug.en;react.useLayoutEffect(()=>{if(!e||!f.current)return;let M=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let _=k.getBoundingClientRect();g({top:_.bottom+4,right:window.innerWidth-_.right});}let P=f.current.getBoundingClientRect(),w=window.innerHeight-P.top-20;p(Math.max(300,w));};return requestAnimationFrame(M),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[e]),react.useEffect(()=>{if(!e)return;let M=setTimeout(()=>{let k=A=>{f.current&&!f.current.contains(A.target)&&t();},P=A=>{A.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",P),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",P);};},100);return ()=>{clearTimeout(M),f._cleanup&&f._cleanup();}},[e,t]);let y=react.useMemo(()=>{let M=new Set([...V1]);return a.forEach(k=>{k.type&&k.type!=="assignees"&&M.add(k.type);}),Array.from(M)},[a]);if(!e)return null;let b=M=>{let k=x.columns[M];if(k)return k;let P=a.find(A=>A.type===M);return P?.label?P.label:M},h=M=>{if(M==="name")return;let k=a.map(P=>P.id===M?{...P,visible:!P.visible}:P);o(k);},v=(M,k)=>{let P=a.find(w=>w.type===M&&(!k||w.customFieldId===k));if(P){h(P.id);return}let A={id:k||M,type:M,label:k?r.find(w=>w.id===k)?.name||M:b(M),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,A]);},C=y.filter(M=>M!=="assignees"&&b(M).toLowerCase().includes(d.toLowerCase())),N=r.filter(M=>M.name.toLowerCase().includes(d.toLowerCase())),S=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:f,style:{...u?{maxHeight:`${u}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:M=>{M.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",M.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent",M.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:d,onChange:M=>i(M.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:M=>{M&&M.style.setProperty("--focus-border",S);},onFocus:M=>{M.currentTarget.style.borderColor=S,M.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:M=>{M.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",M.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:M=>M.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(M=>{let k=a.find(w=>w.type===M&&!w.customFieldId),P=k?.visible??false,A=M==="name";return jsxRuntime.jsxs("button",{onClick:()=>{A||(k?h(k.id):v(M));},disabled:A,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:A?.4:1,cursor:A?"not-allowed":"pointer"},onMouseEnter:w=>{A||(w.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:w=>{w.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:P?S:"transparent",border:P?`1.5px solid ${S}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:P?`0 0 6px ${S}40`:"none"},children:P&&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:P?S:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:zg[M]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:P?500:400,color:P?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:b(M),children:b(M)})]},M)})})]}),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(M=>{let P=a.find(A=>A.customFieldId===M.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(M.type,M.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:A=>{A.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:A=>{A.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:P?S:"transparent",border:P?`1.5px solid ${S}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:P?`0 0 6px ${S}40`:"none"},children:P&&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:P?S:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:zg[M.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:P?500:400,color:P?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:M.name})]},M.id)})})]})]})]})}var Ug={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 Q1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function jg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,d]=react.useState("text"),[i,u]=react.useState([""]),p=o==="es"?Gg.es:Gg.en;react.useEffect(()=>{e&&(n(""),d("text"),u([""]));},[e]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let m=()=>{if(!s.trim())return;let y={name:s.trim(),type:l};l==="dropdown"&&(y.options=i.filter(b=>b.trim())),a(y),t();},g=()=>{u([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,u(h);},x=y=>{i.length>1&&u(i.filter((b,h)=>h!==y));};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:c("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:c("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:c("text-lg font-semibold",r?"text-white":"text-gray-900"),children:p.title}),jsxRuntime.jsx("button",{onClick:t,className:c("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:c("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:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:y=>n(y.target.value),placeholder:p.fieldNamePlaceholder,className:c("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:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Q1.map(y=>jsxRuntime.jsxs("button",{onClick:()=>d(y.type),className:c("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===y.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===y.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:y.icon}),jsxRuntime.jsx("span",{className:c("text-xs",l===y.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:p.types[y.type]})]},y.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${p.option} ${b+1}`,className:c("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(b),className:c("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"})})]},b)),jsxRuntime.jsxs("button",{onClick:g,className:c("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"}),p.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:c("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:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:p.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:c("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:p.create})]})]})]}):null}var Gg={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 qg={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 Yg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),d=react.useRef(null),i=react.useRef(0),u=s==="es"?qg.es:qg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||d.current&&!d.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",f);}},[n]);let p=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(f=>!f);},className:c("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"}),u.filters,m&&jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:c("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:c("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:c("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(g=>{let f=e===g.value&&!t,x=()=>g.value==="all"?f?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:c("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",f&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c(f?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:c("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:c("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:c("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:c("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:c("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:c("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:c("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Xg(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 _a(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:c("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:c("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:c("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:c("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 d=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,p=d-u,m=d>0?Math.round(p/d*100):0,g=d>0?Math.min(Math.round(u/d*100),120):0,f=u>d&&d>0,x=f?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:_a(d)})]}),(()=>{let y=e.totalEstimatedLabor??0,b=e.totalEstimatedEquipment??0,h=e.totalEstimatedTravel??0,v=b>0||h>0,C=v?n?`Desglose del estimado:
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function zm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function No(e,t){let a=zm(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 d=l.name.toLowerCase();return n.every(i=>d.includes(i))})}function Vd(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 f=new Date(r),x=f.getDay(),y=g-x;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),f=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?f.setDate(f.getDate()+m):g==="week"||g==="semana"||g==="semanas"?f.setDate(f.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&f.setMonth(f.getMonth()+m),f}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,f=parseInt(l[3],10);return new Date(f,g,m)}let d={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=d[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(f,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let m=u[p[1].toLowerCase()],g=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,g)}return null}function Gd(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 jd(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 Um(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 Wm(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(),u=r[2].trim(),p=No(t,i),m=Vd(u);if(!p)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(m);return f.setDate(f.getDate()+g),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:m,endDate:f},message:`Moved "${p.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(),u=o[2].trim(),p=No(t,i),m=Gd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(p.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:g},message:`Extended "${p.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(),u=s[2].trim(),p=No(t,i),m=jd(u);return p?m===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:m},message:`Set "${p.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(),u=n[2].trim(),p=No(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),p=No(t,i),m=No(t,u);return p?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:p.id,dependencyTo:m.id,message:`Linked "${p.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),u=No(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Vm(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 g2(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 f2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Vi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let p=a.find(m=>m.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Vi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},l=n(e.startDate),d=n(e.endDate),i=e.metadata?.isMilestone===true||l&&d&&Math.abs(d.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:d,progress:e.progress||0,status:g2(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 Gm(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:f2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function jm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Vi(r,e,t))}var _d={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"}},Kd={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"}},Gi={en:_d,es:Kd};function qd(e){return Gi[e]||Gi.en}function ji(e,t){let a=qd(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 Yd=[{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 _m(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 Km({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=f=>{l.current&&!l.current.contains(f.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let d=_m(e),i=Yd[0],u=Yd.find(g=>g.value===d)??i,p=u.icon,m=g=>{switch(_m(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(p,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:c("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:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(p,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:c("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:Yd.map(g=>{let f=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:c("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",d===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:c("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Xd=[{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 Ym({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 u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let d=Xd.find(u=>u.value===e)??Xd[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:c("w-4 h-4",d.color)}),jsxRuntime.jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:c("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:c("w-4 h-4",d.color)}),jsxRuntime.jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:c("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:Xd.map(u=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),t(u.value),n(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:c("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function Ps(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Jd(e){let t=["bg-[#00E5CC]","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-[#00E5CC]"}function Qd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[d,i]=react.useState(""),u=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{let x=y=>{u.current&&!u.current.contains(y.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&p.current&&p.current.focus();},[n]);let m=t.filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),g=x=>e.some(y=>y.name===x),f=x=>{if(a){if(g(x.name))a(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Ps(x.name),color:x.color||Jd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,y]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:c("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,y)=>jsxRuntime.jsx("div",{className:c("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||Ps(x.name)},`${x.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),l(!n);},className:c("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:c("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:c("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,y)=>jsxRuntime.jsx("div",{className:c("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||Ps(x.name)},`${x.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:c("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:p,type:"text",value:d,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,y)=>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||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ps(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(h=>h.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}-${y}`))}),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 y=g(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Ps(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function tg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:d}){let[i,u]=react.useState(false),[p,m]=react.useState(o),[g,f]=react.useState(()=>{let w=o==="start"?e:t;if(w){let _=w instanceof Date?w:new Date(w);return new Date(_.getFullYear(),_.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),y=react.useRef(null),b=react.useRef(null),[h,v]=react.useState(null),C=e?e instanceof Date?e:new Date(e):null,N=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let w=_=>{let U=_.target;x.current&&x.current.contains(U)||b.current&&b.current.contains(U)||u(false);};return i&&document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[i]),react.useLayoutEffect(()=>{if(!i){v(null);return}let w=()=>{let _=y.current?.getBoundingClientRect();if(!_)return;let U=520,ae=360,L=window.innerHeight-_.bottom,K=L<ae&&_.top>L,q=K?_.top-4:_.bottom+4,z=Math.min(Math.max(_.left,8),window.innerWidth-U-8);v({top:q,left:z,flipUp:K});};return w(),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let S=w=>w?w.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):d||"-",M=react.useCallback(()=>{let w=g.getFullYear(),_=g.getMonth(),U=new Date(w,_,1),L=new Date(w,_+1,0).getDate(),K=U.getDay(),q=[],B=new Date(w,_,0).getDate();for(let fe=K-1;fe>=0;fe--)q.push({date:new Date(w,_-1,B-fe),isCurrentMonth:false});for(let fe=1;fe<=L;fe++)q.push({date:new Date(w,_,fe),isCurrentMonth:true});let X=42-q.length;for(let fe=1;fe<=X;fe++)q.push({date:new Date(w,_+1,fe),isCurrentMonth:false});return q},[g]),k=w=>{if(r)o==="start"?a(w,N||void 0):a(C||void 0,w),u(false);else if(p==="start"){let _=N&&w>N?w:N;a(w,_||void 0),m("end");}else {let _=C&&w<C?w:C;a(_||void 0,w),u(false);}},F=()=>{let w=new Date,_=new Date(w);_.setDate(w.getDate()+1);let U=new Date(w);U.setDate(w.getDate()+((6-w.getDay()+7)%7||7));let ae=new Date(w);ae.setDate(w.getDate()+((1-w.getDay()+7)%7||7));let L=new Date(w);L.setDate(w.getDate()+(6-w.getDay()+7)%7+7);let K=new Date(w);K.setDate(w.getDate()+14);let q=new Date(w);return q.setDate(w.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:_,display:_.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:U,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ae,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let w=r&&o==="start"?C:N;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:S(w)})]})}let A=r&&o==="start"?C:N;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,onClick:w=>{w.stopPropagation(),u(!i);let _=o==="start"?C:N;_&&f(new Date(_.getFullYear(),_.getMonth(),1));},className:c("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:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:S(A)})]}),i&&h&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:b,className:c("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:c("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[F().map((w,_)=>jsxRuntime.jsxs("button",{className:c("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:()=>k(w.date),children:[jsxRuntime.jsx("span",{children:w.label}),jsxRuntime.jsx("span",{className:c("text-xs",s?"text-white/30":"text-gray-400"),children:w.display})]},_)),jsxRuntime.jsx("div",{className:c("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,N||void 0):a(C||void 0,void 0):a(void 0,void 0),u(false);},className:c("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:c("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:p==="start"?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:c("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:()=>f(new Date),className:c("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:()=>f(new Date(g.getFullYear(),g.getMonth()-1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()+1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:c("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(w=>jsxRuntime.jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:w},w))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:M().map((w,_)=>{let U=w.date.toDateString()===new Date().toDateString(),ae=C?.toDateString()===w.date.toDateString(),L=N?.toDateString()===w.date.toDateString(),K=ae||L,q=!r&&C&&N&&w.date>=C&&w.date<=N;return jsxRuntime.jsx("button",{onClick:()=>k(new Date(w.date)),className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!w.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),w.isCurrentMonth&&(s?"text-white":"text-gray-900"),U&&"ring-2 ring-[#00E5CC]",ae&&"bg-[#00E5CC] text-white",L&&!ae&&"bg-[#7C3AED] text-white",q&&!K&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:w.date.getDate()},_)})})]})]}),document.body)]})}function Yi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let d=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(tg,{startDate:s==="start"?d:n||null,endDate:s==="end"?d:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function qn(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 Xi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,d]=react.useState(false),i=react.useRef(e),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let p=i.current??0,m=e,g=m-p,f=r/o;d(true);for(let x=1;x<=o;x++){let y=setTimeout(()=>{let b=x/o,h=1-Math.pow(1-b,3),v=Math.round(p+g*h);n(v),x===o&&(d(false),n(m));},f*x);u.current.push(y);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function ag(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),d=react.useRef(null),i=react.useRef(null),u=react.useCallback(g=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(g),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,y=Math.min(x/a*100,100);l(y);},16),d.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),p=react.useCallback(()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:p}}function og({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[d,i]=react.useState(""),u=react.useRef(null),{isFlashing:p,triggerFlash:m}=qn(),{displayValue:g,isAnimating:f}=Xi(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),S=C.clientX-N.left,M=Math.round(S/N.width*100),k=Math.max(0,Math.min(100,M));k!==e&&(t(k),s&&m());},y=react.useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&u.current&&(u.current.focus(),u.current.select());},[n]);let b=react.useCallback(()=>{l(false);let C=parseInt(d,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&m());}},[d,t,e,s,m]),h=react.useCallback(C=>{C.key==="Enter"&&b(),C.key==="Escape"&&l(false);},[b]),v=g??e;return jsxRuntime.jsxs("div",{className:c("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:c("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:c("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"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:u,value:d,onChange:C=>i(C.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:c("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsxRuntime.jsx("span",{className:c("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:y,className:c("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]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function ig({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,d]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{d(e);},[e]);let u=()=>{l!==e&&t?.(l),n(false);},p=m=>{m.key==="Enter"?u():m.key==="Escape"&&(d(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:c("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=>d(m.target.value),onBlur:u,onKeyDown:p,onClick:m=>m.stopPropagation(),className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:c("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 cg({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:d=true}){let[i,u]=react.useState(false),[p,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:f,triggerFlash:x}=qn(),{displayValue:y,isAnimating:b}=Xi(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let h=()=>{let C=parseFloat(p);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),d&&x());}u(false);},v=C=>{C.key==="Enter"?h():C.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:p,onChange:C=>m(C.target.value),onBlur:h,onKeyDown:v,onClick:C=>C.stopPropagation(),min:o,max:s,className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:C=>{C.stopPropagation(),u(true);},className:c("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",y===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:r})}function ug({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),d=react.useRef(null);return react.useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:c("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:c("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:c("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:c("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:c("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:c("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:c("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-[#00E5CC]"})]},i))})]})}function mg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:d,startChange:i,cancelChange:u}=ag(t,{delay:s}),p=g=>{g.stopPropagation(),!r&&t&&(o?l?u():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:p,disabled:r||!t,className:c("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#00E5CC] border-[#00E5CC]":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:`${d/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(),u();},className:c("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 bg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:c("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:c("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 Z2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function e1(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),d=parseInt(a[2],10);return l*60+d}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),d=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+d}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 Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:d="hours",hourlyRate:i=0,financialOverride:u}){let[p,m]=react.useState(false),[g,f]=react.useState(""),x=react.useRef(null),{isFlashing:y,triggerFlash:b}=qn(),h=d==="financial"&&(i>0||u!=null),v=u??(e?e/60*i:0),C=h&&(u!=null?u>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Z2(e,r);react.useEffect(()=>{p&&x.current&&(x.current.focus(),x.current.select());},[p]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),F=e%60;k>0&&F>0?f(`${k}h ${F}m`):k>0?f(`${k}h`):f(`${F}m`);}else f("");},[e,p]);let N=()=>{let k=e1(g);k!==e&&(t?.(k),n&&b()),m(false);},S=k=>{k.key==="Enter"?N():k.key==="Escape"&&m(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:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("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 M=h?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(M,{className:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:C})]}):p?jsxRuntime.jsx("input",{ref:x,type:"text",value:g,onChange:k=>f(k.target.value),onBlur:N,onKeyDown:S,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),m(true);},className:c("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",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(M,{className:c("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:C})]})}function vg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:c("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let d=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:d?"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:d?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:c("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 kg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:d=0}){let i=a==="es",u=l==="financial"&&d>0,p=q=>u?`$${Math.round(q*d).toLocaleString("en-US")}`:`${q}h`,[m,g]=react.useState(false),[f,x]=react.useState(false),[y,b]=react.useState(null),h=react.useRef(null),v=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,S=Math.round(v/60*10)/10,M=Math.round(C/60*10)/10,k=C>0?v/C*100:0,F=k>100?Math.round((v-C)/60*10)/10:0,A=k>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!y)return;let q=z=>{h.current&&!h.current.contains(z.target)&&(x(false),b(null));};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[f,y]);let w=q=>{if(q.stopPropagation(),r&&!o&&!s){b("log");return}if(r||o||s){x(z=>!z),b(null);return}n&&n(e);},_=q=>{x(false),b(q);},U=async(q,z)=>{y==="log"&&r&&q?r(e,q,z):y==="estimate"&&o?o(e,q):y==="quoted"&&s&&s(e,q),b(null);},ae=r||o||s||n,L=[{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(q=>q.show),K=y==="estimate"?C:y==="quoted"?N:void 0;return C===0&&v===0&&N===0?jsxRuntime.jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:q=>q.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:c("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&ae&&jsxRuntime.jsx("button",{onClick:w,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:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",q.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",q.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(q=>jsxRuntime.jsxs("button",{onClick:z=>{z.stopPropagation(),_(q.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:z=>{z.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:z=>{z.target.style.background="transparent";},children:[jsxRuntime.jsx(q.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),q.label]},q.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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(no,{mode:y,locale:a,isDark:t,currentValue:K||void 0,onSave:U,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:q=>q.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 q=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:q?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(S)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(M)]}),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:["+",p(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(k,100)}%`,backgroundColor:A,borderRadius:2,transition:"width 0.3s"}})})]}),ae&&jsxRuntime.jsx("button",{onClick:w,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:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",q.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",q.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(q=>jsxRuntime.jsxs("button",{onClick:z=>{z.stopPropagation(),_(q.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:z=>{z.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:z=>{z.target.style.background="transparent";},children:[jsxRuntime.jsx(q.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),q.label]},q.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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(no,{mode:y,locale:a,isDark:t,currentValue:K||void 0,onSave:U,onClose:()=>b(null)})})})})]})}function i1(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 l1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Cg({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:c(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:c(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 Tg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let u=i1(e);if(u.length===0)return null;let p=u.slice(0,3),m=u.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:p.map((g,f)=>jsxRuntime.jsx(Cg,{assignee:g,size:24,isDark:t},g.name+f))}),m>0&&jsxRuntime.jsxs("span",{className:c("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.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:c("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:c("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,d=!!n&&l>0,i=d?l1(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(Cg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:c("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),d&&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 d1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Dg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:c("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:c("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",d1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function T1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function N1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Ag({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:d,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:f,onTaskIndent:x,onTaskOutdent:y}){let b=react.useRef(null),h=r==="es"?Mg.es:Mg.en;if(react.useEffect(()=>{let M=F=>{b.current&&!b.current.contains(F.target)&&t();},k=F=>{F.key==="Escape"&&t();};return document.addEventListener("mousedown",M),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let M=[];return o&&M.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),M.push({id:"sep1",label:"",icon:null,separator:true}),l&&(M.push({id:"status",label:h.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.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:h.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),M.push({id:"priority",label:h.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.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:h.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:h.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:h.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&M.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let F=e.task.assignees||[],w=F.some(_=>_.name===k.name)?F.filter(_=>_.name!==k.name):[...F,{name:k.name,initials:T1(k.name),color:k.color||N1(k.name),avatar:k.avatarUrl}];l({...e.task,assignees:w}),t();}}))})),p&&M.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),m&&M.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&M.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),M.push({id:"sep2",label:"",icon:null,separator:true}),s&&M.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||y)&&(M.push({id:"sep3",label:"",icon:null,separator:true}),f&&(M.push({id:"move-up",label:h.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),M.push({id:"move-down",label:h.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&M.push({id:"indent",label:h.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&M.push({id:"outdent",label:h.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),n&&M.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),M},C=()=>{if(!e.columnId)return [];let M=[];return i&&(M.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),M.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),d&&e.columnId!=="name"&&(M.push({id:"sep-hide",label:"",icon:null,separator:true}),M.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{d(e.columnId),t();}})),M},N=e.type==="task"?v():C(),S={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:S,className:c("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(M=>M.separator?jsxRuntime.jsx("div",{className:c("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},M.id):M.submenu?jsxRuntime.jsx(D1,{item:M,isDark:a},M.id):jsxRuntime.jsxs("button",{onClick:M.onClick,className:c("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",M.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:c(M.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:M.icon}),M.label]},M.id))})}function D1({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:c("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:c("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:c("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:c("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 Mg={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 zg={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"})},V1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Wg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[d,i]=react.useState(""),[u,p]=react.useState(null),[m,g]=react.useState(null),f=react.useRef(null),x=l==="es"?Ug.es:Ug.en;react.useLayoutEffect(()=>{if(!e||!f.current)return;let M=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let _=k.getBoundingClientRect();g({top:_.bottom+4,right:window.innerWidth-_.right});}let F=f.current.getBoundingClientRect(),w=window.innerHeight-F.top-20;p(Math.max(300,w));};return requestAnimationFrame(M),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[e]),react.useEffect(()=>{if(!e)return;let M=setTimeout(()=>{let k=A=>{f.current&&!f.current.contains(A.target)&&t();},F=A=>{A.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",F),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",F);};},100);return ()=>{clearTimeout(M),f._cleanup&&f._cleanup();}},[e,t]);let y=react.useMemo(()=>{let M=new Set([...V1]);return a.forEach(k=>{k.type&&k.type!=="assignees"&&M.add(k.type);}),Array.from(M)},[a]);if(!e)return null;let b=M=>{let k=x.columns[M];if(k)return k;let F=a.find(A=>A.type===M);return F?.label?F.label:M},h=M=>{if(M==="name")return;let k=a.map(F=>F.id===M?{...F,visible:!F.visible}:F);o(k);},v=(M,k)=>{let F=a.find(w=>w.type===M&&(!k||w.customFieldId===k));if(F){h(F.id);return}let A={id:k||M,type:M,label:k?r.find(w=>w.id===k)?.name||M:b(M),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,A]);},C=y.filter(M=>M!=="assignees"&&b(M).toLowerCase().includes(d.toLowerCase())),N=r.filter(M=>M.name.toLowerCase().includes(d.toLowerCase())),S=n?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:f,style:{...u?{maxHeight:`${u}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:M=>{M.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",M.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent",M.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:d,onChange:M=>i(M.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:M=>{M&&M.style.setProperty("--focus-border",S);},onFocus:M=>{M.currentTarget.style.borderColor=S,M.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:M=>{M.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",M.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:M=>M.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(M=>{let k=a.find(w=>w.type===M&&!w.customFieldId),F=k?.visible??false,A=M==="name";return jsxRuntime.jsxs("button",{onClick:()=>{A||(k?h(k.id):v(M));},disabled:A,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:A?.4:1,cursor:A?"not-allowed":"pointer"},onMouseEnter:w=>{A||(w.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:w=>{w.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?S:"transparent",border:F?`1.5px solid ${S}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${S}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?S:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:zg[M]}),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:b(M),children:b(M)})]},M)})})]}),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(M=>{let F=a.find(A=>A.customFieldId===M.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(M.type,M.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:A=>{A.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:A=>{A.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?S:"transparent",border:F?`1.5px solid ${S}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${S}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?S:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:zg[M.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:M.name})]},M.id)})})]})]})]})}var Ug={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 Q1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function jg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,d]=react.useState("text"),[i,u]=react.useState([""]),p=o==="es"?Gg.es:Gg.en;react.useEffect(()=>{e&&(n(""),d("text"),u([""]));},[e]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let m=()=>{if(!s.trim())return;let y={name:s.trim(),type:l};l==="dropdown"&&(y.options=i.filter(b=>b.trim())),a(y),t();},g=()=>{u([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,u(h);},x=y=>{i.length>1&&u(i.filter((b,h)=>h!==y));};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:c("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:c("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:c("text-lg font-semibold",r?"text-white":"text-gray-900"),children:p.title}),jsxRuntime.jsx("button",{onClick:t,className:c("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:c("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:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:y=>n(y.target.value),placeholder:p.fieldNamePlaceholder,className:c("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Q1.map(y=>jsxRuntime.jsxs("button",{onClick:()=>d(y.type),className:c("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:y.icon}),jsxRuntime.jsx("span",{className:c("text-xs",l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:p.types[y.type]})]},y.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${p.option} ${b+1}`,className:c("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(b),className:c("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"})})]},b)),jsxRuntime.jsxs("button",{onClick:g,className:c("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:c("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:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:p.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:p.create})]})]})]}):null}var Gg={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 qg={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 Yg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),d=react.useRef(null),i=react.useRef(0),u=s==="es"?qg.es:qg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||d.current&&!d.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",f);}},[n]);let p=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(f=>!f);},className:c("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-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),u.filters,m&&jsxRuntime.jsx("span",{className:c("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),n&&jsxRuntime.jsxs("div",{className:c("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:c("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:c("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(g=>{let f=e===g.value&&!t,x=()=>g.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:c("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",f&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:c(f?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:c("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},g.value)})}),jsxRuntime.jsx("div",{className:c("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:c("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:c("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:c("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function Xg(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 _a(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:c("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:c("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:c("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:c("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 d=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,p=d-u,m=d>0?Math.round(p/d*100):0,g=d>0?Math.min(Math.round(u/d*100),120):0,f=u>d&&d>0,x=f?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:_a(d)})]}),(()=>{let y=e.totalEstimatedLabor??0,b=e.totalEstimatedEquipment??0,h=e.totalEstimatedTravel??0,v=b>0||h>0,C=v?n?`Desglose del estimado:
414
414
  \xB7 Mano de obra: ${_a(y)}
415
415
  \xB7 Activos: ${_a(b)}
416
416
  \xB7 Vi\xE1ticos: ${_a(h)}
@@ -430,13 +430,13 @@ Total: ${_a(u)}`:`Executed breakdown:
430
430
  \xB7 Equipment: ${_a(b)}
431
431
  \xB7 Travel: ${_a(h)}
432
432
  \u2500\u2500\u2500
433
- Total: ${_a(u)}`:void 0;return jsxRuntime.jsxs("div",{className:c("flex items-center justify-between",v&&"cursor-help"),title:C,children:[jsxRuntime.jsxs("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:[n?"Ejecutado":"Executed",v&&jsxRuntime.jsx("span",{className:"ml-1 opacity-50",children:"\u24D8"})]}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono font-bold",f?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:_a(u)})]})})(),d>0&&jsxRuntime.jsx("div",{className:c("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:c("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[p>=0?`+${_a(p)} ${n?"Disp.":"Avail."}`:`${_a(Math.abs(p))} ${n?"P\xE9rdida":"Loss"}`,d>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let d=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(d/i*100),100):0,g=(i>0?d/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Xg(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Xg(i)})]}),i>0&&jsxRuntime.jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:c("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:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("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:c("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:c("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:c("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(d=>jsxRuntime.jsxs("button",{onClick:()=>s?.(d.id),className:c("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:c("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:d.name})]},d.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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 d=e.scheduleVarianceDays??0,i=d>0,u=d<0,p=e.scheduleVarianceLabel||(i?`+${d} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${d} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:c("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:c("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((d,i)=>{let u=d.utilizationPercent>=100?"#F87171":d.utilizationPercent>=80?"#FFD60A":d.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:d.name}),jsxRuntime.jsxs("span",{className:c("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[d.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:c("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(d.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${d.name}-${i}`)})})]})]})}var mw=[{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 n0(e,t=0,a=[]){let r=[];for(let o of e){let s=[...a,o.id];r.push({...o,level:t,hasChildren:(o.subtasks?.length||0)>0,parentPath:s}),o.subtasks?.length&&o.isExpanded!==false&&r.push(...n0(o.subtasks,t+1,s));}return r}function gw(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(),d=s.endDate.getTime()-n;if(d<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,d))/d*100;if(u<=0)continue;let p=(s.progress||0)/u;r+=p,o++;}return o>0?r/o:null}function Zn(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=Zn(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 Qn(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 fw({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:c("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:c("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 r0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let d=l.weight||0;d>0&&(t+=(l.progress||0)*d,a+=d,r+=1);}let o=r/e.length;if(a>=99&&o>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,d)=>l+(d.effort_minutes||0),0)>0){let l=0,d=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,d+=u;}return Math.round(l/d*10)/10}let n=e.reduce((l,d)=>l+(d.progress||0),0);return Math.round(n/e.length*10)/10}function fc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?fc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function s0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:d=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:m="#00E5CC"}){let{theme:g="dark",locale:f="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:C=true,enableContextMenu:N=true,showCreateTaskButton:S=false,onCreateTask:M,persistFilter:k=false,financialBlur:P,healthSidebar:A,lens:w="hours",hourlyRate:_=0,rateMap:U,aggregateParentHours:ae=false,showProjectTotals:L=false,totalsDollarOverride:K}=t,q=ji(f,x),z=g==="dark",B=E=>{if(!U||!E.assignees||E.assignees.length===0)return _;let le=0,ge=0;for(let Ie of E.assignees){let ot=Ie.id?U[Ie.id]:void 0;if(ot==null||ot<=0)continue;let be=typeof Ie.estimatedMinutes=="number"?Ie.estimatedMinutes:0;be>0&&(le+=ot*be,ge+=be);}if(ge>0)return le/ge;let Me=E.assignees.map(Ie=>Ie.id?U[Ie.id]:void 0).filter(Ie=>Ie!=null&&Ie>0);return Me.length===0?_:Me.reduce((Ie,ot)=>Ie+ot,0)/Me.length},X=E=>{let le=0,ge=0,Me=0,Ie=ot=>{for(let be of ot)if(be.subtasks&&be.subtasks.length>0){let Je={s:le,a:ge,q:Me};if(Ie(be.subtasks),le-Je.s+(ge-Je.a)+(Me-Je.q)===0){let dt=B(be);le+=(be.timeLoggedMinutes??0)/60*dt,ge+=(be.effortMinutes??0)/60*dt,Me+=(be.soldEffortMinutes??0)/60*dt;}}else {let Je=B(be);le+=(be.timeLoggedMinutes??0)/60*Je,ge+=(be.effortMinutes??0)/60*Je,Me+=(be.soldEffortMinutes??0)/60*Je;}};return E.subtasks&&Ie(E.subtasks),{dollarSpent:le,dollarAllocated:ge,dollarQuoted:Me}},fe=react.useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let E=localStorage.getItem(k);if(E){let le=JSON.parse(E);return {statusFilter:le.statusFilter||"all",hideCompleted:le.hideCompleted||!1}}}catch(E){console.error("Error loading persisted filter:",E);}return {statusFilter:"all",hideCompleted:false}},[k]),Ge=react.useMemo(()=>{function E(le){let ge=0,Me=0,Ie=0,ot=0,be=0,Je=0;for(let et of le)if(et.subtasks&&et.subtasks.length>0){let dt=E(et.subtasks);if(dt.spent+dt.allocated+dt.quoted>0)ge+=dt.spent,Me+=dt.allocated,Ie+=dt.quoted,ot+=dt.dollarSpent,be+=dt.dollarAllocated,Je+=dt.dollarQuoted;else {let Dt=et.timeLoggedMinutes??0,Vt=et.effortMinutes??0,ia=et.soldEffortMinutes??0;ge+=Dt,Me+=Vt,Ie+=ia;let wt=B(et);ot+=Dt/60*wt,be+=Vt/60*wt,Je+=ia/60*wt;}}else {let dt=et.timeLoggedMinutes??0,Zt=et.effortMinutes??0,Dt=et.soldEffortMinutes??0;ge+=dt,Me+=Zt,Ie+=Dt;let Vt=B(et);ot+=dt/60*Vt,be+=Zt/60*Vt,Je+=Dt/60*Vt;}return {spent:ge,allocated:Me,quoted:Ie,dollarSpent:ot,dollarAllocated:be,dollarQuoted:Je}}return E(e)},[e]),O=react.useMemo(()=>{let E=new Map;function le(ge){let Me=0;for(let Ie of ge)if(Ie.subtasks&&Ie.subtasks.length>0){let ot=le(Ie.subtasks);E.set(Ie.id,ot),Me+=ot;}else Me+=Ie.weight||0;return Me}return le(e),E},[e]),ee=react.useMemo(()=>!A?.enabled||!A.data?A:{...A,data:{...A.data,totalHoursSpentMinutes:Ge.spent,totalHoursAllocatedMinutes:Ge.allocated}},[A,Ge]),[ue,Te]=react.useState(true),[ve,Ue]=react.useState(null),[$e,nt]=react.useState("position"),[ce,Xe]=react.useState("asc"),[_e,ke]=react.useState(""),[bt,Bt]=react.useState(()=>fe().statusFilter),[st,Ve]=react.useState(()=>fe().hideCompleted),[tt,Ke]=react.useState(h||mw),[Pe,W]=react.useState(false),[D,j]=react.useState(false),[re,Ne]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[H,se]=react.useState(null),[je,we]=react.useState(false),[He,ze]=react.useState(null),[Be,ct]=react.useState(null),[ut,ht]=react.useState(null),pt=react.useRef(0),Ct=react.useRef(false),Et=!!(a.onTaskMove||a.onTaskReparent),Wt=react.useCallback((E,le)=>{Et&&(le.preventDefault(),pt.current=le.clientY,se(E),Ct.current=false,we(false),ht({x:le.clientX,y:le.clientY}));},[Et]),St=react.useCallback(E=>{if(!H||(Math.abs(E.clientY-pt.current)>5&&!Ct.current&&(Ct.current=true,we(true)),ht({x:E.clientX,y:E.clientY}),!Ct.current))return;let ge=document.querySelectorAll("[data-listview-row]"),Me=null,Ie=null;ge.forEach(ot=>{let be=ot.getBoundingClientRect(),Je=ot.getAttribute("data-listview-row");if(Je&&Je!==H&&E.clientY>=be.top&&E.clientY<=be.bottom){Me=Je;let et=E.clientY-be.top,dt=be.height;Ie=et<dt*.25?"above":et>dt*.75?"below":"child";}}),ze(Me),ct(Ie);},[H]),zt=react.useCallback(()=>{if(Ct.current&&H&&He&&Be){if(Be==="child"&&a.onTaskReparent)a.onTaskReparent(H,He);else if(Be==="above"||Be==="below"){let E=(Me,Ie,ot=null)=>{for(let be of Me){if(be.id===Ie)return ot;if(be.subtasks){let Je=E(be.subtasks,Ie,be.id);if(Je!==void 0)return Je}}},le=E(e,H,null),ge=E(e,He,null);if(a.onTaskReparent){let Me=(dt,Zt)=>{if(Zt===null)return dt;for(let Dt of dt){if(Dt.id===Zt)return Dt.subtasks||[];if(Dt.subtasks){let Vt=Me(Dt.subtasks,Zt);if(Vt.length>0||Dt.subtasks.some(ia=>ia.id===Zt))return Vt}}return []},Ie=Me(e,ge??null),ot=Ie.findIndex(dt=>dt.id===He),be=le===ge,Je=be?Ie.findIndex(dt=>dt.id===H):-1,et=Be==="below"?ot+1:ot;be&&Je!==-1&&Je<ot&&(et-=1),a.onTaskReparent(H,ge??null,Math.max(0,et));}}}se(null),ze(null),ct(null),ht(null),Ct.current=false,we(false);},[H,He,Be,e,a]);react.useEffect(()=>{if(H)return document.addEventListener("mousemove",St),document.addEventListener("mouseup",zt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",zt),document.body.style.cursor="",document.body.style.userSelect="";}},[H,St,zt]);let[it,jt]=react.useState("all"),[mt,lt]=react.useState(false),ne=react.useRef(null),me=react.useRef(null),$=react.useMemo(()=>{let E=0;function le(ge,Me){for(let Ie of ge)Me>E&&(E=Me),Ie.subtasks?.length&&le(Ie.subtasks,Me+1);}return le(e,1),E},[e]);react.useEffect(()=>{if(!mt)return;let E=le=>{ne.current?.contains(le.target)||me.current?.contains(le.target)||lt(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[mt]),react.useEffect(()=>{if(it==="all"){let ge=function(Me){for(let Ie of Me)Ie.subtasks?.length&&(Ie.isExpanded===false&&a.onTaskToggleExpand?.(Ie.id),ge(Ie.subtasks));};ge(e);}else {let ge=function(Me,Ie){for(let ot of Me)if(ot.subtasks?.length){let be=Ie<it,Je=ot.isExpanded!==false;be!==Je&&a.onTaskToggleExpand?.(ot.id),ge(ot.subtasks,Ie+1);}};ge(e,1);}},[it]);let[Y,Se]=react.useState(null),[Ze,gt]=react.useState(0),[Pt,Rt]=react.useState(0),Mt=react.useRef(null),[Yt,Qt]=react.useState(null),[Z,Oe]=react.useState(null);react.useEffect(()=>{h&&Ke(E=>{if(E.length===h.length){let le=true;for(let ge=0;ge<E.length;ge++){let Me=E[ge],Ie=h[ge];if(!Me||!Ie||Me.id!==Ie.id||Me.visible!==Ie.visible||Me.width!==Ie.width||Me.label!==Ie.label){le=false;break}}if(le)return E}return h});},[h]),react.useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:bt,hideCompleted:st}));}catch(E){console.error("Error persisting filter state:",E);}},[k,bt,st]);let Ae=react.useMemo(()=>{let E=new Set;function le(ge){for(let Me of ge)Me.subtasks?.length&&(Me.isExpanded!==false&&E.add(Me.id),le(Me.subtasks));}return le(e),E},[e]),I=react.useMemo(()=>tt.filter(E=>E.visible),[tt]),xe=react.useCallback(E=>{a.onTaskToggleExpand?.(E);},[a]),te=react.useCallback(E=>{$e===E?Xe(le=>le==="asc"?"desc":"asc"):(nt(E),Xe("asc")),a.onSortChange?.({column:E,direction:ce==="asc"?"desc":"asc"});},[$e,ce,a]),T=react.useCallback(E=>{Ke(E),a.onColumnsChange?.(E);},[a]),J=react.useCallback(E=>{let le=tt.map(ge=>ge.id===E?{...ge,visible:false}:ge);T(le);},[tt,T]),Ce=react.useCallback((E,le)=>{nt(E),Xe(le);},[]),Le=react.useCallback((E,le,ge)=>{N&&(E.preventDefault(),Ne({isOpen:true,x:E.clientX,y:E.clientY,type:le?"task":"header",task:le,columnId:ge}));},[N]),$t=react.useCallback(()=>{Ne(E=>({...E,isOpen:false}));},[]),Nt=react.useCallback((E,le)=>{if(!C)return;E.preventDefault(),E.stopPropagation();let ge=tt.find(Me=>Me.id===le);ge&&(Se(le),gt(E.clientX),Rt(ge.width));},[tt,C]);react.useEffect(()=>{if(!Y)return;let E=tt,le=Me=>{let Ie=Me.clientX-Ze,ot=Math.max(50,Pt+Ie);E=E.map(be=>be.id===Y?{...be,width:ot}:be),Ke(E);},ge=()=>{a.onColumnsChange?.(E),Se(null);};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",ge),()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ge);}},[Y,Ze,Pt,a]);let Jt=react.useCallback((E,le)=>{if(le==="name"){E.preventDefault();return}Qt(le),E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",le),E.currentTarget instanceof HTMLElement&&(E.currentTarget.style.opacity="0.5");},[]),Ua=react.useCallback(E=>{E.currentTarget instanceof HTMLElement&&(E.currentTarget.style.opacity="1"),Qt(null),Oe(null);},[]),ya=react.useCallback((E,le)=>{E.preventDefault(),le!=="name"&&(E.dataTransfer.dropEffect="move",Oe(le));},[]),Ma=react.useCallback(()=>{Oe(null);},[]),Sr=react.useCallback((E,le)=>{if(E.preventDefault(),!Yt||Yt===le||le==="name")return;let ge=[...tt],Me=ge.findIndex(be=>be.id===Yt),Ie=ge.findIndex(be=>be.id===le);if(Me===-1||Ie===-1)return;let ot=ge.splice(Me,1);ot[0]&&(ge.splice(Ie,0,ot[0]),T(ge),Qt(null),Oe(null));},[Yt,tt,T]),Wr=react.useCallback(async E=>{if(a.onCreateCustomField){let le={...E,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(le);}j(false);},[a]),wn=react.useCallback(E=>E.progress===100||E.status==="completed"?"completed":E.progress&&E.progress>0||E.status==="in-progress"?"in-progress":"todo",[]),Vr=react.useMemo(()=>{let E=n0(e);if(_e.trim()){let le=_e.toLowerCase();E=E.filter(ge=>ge.name.toLowerCase().includes(le));}if(bt!=="all"){let le=new Set(E.filter(ge=>wn(ge)===bt).flatMap(ge=>ge.parentPath));E=E.filter(ge=>le.has(ge.id));}if(st){let le=new Set(E.filter(ge=>wn(ge)!=="completed").flatMap(ge=>ge.parentPath));E=E.filter(ge=>le.has(ge.id));}return E.sort((le,ge)=>{let Me,Ie;switch($e){case "name":Me=le.name.toLowerCase(),Ie=ge.name.toLowerCase();break;case "startDate":Me=le.startDate?.getTime()||0,Ie=ge.startDate?.getTime()||0;break;case "endDate":Me=le.endDate?.getTime()||0,Ie=ge.endDate?.getTime()||0;break;case "progress":Me=le.progress||0,Ie=ge.progress||0;break;case "status":Me=le.status||"todo",Ie=ge.status||"todo";break;case "priority":let ot={urgent:0,high:1,medium:2,low:3,none:4};Me=ot[le.priority]??4,Ie=ot[ge.priority]??4;break;case "position":return 0;default:return 0}return Me<Ie?ce==="asc"?-1:1:Me>Ie?ce==="asc"?1:-1:0}),E},[e,_e,bt,st,$e,ce,wn]),as=react.useCallback((E,le)=>{let ge=ot=>{a.onTaskUpdate?.({...E,...ot});},Me=ot=>ot?E.customFields?.find(Je=>Je.fieldId===ot)?.value:void 0,Ie=(ot,be)=>{if(!ot)return;let et=[...E.customFields||[]],dt=et.findIndex(Zt=>Zt.fieldId===ot);dt>=0?et[dt]={fieldId:ot,value:be}:et.push({fieldId:ot,value:be}),ge({customFields:et});};switch(le.type){case "name":return null;case "status":return jsxRuntime.jsx(Km,{value:E.status||(E.progress===100?"completed":E.progress&&E.progress>0?"in-progress":"todo"),onChange:be=>{ge({status:be,progress:be==="completed"?100:be==="in-progress"?50:0});},isDark:z,locale:f,translations:q.status});case "priority":return jsxRuntime.jsx(Ym,{value:E.priority,onChange:be=>ge({priority:be}),isDark:z,locale:f});case "assignees":{let be=E.hasChildren,Je=E.assignees||[];if(be&&E.subtasks?.length){let et=new Map,dt=Zt=>{(Zt||[]).forEach(Dt=>{(Dt.assignees||[]).forEach(Vt=>{et.has(Vt.name)||et.set(Vt.name,Vt);}),Dt.subtasks?.length&&dt(Dt.subtasks);});};dt(E.subtasks),Je=Array.from(et.values());}else be&&(Je=[]);return jsxRuntime.jsx(Qd,{value:Je,availableUsers:l,onChange:et=>ge({assignees:et}),isDark:z,locale:f,disabled:be})}case "startDate":return jsxRuntime.jsx(Yi,{value:E.startDate,onChange:be=>ge({startDate:be}),isDark:z,locale:f,dateField:"start",startDate:E.startDate,endDate:E.endDate});case "endDate":return jsxRuntime.jsx(Yi,{value:E.endDate,onChange:be=>ge({endDate:be}),isDark:z,locale:f,dateField:"end",startDate:E.startDate,endDate:E.endDate});case "progress":{let be=!!(E.subtasks&&E.subtasks.length>0),Je=be?r0(fc(E.subtasks||[])):E.progress||0;return jsxRuntime.jsx(og,{value:Je,onChange:be?void 0:et=>{let dt=et===100?"completed":et>0?"in-progress":"todo";ge({progress:et,status:dt});},isDark:z,disabled:be})}case "tags":return jsxRuntime.jsx(bg,{value:E.tags||[],isDark:z});case "text":return jsxRuntime.jsx(ig,{value:Me(le.customFieldId)||"",onChange:be=>Ie(le.customFieldId,be),isDark:z});case "number":return jsxRuntime.jsx(cg,{value:Me(le.customFieldId)||0,onChange:be=>Ie(le.customFieldId,be),isDark:z});case "date":let ot=Me(le.customFieldId);return jsxRuntime.jsx(Yi,{value:ot?new Date(ot):void 0,onChange:be=>Ie(le.customFieldId,be),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(ug,{value:Me(le.customFieldId)||"",options:le.options||[],onChange:be=>Ie(le.customFieldId,be),isDark:z});case "checkbox":return jsxRuntime.jsx(mg,{value:Me(le.customFieldId)||false,onChange:be=>Ie(le.customFieldId,be),isDark:z});case "estimatedTime":{let be=E.status==="completed"||E.progress===100;return jsxRuntime.jsx(Dr,{value:E.estimatedTime,onChange:Je=>ge({estimatedTime:Je}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E)})}case "quotedTime":{let be=E.status==="completed"||E.progress===100,Je=P?.enabled&&(!P.columns||P.columns.includes("quotedTime"));return jsxRuntime.jsx(Dr,{value:E.quotedTime,onChange:et=>ge({quotedTime:et}),isDark:z,locale:f,disabled:be,isBlurred:Je,lens:w,hourlyRate:B(E)})}case "elapsedTime":{let be=E.status==="completed"||E.progress===100,Je=E.executedDollarsCanonical;return jsxRuntime.jsx(Dr,{value:E.elapsedTime,onChange:et=>ge({elapsedTime:et}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E),financialOverride:Je})}case "effortMinutes":{if(ae&&E.subtasks&&E.subtasks.length>0){let{allocated:Zt}=Zn(E);if(w==="financial"){let Dt=X(E),Vt=Math.round(Dt.dollarAllocated),ia=Math.round(Dt.dollarQuoted),wt=ia-Vt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Vt>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Vt.toLocaleString("es-CO")]}):null,wt!==0&&Vt>0&&ia>0&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",wt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[wt>0?"+":"",Math.abs(wt)>=1e3?`$${(wt/1e3).toFixed(1)}K`:`$${wt}`]})]})}return jsxRuntime.jsx(Dr,{value:Zt>0?Zt:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:_})}let be=E.status==="completed"||E.progress===100,Je=E.effortMinutes||0,et=E.soldEffortMinutes||0,dt=B(E);if(w==="financial"&&dt&&Je>0&&et>0){let Zt=Math.round(Je/60*dt),Vt=Math.round(et/60*dt)-Zt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Dr,{value:Je,onChange:ia=>ge({effortMinutes:ia}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E)}),Vt!==0&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Vt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Vt>0?"+":"",Math.abs(Vt)>=1e3?`$${(Vt/1e3).toFixed(1)}K`:`$${Vt}`]})]})}return jsxRuntime.jsx(Dr,{value:Je,onChange:Zt=>ge({effortMinutes:Zt}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E)})}case "timeLoggedMinutes":{let be=E.executedDollarsCanonical;if(ae&&E.subtasks&&E.subtasks.length>0){let{spent:et}=Zn(E);return jsxRuntime.jsx(Dr,{value:et>0?et:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E),financialOverride:be})}let Je=E.status==="completed"||E.progress===100;return jsxRuntime.jsx(Dr,{value:E.timeLoggedMinutes,onChange:a.onLogTime?et=>{a.onLogTime?.(E,et);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Je,lens:w,hourlyRate:B(E),financialOverride:be})}case "soldEffortMinutes":{if(ae&&E.subtasks&&E.subtasks.length>0){let{quoted:et}=Zn(E),dt=P?.enabled&&(!P.columns||P.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:et>0?et:void 0,isDark:z,locale:f,disabled:true,isBlurred:dt,lens:w,hourlyRate:B(E)})}let be=E.status==="completed"||E.progress===100,Je=P?.enabled&&(!P.columns||P.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:E.soldEffortMinutes,onChange:et=>ge({soldEffortMinutes:et}),isDark:z,locale:f,disabled:be,isBlurred:Je,lens:w,hourlyRate:B(E)})}case "scheduleVariance":{let be=E.effortMinutes||0,Je=E.soldEffortMinutes||0,et=E.timeLoggedMinutes||0,dt=be>0||Je>0||et>0;return jsxRuntime.jsx(vg,{startDate:E.startDate,endDate:E.endDate,scheduleVariance:E.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:dt})}case "hoursBar":{if(ae&&E.hasChildren){let{spent:be,allocated:Je,quoted:et}=Zn(E),dt=be>Je&&Je>0;return jsxRuntime.jsxs("span",{className:c("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:c("font-bold",dt?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:Qn(be)}),Je>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:Qn(Je)})]}),et>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:Qn(et)})]})]})}return jsxRuntime.jsx(kg,{task:E,isDark:z,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:B(E)})}case "teamLoad":return E.hasChildren||E.subtasks&&E.subtasks.length>0?jsxRuntime.jsx(Tg,{task:E,isDark:z,locale:f}):jsxRuntime.jsx(Qd,{value:E.assignees||[],availableUsers:l,onChange:Je=>{a.onTaskUpdate?.({...E,assignees:Je});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(Dg,{blockers:E.blockers,isDark:z,locale:f});case "weight":{let be=O.get(E.id);if(be!==void 0)return jsxRuntime.jsx("span",{className:c("text-xs font-mono",be>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:be>0?`${Number(be.toFixed(2))}%`:"\u2014"});let Je=E.weight||0;return jsxRuntime.jsx(fw,{value:Je,onChange:et=>ge({weight:et}),isDark:z})}default:return jsxRuntime.jsx("span",{className:c("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[a,z,f,l,q,ae,O]),So=react.useCallback(E=>{let ge={name:q.columns.name,status:q.columns.status,priority:q.columns.priority,assignees:q.columns.assignees,startDate:q.columns.startDate,endDate:q.columns.endDate,progress:q.columns.progress,tags:q.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:q.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:q.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:q.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:q.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:q.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:q.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:q.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:q.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:q.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:q.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:q.columns.weight||(f==="es"?"Peso":"Weight")}[E.type]||E.label;return typeof ge=="string"?ge:String(ge||E.type)},[q,f]),Jo=react.useMemo(()=>{let ge=I.reduce((Ie,ot)=>Ie+ot.width,0)+(v?48:0),Me={};for(let Ie of I)Me[Ie.id]=`${Ie.width/ge*100}%`;return Me},[I,v]);return r?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",z?"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:c("text-sm",z?"text-white/60":"text-gray-600"),children:[q.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",z?"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:c("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",z?"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:c("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:q.empty.noTasks}),jsxRuntime.jsx("p",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:q.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Mt,className:c(z?"bg-[#0D0D0D]":"bg-white",Y&&"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:c("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:[Vr.length," ",q.pagination.tasks]}),y&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:c("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:_e,onChange:E=>ke(E.target.value),placeholder:q.toolbar.searchPlaceholder,className:c("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",z?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&$>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:ne,onClick:()=>lt(!mt),className:c("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?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"}),it==="all"?f==="es"?"Todos":"All":`L${it}`]}),mt&&jsxRuntime.jsx("div",{ref:me,className:c("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min($,5)},(E,le)=>({value:le+1,label:`L${le+1}`}))].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{jt(E.value),lt(false);},className:c("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?it===E.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":it===E.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:E.label}),it===E.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(E.value)))})]}),jsxRuntime.jsx(Yg,{value:bt,hideCompleted:st,onChange:Bt,onHideCompletedChange:Ve,isDark:z,locale:f}),ee?.enabled&&ee.data&&!ue&&jsxRuntime.jsx("button",{onClick:()=>Te(true),className:c("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,S&&M&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:M,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:q.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:c("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Et&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),I.map(E=>{let le=E.id!=="name",ge=Z===E.id&&Yt!==E.id;return jsxRuntime.jsxs("div",{className:c("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",le&&"cursor-grab",E.type!=="name"&&"justify-center",Yt===E.id&&"opacity-50",ge&&(z?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Jo[E.id],minWidth:E.minWidth},draggable:le,onDragStart:le?Me=>Jt(Me,E.id):void 0,onDragEnd:le?Ua:void 0,onDragOver:le?Me=>ya(Me,E.id):void 0,onDragLeave:le?Ma:void 0,onDrop:le?Me=>Sr(Me,E.id):void 0,onContextMenu:Me=>Le(Me,void 0,E.id),children:[le&&jsxRuntime.jsx(lucideReact.GripVertical,{className:c("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxRuntime.jsxs("button",{draggable:false,onClick:Me=>{let Ie=Me.currentTarget.getBoundingClientRect();u(E.id,Ie);},className:"flex items-center gap-1.5 hover:text-[#007BFF]",children:[So(E),p?.includes(E.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:m,display:"inline-block",flexShrink:0}}),$e===E.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#007BFF]"})]}):E.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>te(E.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[So(E),p?.includes(E.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:m,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:c("w-3 h-3",$e===E.id&&"text-[#007BFF]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[So(E),p?.includes(E.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:m,display:"inline-block",flexShrink:0}})]}),C&&E.resizable&&jsxRuntime.jsx("div",{className:c("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",Y===E.id&&"bg-[#007BFF]"),onMouseDown:Me=>Nt(Me,E.id)})]},E.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:E=>{E.stopPropagation(),W(le=>!le);},className:c("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Pe&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Wg,{isOpen:Pe,onClose:()=>W(false),columns:tt,customFields:d,onColumnsChange:T,onCreateCustomField:()=>{W(false),j(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Vr.map((E,le)=>{let ge=Ae.has(E.id),Me=Math.min(le*.01,.2),Ie=E.hasChildren&&E.level===0,ot=E.subtasks?.length||0;if(Ie){let{spent:Dt,allocated:Vt,quoted:ia}=Zn(E),wt=gw(E);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":E.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Me},className:c("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",ve===E.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(E),children:[Et&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),I.map(rr=>jsxRuntime.jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",rr.type!=="name"&&"justify-center"),style:{width:Jo[rr.id],minWidth:rr.minWidth},children:rr.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Da=>{Da.stopPropagation(),xe(E.id);},className:c("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ge?jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:c("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Da=>{Da.stopPropagation(),xe(E.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ge?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),E.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:E.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:c("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:E.name}),jsxRuntime.jsxs("span",{className:c("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",ot," ",f==="es"?ot===1?"Tarea":"Tareas":ot===1?"Item":"Items",")"]}),wt!==null&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",wt>=1?"text-[#32D74B] bg-[#32D74B]/10":wt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",wt.toFixed(2)]})]})]}):rr.type==="timeLoggedMinutes"?w==="financial"?(()=>{let Da=E.executedDollarsCanonical,dr=Da!=null?Math.round(Da):Math.round(X(E).dollarSpent);return dr>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",dr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:Dt>0?Dt:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E)}):rr.type==="soldEffortMinutes"?w==="financial"?(()=>{let Da=X(E),dr=Math.round(Da.dollarQuoted);return dr>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",dr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:ia>0?ia:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E)}):rr.type==="effortMinutes"?w==="financial"?(()=>{let Da=X(E),dr=Math.round(Da.dollarAllocated),Qo=Math.round(Da.dollarQuoted),Ar=Qo-dr;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[dr>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",dr.toLocaleString("es-CO")]}):null,Ar!==0&&dr>0&&Qo>0&&jsxRuntime.jsxs("span",{className:c("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(Dr,{value:Vt>0?Vt:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E)}):as(E,rr)},rr.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},E.id)}let be=H===E.id,Je=He===E.id,et=Je&&Be==="above",dt=Je&&Be==="below",Zt=Je&&Be==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":E.id,"data-listview-row":E.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Me},className:c("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",ve===E.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:be?.4:1,backgroundColor:Zt?z?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Zt?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(E),onDoubleClick:()=>a.onTaskDoubleClick?.(E),onContextMenu:Dt=>Le(Dt,E),children:[et&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),dt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Et&&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:Dt=>Wt(E.id,Dt),style:{color:z?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),I.map(Dt=>jsxRuntime.jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Dt.type!=="name"&&"justify-center"),style:{width:Jo[Dt.id],minWidth:Dt.minWidth},children:Dt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&E.level>0&&jsxRuntime.jsx("div",{style:{width:`${E.level*24}px`},className:"flex-shrink-0"}),b&&E.hasChildren&&jsxRuntime.jsx("button",{onClick:Vt=>{Vt.stopPropagation(),xe(E.id);},className:c("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ge?jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:c("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!E.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(E.wbsCode||E.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[E.wbsCode&&jsxRuntime.jsx("span",{className:c("text-[10px] font-mono",z?"text-[#007BFF]":"text-blue-600"),children:E.wbsCode}),E.taskCode&&jsxRuntime.jsx("span",{className:c("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:E.taskCode})]}),jsxRuntime.jsx("span",{className:c("truncate",E.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",E.progress===100?z?"line-through text-white/50":"line-through text-gray-400":E.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:E.name}),E.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${E.tags[0].color}20`,color:E.tags[0].color},children:E.tags[0].name})]})]}):as(E,Dt)},Dt.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},E.id)})}),L&&Vr.length>0&&(()=>{let{spent:E,allocated:le,quoted:ge}=Ge,Me=le-E,Ie=Me<0,ot=Ie?`+${Qn(Math.abs(Me))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Qn(Me)} ${f==="es"?"AHORRADO":"SAVED"}`,be=w==="financial"&&_>0,Je=K?.spent!=null?K.spent:Ge.dollarSpent,et=K?.allocated!=null?K.allocated:Ge.dollarAllocated,dt=K?.quoted!=null?K.quoted:Ge.dollarQuoted,Zt=(ia,wt)=>{if(be){let rr=wt??ia/60*_;return `$${Math.round(rr).toLocaleString("es-CO")}`}return Qn(ia)},Dt=be?Math.abs(et-Je):0,Vt=be?`+$${Dt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ie?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:ot;return jsxRuntime.jsxs("div",{className:c("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Et&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),I.map(ia=>jsxRuntime.jsx("div",{className:c("flex items-center px-4 py-3",ia.type!=="name"&&"justify-center"),style:{width:Jo[ia.id],minWidth:ia.minWidth},children:ia.type==="name"?jsxRuntime.jsx("span",{className:c("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):ia.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:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Zt(E,be?Je:void 0)}),jsxRuntime.jsx("span",{className:c("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:c("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Zt(le,be?et:void 0)})]}),le>0&&jsxRuntime.jsx("span",{className:c("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ie?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:be?Vt:ot})]}):ia.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ge>0?Zt(ge,be?dt:void 0):"\u2013"}):ia.type==="effortMinutes"?(()=>{if(be&&ge>0&&le>0){let wt=Math.round(dt),rr=Math.round(et),Da=wt-rr,dr=wt>0?Math.round(Da/wt*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Zt(le,et)}),jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Da>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Da>=0?"+":"",Math.abs(Da)>=1e3?`$${(Da/1e3).toFixed(1)}K`:`$${Da}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",dr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:le>0?Zt(le,be?et:void 0):"\u2013"})})():ia.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:E>0?Zt(E,be?Je:void 0):"\u2013"}):ia.type==="progress"?(()=>{let wt=r0(fc(e||[]));return jsxRuntime.jsxs("span",{className:c("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[wt,"%"]})})():ia.type==="weight"?(()=>{let wt=e||[],rr=[],Da=bo=>{for(let ao of bo)rr.push(ao),ao.subtasks?.length&&Da(ao.subtasks);};Da(wt);let Qo=rr.filter(bo=>!bo.subtasks?.length||bo.subtasks.length===0).reduce((bo,ao)=>bo+(ao.weight||0),0),Ar=Math.abs(Qo-100)<.1;return jsxRuntime.jsxs("span",{className:c("text-[12px] font-bold font-mono",Ar?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Qo.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:c("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},ia.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Vr.length===0&&_e&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:c("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:c(z?"text-white/60":"text-gray-600"),children:q.empty.noResults})]})})]})}),ee?.enabled&&ee.data&&ue&&jsxRuntime.jsx(Jg,{data:ee.data,isDark:z,locale:f,onClose:()=>Te(false),lens:t?.lens,onUnassignedTaskClick:E=>{let le=document.querySelector(`[data-task-id="${E}"]`);le&&(le.scrollIntoView({behavior:"smooth",block:"center"}),Ue(E),setTimeout(()=>Ue(null),2e3));}})]}),jsxRuntime.jsx(Ag,{state:re,onClose:$t,isDark:z,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:J,onColumnSort:Ce,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),je&&ut&&H&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=Ee.flattenTasks(e).find(ge=>ge.id===H);return le?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:le.name})]}):null})()}),document.body),jsxRuntime.jsx(jg,{isOpen:D,onClose:()=>j(false),onSave:Wr,isDark:z,locale:f})]})}var i0=[{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}],l0=[{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"}],d0=[{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 bc={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"},hc={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"},yc={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"},al={dark:bc,light:hc,neutral:yc};function c0(e){return al[e]||al.dark}var xc={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"}},vc={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"}},rl={en:xc,es:vc};function Rs(e){return rl[e]||rl.en}function ol(e,t){let a=Rs(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 u0(e){let t=Rs(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 p0(e,t=0,a=true){let r=Rs(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 Os(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 kc(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 f0({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:c("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var y0=26,Cw=22,Tw=10;function b0(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 Cc(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 x0(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 h0(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 Nw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:d,spanCols:i,lane:u,isStart:p,isEnd:m}=e,g=d.progress===100||d.status==="completed",f=d.isCriticalPath,x=p&&m?"rounded":p?"rounded-l":m?"rounded-r":"",y=m?Cc(d.effortMinutes,n,l):null,b=m?x0(d,n,l):null,h=m?d.blockers?.find(v=>v.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:c("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":f?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:`${u*y0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Cw}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)"}:f?{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:p?"3px":void 0,borderLeftColor:p?f?"#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:[f&&p&&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:d.name}),m&&(y||b)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[y&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",y]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:c(b.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:b.text})]})]}),h&&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,": ",h.type]}),d.progress>0&&d.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${d.progress}%`}})]})}function v0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:d=[],onCreateTag:i,attachmentsByTask:u,comments:p,onAddComment:m,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,onTaskOpen:y,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,timerState:C,onLogTime:N,onUpdateEstimate:S,onUpdateSoldEffort:M,onStartTimer:k,onStopTimer:P,onDiscardTimer:A,blurFinancials:w=false,suppressDetailModal:_=false,lens:U="hours",hourlyRate:ae=0}){let{theme:L="dark",locale:K="en",customTranslations:q,showBacklog:z=true}=t,B=ol(K,q),X=L==="dark"||L==="neutral",[fe,Ge]=react.useState(r||new Date),[O,ee]=react.useState(null),[ue,Te]=react.useState(null),[ve,Ue]=react.useState(null),[$e,nt]=react.useState({}),ce=3,Xe=3,_e=react.useCallback(H=>{Te(H.id),_||ee(H),y?.(H.id);},[_,y]),[ke,bt]=react.useState(null),Bt=react.useCallback(()=>{Ge(new Date(fe.getFullYear(),fe.getMonth()-1,1));},[fe]),st=react.useCallback(()=>{Ge(new Date(fe.getFullYear(),fe.getMonth()+1,1));},[fe]),Ve=react.useCallback(()=>{Ge(new Date);},[]),tt=react.useMemo(()=>{let H=fe.getFullYear(),se=fe.getMonth(),je=new Date(H,se,1),we=new Date(H,se+1,0),He=je.getDay(),ze=we.getDate(),Be=Os(e),ct=new Date;ct.setHours(0,0,0,0);let ut=[],ht=He,pt=new Date(H,se,0).getDate();for(let Et=ht-1;Et>=0;Et--){let Wt=new Date(H,se-1,pt-Et);ut.push({date:Wt,isCurrentMonth:false,isToday:false,isWeekend:Wt.getDay()===0||Wt.getDay()===6,events:Be.filter(St=>kc(Wt,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}for(let Et=1;Et<=ze;Et++){let Wt=new Date(H,se,Et),St=Wt.getTime()===ct.getTime();ut.push({date:Wt,isCurrentMonth:true,isToday:St,isWeekend:Wt.getDay()===0||Wt.getDay()===6,events:Be.filter(zt=>kc(Wt,zt)).map(zt=>({id:zt.id,title:zt.name,start:zt.startDate,end:zt.endDate,task:zt}))});}let Ct=42-ut.length;for(let Et=1;Et<=Ct;Et++){let Wt=new Date(H,se+1,Et);ut.push({date:Wt,isCurrentMonth:false,isToday:false,isWeekend:Wt.getDay()===0||Wt.getDay()===6,events:Be.filter(St=>kc(Wt,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}return ut},[fe,e]),Ke=react.useMemo(()=>Os(e).filter(H=>!H.startDate||!H.endDate),[e]),Pe=react.useMemo(()=>{let H=Os(e),se=0,je=0,we=0,He=0,ze=0;H.forEach(pt=>{pt.effortMinutes&&(se+=pt.effortMinutes),pt.soldEffortMinutes&&(je+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(we+=pt.scheduleVariance,He++),pt.soldEffortMinutes&&pt.effortMinutes&&(ze+=pt.soldEffortMinutes-pt.effortMinutes);});let Be=je>0?Math.min(100,Math.round(se/je*100)):0,ct=He>0?Math.round(we/He):0,ht=`${ze<0?"-":"+"}${h0(ze,U,ae)}`;return {budgetUtil:Be,avgVariance:ct,costDisplay:ht,hasCostData:je>0}},[e,U,ae]),W=react.useMemo(()=>{let H=[0,0,0,0,0,0];return tt.forEach((se,je)=>{let we=Math.floor(je/7);se.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let ze=new Date(He.task.startDate),Be=se.date;ze.getFullYear()===Be.getFullYear()&&ze.getMonth()===Be.getMonth()&&ze.getDate()===Be.getDate()&&we<H.length&&(H[we]-=He.task.soldEffortMinutes);}});}),H},[tt]),D=react.useMemo(()=>{let H=Os(e),se=new Map,je=new Set,we=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:se,multiDayTaskIds:je,maxLanesPerRow:we};let He=ht=>new Date(ht.getFullYear(),ht.getMonth(),ht.getDate()),ze=He(tt[0].date),Be=He(tt[tt.length-1].date),ct=[];for(let ht of H){if(!ht.startDate||!ht.endDate)continue;let pt=He(ht.startDate),Ct=He(ht.endDate);if(pt.getTime()===Ct.getTime()||Ct<ze||pt>Be)continue;let Et=pt<ze?ze:pt,Wt=Ct>Be?Be:Ct,St=b0(Et,ze),zt=b0(Wt,ze);St<0||St>41||zt<0||zt>41||St!==zt&&(je.add(ht.id),ct.push({task:ht,startIdx:St,endIdx:zt}));}ct.sort((ht,pt)=>ht.startIdx!==pt.startIdx?ht.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(ht.endIdx-ht.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:ht,startIdx:pt,endIdx:Ct}of ct){let Et=Math.floor(pt/7),Wt=Math.floor(Ct/7),St=He(ht.startDate),zt=He(ht.endDate),it=false;for(let jt=Et;jt<=Wt;jt++){let mt=jt===Et?pt%7:0,lt=jt===Wt?Ct%7:6,ne=lt-mt+1,me=0,$=ut[jt]??[];for(ut[jt]||(ut[jt]=$);me<$.length&&($[me]??-1)>=mt;)me++;if(me>=Tw){it=true;break}me>=$.length?$.push(lt):$[me]=lt,we[jt]=Math.max(we[jt]??0,me+1);let Y=jt===Et&&St>=ze,Se=jt===Wt&&zt<=Be,Ze=jt*7+mt,gt={taskId:ht.id,task:ht,rowIndex:jt,startCol:mt,endCol:lt,spanCols:ne,lane:me,isStart:Y,isEnd:Se};se.has(Ze)||se.set(Ze,[]),se.get(Ze).push(gt);}it&&(je.delete(ht.id),se.forEach((jt,mt)=>{let lt=jt.filter(ne=>ne.taskId!==ht.id);lt.length===0?se.delete(mt):se.set(mt,lt);}));}return {segmentsByCell:se,multiDayTaskIds:je,maxLanesPerRow:we}},[tt,e]),j=K==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],re=fe.toLocaleDateString(K==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ne=re.charAt(0).toUpperCase()+re.slice(1);return o?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",X?"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:c("text-sm font-mono",X?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",X?"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:c("w-12 h-12 rounded-full flex items-center justify-center",X?"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:c("text-lg font-semibold mb-2",X?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:c("text-sm",X?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",X?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:c("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",X?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-8 h-8",X?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:c("text-lg font-semibold mb-2",X?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:c("text-sm",X?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:c("flex-1 flex flex-col w-full h-full overflow-hidden",X?"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:c("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",X?"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:c("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",X?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-3.5 h-3.5",X?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:c("font-medium",X?"text-white":"text-gray-900"),children:K==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:c("h-4 w-px",X?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Bt,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",X?"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:c("text-sm font-semibold tracking-tight min-w-[150px] text-center",X?"text-white":"text-gray-900"),children:Ne}),jsxRuntime.jsx("button",{onClick:st,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",X?"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:c("h-4 w-px",X?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:Ve,className:c("px-2.5 py-1 text-xs rounded-md transition-all font-medium",X?"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:c("grid grid-cols-7 sticky top-0 z-10",X?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:j.map(H=>jsxRuntime.jsx("div",{className:c("py-2 text-center text-[10px] font-bold uppercase tracking-widest",X?"text-white/60 font-mono":"text-gray-500"),children:H},H))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:c("grid grid-cols-7 min-h-[800px]",X?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Te(null),children:tt.map((H,se)=>{let je=se%7===6,we=se>=35;return jsxRuntime.jsxs("div",{className:c("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!je&&(X?"border-r border-[#222]":"border-r border-gray-200"),!we&&(X?"border-b border-[#222]":"border-b border-gray-200"),X?H.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":H.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",H.isToday&&X&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",H.isToday&&!X&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:c("text-xs font-mono select-none relative z-20",H.isToday?X?"text-[#007FFF] font-bold":"text-blue-600 font-bold":H.isCurrentMonth?X?"text-white/60":"text-gray-900":X?"text-white/20":"text-gray-400"),children:String(H.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(se/7),ze=(D.maxLanesPerRow[He]??0)*y0,Be=D.segmentsByCell.get(se);return ze===0&&!Be?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${ze}px`,zIndex:5},children:Be?.map(ct=>jsxRuntime.jsx(Nw,{segment:ct,isDark:X,blurFinancials:w,isSelected:ue===ct.taskId,t:B,lens:U,hourlyRate:ae,onClick:()=>{_e(ct.task),a.onEventClick?.({id:ct.task.id,title:ct.task.name,start:ct.task.startDate,end:ct.task.endDate,task:ct.task});}},ct.taskId))})})(),(()=>{let He=H.events.filter(ze=>ze.task.isMilestone&&!D.multiDayTaskIds.has(ze.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(ze=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:ze.title,onClick:Be=>{Be.stopPropagation(),_e(ze.task);}},ze.id)),He.length>4&&jsxRuntime.jsxs("span",{className:c("text-[8px] font-mono",X?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];H.events.forEach(Be=>{Be.task.blockers?.forEach(ct=>{(ct.severity==="warning"||ct.severity==="critical")&&He.push({taskId:Be.id,type:ct.type,severity:ct.severity,variance:Be.task.scheduleVariance});});});let ze=He[0];return ze?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:c("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",ze.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,": ",ze.type,ze.variance?` (+${Math.abs(ze.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let He=H.events.filter(ut=>!D.multiDayTaskIds.has(ut.id)),ze=$e[se]||ce,Be=He.slice(0,ze),ct=He.length-ze;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Be.map(ut=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{_e(ut.task),a.onEventClick?.(ut);},whileHover:{scale:1.01},className:c("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ut.task.progress===100||ut.task.status==="completed"?X?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":X?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:X?ut.task.progress===100||ut.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)"}:ut.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:c("flex-shrink-0 text-[9px]",ut.task.isMilestone?X?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":X?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),ct>0&&jsxRuntime.jsxs("button",{onClick:ut=>{ut.stopPropagation(),nt(ht=>({...ht,[se]:ze+Xe}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",X?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ct," ",K==="es"?"m\xE1s":"more"]}),ze>ce&&He.length>ce&&jsxRuntime.jsx("button",{onClick:ut=>{ut.stopPropagation(),nt(ht=>({...ht,[se]:ce}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",X?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:K==="es"?"menos":"less"})]})})(),H.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=se>=28,ze=se%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Be=>{Be.stopPropagation(),bt(ke===se?null:se);},className:c("w-5 h-5 rounded flex items-center justify-center transition-all",ke===se?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",X?"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:c("w-3.5 h-3.5 transition-transform",ke===se&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>bt(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:c("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",ze?"right-0":"left-0",X?"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(sn,{onSubmit:Be=>{a.onTaskCreate?.({name:Be.name,startDate:Be.startDate||H.date,endDate:Be.endDate||H.date,priority:Be.priority,assignees:Be.assignee?[Be.assignee]:void 0}),bt(null);},onCancel:()=>bt(null),availableUsers:t.availableUsers,isDark:X,locale:K==="es"?"es":"en",defaultDate:H.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),se%7===6&&(()=>{let He=Math.floor(se/7),ze=W[He];if(!ze||ze===0)return null;let Be=h0(ze,U,ae);return jsxRuntime.jsxs("div",{className:c("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",ze<0?"text-red-400":"text-emerald-400",w&&"blur-sm select-none"),children:[B.labels.cashOut,": ",ze<0?"-":"+",Be]})})()]},se)})})})]}),z&&jsxRuntime.jsxs("aside",{className:c("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",X?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:c("flex-shrink-0 h-14 flex items-center justify-between px-4",X?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",X?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:c("text-[10px] font-mono tabular-nums",X?"text-white/20":"text-gray-400"),children:Ke.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ke.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:c("w-10 h-10 rounded-xl flex items-center justify-center mb-3",X?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-5 h-5",X?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:c("text-xs font-mono",X?"text-white/20":"text-gray-400"),children:K==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ke.map(H=>jsxRuntime.jsxs("button",{onClick:()=>{_e(H);},className:c("w-full text-left rounded-md p-3 transition-all group/card",X?"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:c("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",X?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:c("text-sm font-medium leading-snug line-clamp-2",X?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:H.name})]}),H.tags&&H.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[H.tags.slice(0,3).map(se=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${se.color}15`,color:se.color,border:`1px solid ${se.color}30`},children:se.name},se.id)),H.tags.length>3&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono px-1 py-0.5",X?"text-white/20":"text-gray-400"),children:["+",H.tags.length-3]})]}),(H.effortMinutes||H.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:c("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",X?"text-white/25":"text-gray-400",w&&"blur-sm select-none"),children:[Cc(H.effortMinutes,U,ae)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",Cc(H.effortMinutes,U,ae)]}),(()=>{let se=x0(H,U,ae);return se?jsxRuntime.jsx("span",{className:se.isNegative?"text-red-400":"text-emerald-400",children:se.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:[H.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:c("w-3 h-3",H.priority==="urgent"||H.priority==="high"?"text-red-400":H.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(f0,{task:H,isDark:X})]}),H.assignees&&H.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,2).map((se,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:se.color||"#007FFF"},title:se.name,children:se.initials||se.name?.slice(0,2).toUpperCase()},je))})]})]},H.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:c("flex-shrink-0 px-3 py-2.5 border-t",X?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:c("w-full text-[11px] font-mono bg-transparent outline-none",X?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:H=>{H.key==="Enter"&&H.target.value.trim()&&(a.onTaskCreate?.({name:H.target.value.trim()}),H.target.value="");}})}),Pe.hasCostData&&jsxRuntime.jsxs("div",{className:c("flex-shrink-0 px-4 py-3 border-t space-y-2.5",X?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",X?"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:c("text-[10px] font-mono",X?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:c("text-[10px] font-mono font-bold tabular-nums",X?"text-white/60":"text-gray-700",w&&"blur-sm select-none"),children:[Pe.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:c("h-1.5 rounded-full overflow-hidden",X?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Pe.budgetUtil}%`,background:Pe.budgetUtil>90?"#EF4444":Pe.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",X?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",X?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Pe.avgVariance>0?"text-emerald-400":Pe.avgVariance<0?"text-red-400":X?"text-white/50":"text-gray-600"),children:[Pe.avgVariance>0?"+":"",Pe.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",X?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",X?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Pe.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",w&&"blur-sm select-none"),children:Pe.costDisplay})]})]})]})]})]}),!_&&jsxRuntime.jsx(vo,{task:O,isOpen:!!O,onClose:()=>ee(null),onTaskUpdate:H=>{a.onTaskUpdate?.(H),ee(H);},theme:L==="dark"?"dark":"light",locale:K,availableUsers:t.availableUsers?.map(H=>({id:H.id,name:H.name,avatar:H.avatar,initials:H.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:d,onCreateTag:i,attachments:O?u?.get(O.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Os(e).filter(H=>H.id!==O?.id),comments:p?.filter(H=>H.taskId===O?.id).map(H=>({...H,createdAt:H.createdAt instanceof Date?H.createdAt:new Date(H.createdAt),updatedAt:H.updatedAt instanceof Date?H.updatedAt:H.updatedAt?new Date(H.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:S,onSoldEffortUpdate:M,onTimerStart:k,onTimerStop:P,onTimerDiscard:A,blurFinancials:w}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ue(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:c("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",X?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between",X?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:c("font-medium text-sm",X?"text-white/90":"text-gray-900"),children:ve.date.toLocaleDateString(K==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ue(null),className:c("p-1 rounded",X?"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:ve.events.map(H=>jsxRuntime.jsxs("button",{onClick:()=>{Ue(null),_e(H.task);},className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",X?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(f0,{task:H.task,isDark:X}),jsxRuntime.jsx("span",{className:c("text-sm truncate flex-1",X?"text-white/80":"text-gray-900"),children:H.title}),(H.task.priority==="high"||H.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},H.id))})]})]})})]})}var Tc={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)"},Nc={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)"},Dc={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)"},il={dark:Tc,light:Nc,neutral:Dc};function w0(e){return il[e]||il.dark}function Sw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[d,i]=react.useState(false),u=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),p=react.useMemo(()=>{let g=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,x=u.map(b=>b.priority).filter(Boolean),y=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:f,priorities:x,labels:y}},[u]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:c("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:c("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:p.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),d&&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:[p.uniqueAssignees," assignees"]})]}),p.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[p.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(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:f=>{f.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 C0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function zs(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 Us(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 T0(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 N0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let d=react.useMemo(()=>({...C0,...n}),[n]),[i,u]=react.useState(new Set),p=react.useRef(null),m=react.useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let C=v.timestamp.toISOString().split("T")[0],N=h.get(C);N?N.push(v):h.set(C,[v]);}),Array.from(h.entries()).sort((v,C)=>C[0].localeCompare(v[0])).map(([v,C])=>({date:new Date(v),events:C.sort((N,S)=>S.timestamp.getTime()-N.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:g,uniqueTypes:f}=react.useMemo(()=>{let h=new Set,v=new Set;return e.forEach(C=>{h.add(C.userId),v.add(C.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{u(v=>{let C=new Set(v);return C.has(h)?C.delete(h):C.add(h),C});},y=h=>{let C=new Date().getTime()-h.getTime(),N=Math.floor(C/6e4),S=Math.floor(C/36e5),M=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:S<24?`${S}h ago`:M<7?`${M}d ago`:h.toLocaleDateString()},b=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&p.current){let h=p.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:c("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:c("history-timeline",d.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:h=>{let v=h.target.value;a({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxRuntime.jsxs("option",{value:h,children:[Us(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:p,children:m.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[d.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((v,C)=>{let N=i.has(v.id),S=s===v.id,M=T0(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:c("history-timeline-event",N&&"expanded",S&&"selected"),onClick:()=>o?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:M},children:d.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Us(v.type)})}),C<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:M}})]}),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:[d.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:zs(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.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(([k,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(P.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(P.to)})]})]},k)),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(([k,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(P)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function S0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:d,className:i}){let u=[.5,1,1.5,2,3],p=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:c("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:c("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:p&&Us(p.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:p&&zs(p)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:p&&p.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange: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,f)=>jsxRuntime.jsx("div",{className:c("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:zs(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:u.map(g=>jsxRuntime.jsxs("button",{className:c("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>d(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:p&&p.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:c("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 Sc(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 Ec(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 E0(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 M0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Lw(e,t,a,r,o,s=100){let n=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(d=>[d.id,d]));for(let d=0;d<s;d++){let i=1-d/s;n.forEach(u=>{let p=a/2,m=r/2;u.vx+=(p-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let f=u.x-g.x,x=u.y-g.y,y=Math.sqrt(f*f+x*x)||1,b=o.chargeStrength*i/(y*y);u.vx+=f/y*b,u.vy+=x/y*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),m=l.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!m)return;let g=m.x-p.x,f=m.y-p.y,x=Math.sqrt(g*g+f*f)||1,y=(x-o.linkDistance)/x*o.forceStrength*i;p.vx+=g*y,p.vy+=f*y,m.vx-=g*y,m.vy-=f*y;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function F0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:d}){let i=react.useRef(null),[u,p]=react.useState([]),[m,g]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(1),[C,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Lw(e,t,a.width,a.height,a,150);p(U);},[e,t,a]);let S=react.useCallback((U,ae)=>{a.enableDragging&&(ae.stopPropagation(),g(U));},[a.enableDragging]),M=react.useCallback(U=>{if(!m||!i.current)return;let L=i.current.getBoundingClientRect(),K=(U.clientX-L.left-C.x)/h,q=(U.clientY-L.top-C.y)/h;p(z=>z.map(B=>B.id===m?{...B,x:K,y:q,fx:K,fy:q}:B));},[m,h,C]),k=react.useCallback(()=>{g(null);},[]),P=react.useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"node-click",node:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),A=react.useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"edge-click",edge:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),w=react.useCallback(U=>{let ae=u.find(L=>L.id===U);return ae?{x:ae.x,y:ae.y}:{x:0,y:0}},[u]),_=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ae=U.card.priority;return ae==="URGENT"?"#ef4444":ae==="HIGH"?"#f59e0b":ae==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:c("relationships-graph-empty",d),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:c("relationships-graph",d),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(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(U=>Math.max(U-.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(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Sc(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[E0(U)," ",Ec(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:M,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let ae=w(typeof U.source=="string"?U.source:U.source.id),L=w(typeof U.target=="string"?U.target:U.target.id),K=M0(U.type),q=y===U.id,z=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:c("relationships-graph-edge",q&&"hovered",z&&"critical"),onMouseEnter:()=>b(U.id),onMouseLeave:()=>b(null),onClick:B=>A(U,B),children:[jsxRuntime.jsx("line",{x1:ae.x,y1:ae.y,x2:L.x,y2:L.y,stroke:Sc(U.type),strokeWidth:z?a.edgeWidth*2:a.edgeWidth,strokeOpacity:q?1:.6,markerEnd:K?"url(#arrowhead)":void 0}),a.showEdgeLabels&&q&&jsxRuntime.jsx("text",{x:(ae.x+L.x)/2,y:(ae.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ec(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(U=>{let ae=f===U.id,L=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:c("relationships-graph-node",ae&&"hovered",L&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:K=>S(U.id,K),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:K=>P(U,K),children:[jsxRuntime.jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:_(U),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ae?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 L0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,d]=react.useState(false),[i,u]=react.useState(null),[p,m]=react.useState(null),g=react.useRef(null),f=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let x=()=>{f||(n(""),u(null),m(null),t());},y=async()=>{if(!(!s.trim()||f)){d(true),u(null),m(null);try{let h=await r(s.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{d(false);}}},b=()=>{p&&(a(p),x());};return e?jsxRuntime.jsxs(ta,{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:h=>h.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:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),p.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((h,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:h.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((h,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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},v)),p.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:h=>n(h.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:f}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,v)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-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:f,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),p?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Mc={"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 Bw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Rw={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 $w(e,t,a){let r=Mc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ws(e){return `$${e.toFixed(4)}`}var Fc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=$w(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(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let r=a.length,o=a.reduce((p,m)=>p+m.cost,0),s=a.reduce((p,m)=>p+m.inputTokens,0),n=a.reduce((p,m)=>p+m.outputTokens,0),l=a.filter(p=>p.success),d=a.reduce((p,m)=>p+m.duration,0),i={},u={};return a.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?d/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(u=>u.timestamp>=n).length,d=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:d,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)}},hn=new Fc;function R0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(hn.getStats()),[s,n]=react.useState(hn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let d=setInterval(()=>{o(hn.getStats()),n(hn.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),react.useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let l=hn.getRecentOperations(5);return jsxRuntime.jsxs(ta,{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:d=>d.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:Ws(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(([d,i])=>{let u=r.costsByFeature[d]||0,p=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:d.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:Ws(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${p}%`}})})]},d)})})]}),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(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ws(d.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 H0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[d,i]=react.useState(""),[u,p]=react.useState(""),[m,g]=react.useState(false),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(null),C=react.useRef(null),N=m||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let A=w=>{w.key==="Escape"&&!N&&S();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,N]);let S=()=>{N||(l(""),i(""),p(""),x(null),b(null),v(null),t());},M=async()=>{if(!(!n.trim()||N)){g(true),x(null),b(null),v(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:d||void 0,endDate:u||void 0});b(A.tasks.tasks),v({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){x(A instanceof Error?A.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{y&&(a(y),S());};if(!e)return null;let P=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ta,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),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:A=>A.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:S,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:y?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:[h?.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"}),h?.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 (",P,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((A,w)=>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:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:A.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"})]}),A.start," \u2192 ",A.end]}),jsxRuntime.jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:A.priority})]})},A.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:A=>l(A.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:d,onChange:A=>i(A.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:u,onChange:A=>p(A.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})]})]}),f&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((A,w)=>jsxRuntime.jsx("button",{onClick:()=>l(A),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:A},w))})]})]})}),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:S,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"}),y?jsxRuntime.jsx("button",{onClick:k,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:M,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 cl({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&Qs(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(y,b,h)=>{r(v=>{let C=v.cards.find(A=>A.id===y);if(!C)return v;let N=C.columnId,S={...C,columnId:b,position:h},M=v.cards.map(A=>A.id===y?S:A),k=v.columns.map(A=>{if(A.id===N)return {...A,cardIds:A.cardIds.filter(w=>w!==y)};if(A.id===b){let w=M.filter(_=>_.columnId===b).sort((_,U)=>_.position-U.position);return {...A,cardIds:w.map(_=>_.id)}}return A}),P={...v,cards:M,columns:k};return o(P),P});},[o]),n=react.useCallback(async(y,b)=>{r(h=>{let v=h.cards.map(N=>N.id===y?{...N,...b}:N),C={...h,cards:v};return o(C),C});},[o]),l=react.useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b},C=h.columns.map(S=>S.id===y.columnId?{...S,cardIds:[...S.cardIds,b]}:S),N={...h,cards:[...h.cards,v],columns:C};return o(N),N});},[o]),d=react.useCallback(async y=>{r(b=>{let h=b.cards.find(S=>S.id===y);if(!h)return b;let v=b.cards.filter(S=>S.id!==y),C=b.columns.map(S=>S.id===h.columnId?{...S,cardIds:S.cardIds.filter(M=>M!==y)}:S),N={...b,cards:v,columns:C};return o(N),N});},[o]),i=react.useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b,cardIds:[]},C={...h,columns:[...h.columns,v]};return o(C),C});},[o]),u=react.useCallback(async(y,b)=>{r(h=>{let v=h.columns.map(N=>N.id===y?{...N,...b}:N),C={...h,columns:v};return o(C),C});},[o]),p=react.useCallback(async y=>{r(b=>{let h=b.cards.filter(N=>N.columnId!==y),v=b.columns.filter(N=>N.id!==y),C={...b,cards:h,columns:v};return o(C),C});},[o]),m=react.useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),b},[l]),g=react.useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=react.useCallback(()=>{r(y=>{let b={...y,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:d,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:d,deleteColumn:p,clearBoard:f}}}function U0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=cl({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(d,i,u={})=>{s.addCard({title:i,columnId:d,position:r.cards.filter(p=>p.columnId===d).length,...u});},addColumn:(d,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:d,position:i??u+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 Vs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},V0={by:"none",order:"asc"};function G0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Vs,...e}),[s,n]=react.useState({...V0,...t}),l=react.useCallback(x=>{o(y=>({...y,...x}));},[]),d=react.useCallback(x=>{n(y=>({...y,...x}));},[]),i=react.useCallback(()=>{o(Vs),n(V0);},[]),u=react.useCallback(()=>{a&&o({...Vs,assignees:[a]});},[a]),p=react.useCallback(()=>{o({...Vs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...Vs,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]),f=react.useCallback(x=>{let y=[...x];if(r.search){let b=r.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),C=String(b.getDate()).padStart(2,"0"),N=`${h}-${v}-${C}`;y=y.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let M=S.endDate||S.dueDate;if(!M)return false;let k;if(typeof M=="string")k=M.split("T")[0]||M;else {let P=M.getUTCFullYear(),A=String(M.getUTCMonth()+1).padStart(2,"0"),w=String(M.getUTCDate()).padStart(2,"0");k=`${P}-${A}-${w}`;}switch(r.dateFilter){case "overdue":return k<N;case "today":return k===N;case "this-week":let P=new Date(N+"T00:00:00"),A=new Date(k+"T00:00:00"),w=new Date(P);return w.setDate(w.getDate()+7),A>=P&&A<=w;case "custom":if(r.dateRange){let _=typeof M=="string"?new Date(M):M;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(y=y.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let C=b.createdAt?new Date(b.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;v=C-N;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},M=S[b.priority||"LOW"],k=S[h.priority||"LOW"];v=M-k;break;case "dueDate":let P=b.endDate||b.dueDate,A=h.endDate||h.dueDate;if(!P)return 1;if(!A)return -1;let w=typeof P=="string"?new Date(P).getTime():P.getTime(),_=typeof A=="string"?new Date(A).getTime():A.getTime();v=w-_;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let U=b.estimatedTime||0,ae=h.estimatedTime||0;v=U-ae;break;default:v=0;}return s.order==="asc"?v:-v}),y},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:d,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:m,applyFilters:f,hasActiveFilters:g}}var _0,K0;if(typeof window<"u")try{let e=Ys("ai");_0=e.generateObject,K0=e.generateText;}catch{}function q0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(_0&&K0&&e.apiKey),n=react.useCallback(async p=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",p),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(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 p=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",p.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]),d=react.useCallback(async p=>{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 p=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",p.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:d,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Ac(){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 Y0(e){let{cards:t}=e,[a,r]=Ac(),o=react.useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=react.useCallback((p,m)=>{if(!m){r({selectedCardIds:[p],lastSelectedCardId:p});return}let g=m.ctrlKey||m.metaKey,f=m.shiftKey;if(g)a.selectedCardIds.includes(p)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==p),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let x=t.find(b=>b.id===p),y=t.find(b=>b.id===a.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,P)=>k.position-P.position),h=b.findIndex(k=>k.id===a.lastSelectedCardId),v=b.findIndex(k=>k.id===p),[C,N]=h<v?[h,v]:[v,h],S=b.slice(C,N+1).map(k=>k.id),M=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:M,lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,r]),n=react.useCallback(p=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=react.useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(p=>{a.selectedCardIds.includes(p)?n(p):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,n,r]),u=react.useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:d,toggleCard:i,getSelectedCards:u}}var X0={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(()=>({...X0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((x,y,b,h,v)=>{if(y.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:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),d=react.useCallback(x=>{n(y=>y.filter(b=>b.id!==x));},[]),i=react.useCallback(x=>{n(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((x,y)=>{n(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),p=react.useCallback((x,y)=>{n(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(C=>C!==y);return v.length<o.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),m=react.useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),g=react.useCallback(async x=>{let y=t.filter(N=>N.columnId===x);if(y.length<o.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(S=>{h.has(S)||h.set(S,[]),h.get(S).push(N);});}),h.forEach((N,S)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:N.map(M=>M.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${S}"`,confidence:.85});});let v=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(S=>{v.has(S)||v.set(S,[]),v.get(S).push(N);});}),v.forEach((N,S)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:N.map(M=>M.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(y.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,S)=>{if(N.length>=o.minCardsPerStack){let M={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";b.push({stack:{title:`${M} ${S} Priority`,cardIds:N.map(k=>k.id),columnId:x,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of y){let M=(await r.findSimilar(N,y)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(M.length>=o.minCardsPerStack-1){let k=[N.id,...M.map(A=>A.card.id)],P=M.reduce((A,w)=>A+w.similarity,0)/M.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${M.length+1} similar tasks`,confidence:P});}}return b.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,S)=>S.confidence-N.confidence).slice(0,5)},[t,o,r]),f=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(y=>y.columnId)).forEach(async y=>{let b=await g(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:l,deleteStack:d,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:m,getSuggestions:g,applySuggestion:f,config:o}}var Q0=react.createContext(null);function Z0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(d=>{let{Column:i}=Ys("@libxai/core");s.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=Ys("@libxai/core");n.set(d.id,new i(d));});let l=null;if(t?.board){let{Board:d}=Ys("@libxai/core");l=new d(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(Q0.Provider,{value:{store:o},children:e})}function ul(){let e=react.useContext(Q0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function js(){let e=ul(),[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(h=>{e.updateBoard(h);},[e]),d=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,v)=>{e.updateColumn(h,v);},[e]),u=react.useCallback(h=>{e.deleteColumn(h);},[e]),p=react.useCallback(h=>e.getColumn(h),[e]),m=react.useCallback(h=>{e.addCard(h);},[e]),g=react.useCallback((h,v)=>{e.updateCard(h,v);},[e]),f=react.useCallback(h=>{e.deleteCard(h);},[e]),x=react.useCallback((h,v,C)=>{e.moveCard(h,v,C);},[e]),y=react.useCallback(h=>e.getCard(h),[e]),b=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:d,updateColumn:i,deleteColumn:u,getColumn:p,addCard:m,updateCard:g,deleteCard:f,moveCard:x,getCard:y,getCardsByColumn:b}}function tf(e){let{cards:t}=js();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 af(e="position",t="asc"){let{cards:a}=js();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},d=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=d-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 pl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=mu.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);}},e5=new pl;function of({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:d}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),p=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:p.map(f=>{let x=e[f.index];if(!x)return null;let y=d?d(x,f.index):f.index,b={position:"absolute",top:n?0:f.start,left:n?f.start:0,width:n?f.size:"100%",height:n?"100%":f.size};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:r(x,f.index)},y)})})})}function nf(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 lf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:d,horizontal:i=true}){let u=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:l}),m=p.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:g,className:s,children:jsxRuntime.jsx("div",{style:f,children:m.map(x=>{let y=e[x.index];if(!y)return null;let b=d?d(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":x.index,children:o(y,x.index)},b)})})})}function df(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 cf(e,t=10){return e>t}var Rc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$c={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Oc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Hc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},zc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Uc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Wc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Vc={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)"},Gc={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)"},jc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},_c={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}},Kc={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}},ml={spacing:Rc,borderRadius:$c,fontSize:Oc,fontWeight:Hc,lineHeight:zc,zIndex:Uc,duration:Wc,easing:Vc,shadows:Gc,opacity:jc,kanban:_c,gantt:Kc};function uf(e,t,a){return e[t]??a}function qc(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)?qc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function r5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Yc(e="asakaa"){let t=qc(ml),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=r5(o);a.push(` ${s}: ${n};`);}return `:root {
433
+ Total: ${_a(u)}`:void 0;return jsxRuntime.jsxs("div",{className:c("flex items-center justify-between",v&&"cursor-help"),title:C,children:[jsxRuntime.jsxs("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:[n?"Ejecutado":"Executed",v&&jsxRuntime.jsx("span",{className:"ml-1 opacity-50",children:"\u24D8"})]}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono font-bold",f?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:_a(u)})]})})(),d>0&&jsxRuntime.jsx("div",{className:c("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:c("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[p>=0?`+${_a(p)} ${n?"Disp.":"Avail."}`:`${_a(Math.abs(p))} ${n?"P\xE9rdida":"Loss"}`,d>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let d=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(d/i*100),100):0,g=(i>0?d/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Xg(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:c("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Xg(i)})]}),i>0&&jsxRuntime.jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:c("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:c("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:c("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:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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:c("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:c("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:c("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:c("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(d=>jsxRuntime.jsxs("button",{onClick:()=>s?.(d.id),className:c("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:c("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:d.name})]},d.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:c("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 d=e.scheduleVarianceDays??0,i=d>0,u=d<0,p=e.scheduleVarianceLabel||(i?`+${d} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${d} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:c("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:c("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((d,i)=>{let u=d.utilizationPercent>=100?"#F87171":d.utilizationPercent>=80?"#FFD60A":d.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:d.name}),jsxRuntime.jsxs("span",{className:c("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[d.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:c("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(d.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${d.name}-${i}`)})})]})]})}var mw=[{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 n0(e,t=0,a=[]){let r=[];for(let o of e){let s=[...a,o.id];r.push({...o,level:t,hasChildren:(o.subtasks?.length||0)>0,parentPath:s}),o.subtasks?.length&&o.isExpanded!==false&&r.push(...n0(o.subtasks,t+1,s));}return r}function gw(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(),d=s.endDate.getTime()-n;if(d<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,d))/d*100;if(u<=0)continue;let p=(s.progress||0)/u;r+=p,o++;}return o>0?r/o:null}function Zn(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=Zn(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 Qn(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 fw({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:c("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),n(String(e||"")),o(true);},className:c("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 r0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let d=l.weight||0;d>0&&(t+=(l.progress||0)*d,a+=d,r+=1);}let o=r/e.length;if(a>=99&&o>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,d)=>l+(d.effort_minutes||0),0)>0){let l=0,d=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,d+=u;}return Math.round(l/d*10)/10}let n=e.reduce((l,d)=>l+(d.progress||0),0);return Math.round(n/e.length*10)/10}function fc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?fc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function s0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:d=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:m="#00E5CC"}){let{theme:g="dark",locale:f="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:C=true,enableContextMenu:N=true,showCreateTaskButton:S=false,onCreateTask:M,persistFilter:k=false,financialBlur:F,healthSidebar:A,lens:w="hours",hourlyRate:_=0,rateMap:U,aggregateParentHours:ae=false,showProjectTotals:L=false,totalsDollarOverride:K}=t,q=ji(f,x),z=g==="dark",B=E=>{if(!U||!E.assignees||E.assignees.length===0)return _;let le=0,ge=0;for(let Ie of E.assignees){let ot=Ie.id?U[Ie.id]:void 0;if(ot==null||ot<=0)continue;let be=typeof Ie.estimatedMinutes=="number"?Ie.estimatedMinutes:0;be>0&&(le+=ot*be,ge+=be);}if(ge>0)return le/ge;let Me=E.assignees.map(Ie=>Ie.id?U[Ie.id]:void 0).filter(Ie=>Ie!=null&&Ie>0);return Me.length===0?_:Me.reduce((Ie,ot)=>Ie+ot,0)/Me.length},X=E=>{let le=0,ge=0,Me=0,Ie=ot=>{for(let be of ot)if(be.subtasks&&be.subtasks.length>0){let Je={s:le,a:ge,q:Me};if(Ie(be.subtasks),le-Je.s+(ge-Je.a)+(Me-Je.q)===0){let dt=B(be);le+=(be.timeLoggedMinutes??0)/60*dt,ge+=(be.effortMinutes??0)/60*dt,Me+=(be.soldEffortMinutes??0)/60*dt;}}else {let Je=B(be);le+=(be.timeLoggedMinutes??0)/60*Je,ge+=(be.effortMinutes??0)/60*Je,Me+=(be.soldEffortMinutes??0)/60*Je;}};return E.subtasks&&Ie(E.subtasks),{dollarSpent:le,dollarAllocated:ge,dollarQuoted:Me}},fe=react.useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let E=localStorage.getItem(k);if(E){let le=JSON.parse(E);return {statusFilter:le.statusFilter||"all",hideCompleted:le.hideCompleted||!1}}}catch(E){console.error("Error loading persisted filter:",E);}return {statusFilter:"all",hideCompleted:false}},[k]),Ge=react.useMemo(()=>{function E(le){let ge=0,Me=0,Ie=0,ot=0,be=0,Je=0;for(let et of le)if(et.subtasks&&et.subtasks.length>0){let dt=E(et.subtasks);if(dt.spent+dt.allocated+dt.quoted>0)ge+=dt.spent,Me+=dt.allocated,Ie+=dt.quoted,ot+=dt.dollarSpent,be+=dt.dollarAllocated,Je+=dt.dollarQuoted;else {let Dt=et.timeLoggedMinutes??0,Vt=et.effortMinutes??0,ia=et.soldEffortMinutes??0;ge+=Dt,Me+=Vt,Ie+=ia;let wt=B(et);ot+=Dt/60*wt,be+=Vt/60*wt,Je+=ia/60*wt;}}else {let dt=et.timeLoggedMinutes??0,Zt=et.effortMinutes??0,Dt=et.soldEffortMinutes??0;ge+=dt,Me+=Zt,Ie+=Dt;let Vt=B(et);ot+=dt/60*Vt,be+=Zt/60*Vt,Je+=Dt/60*Vt;}return {spent:ge,allocated:Me,quoted:Ie,dollarSpent:ot,dollarAllocated:be,dollarQuoted:Je}}return E(e)},[e]),O=react.useMemo(()=>{let E=new Map;function le(ge){let Me=0;for(let Ie of ge)if(Ie.subtasks&&Ie.subtasks.length>0){let ot=le(Ie.subtasks);E.set(Ie.id,ot),Me+=ot;}else Me+=Ie.weight||0;return Me}return le(e),E},[e]),ee=react.useMemo(()=>!A?.enabled||!A.data?A:{...A,data:{...A.data,totalHoursSpentMinutes:Ge.spent,totalHoursAllocatedMinutes:Ge.allocated}},[A,Ge]),[ue,Te]=react.useState(true),[ve,Ue]=react.useState(null),[$e,nt]=react.useState("position"),[ce,Xe]=react.useState("asc"),[_e,ke]=react.useState(""),[bt,Bt]=react.useState(()=>fe().statusFilter),[st,Ve]=react.useState(()=>fe().hideCompleted),[tt,Ke]=react.useState(h||mw),[Fe,W]=react.useState(false),[D,j]=react.useState(false),[re,Ne]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[H,se]=react.useState(null),[je,we]=react.useState(false),[He,ze]=react.useState(null),[Be,ct]=react.useState(null),[ut,ht]=react.useState(null),pt=react.useRef(0),Ct=react.useRef(false),Et=!!(a.onTaskMove||a.onTaskReparent),Wt=react.useCallback((E,le)=>{Et&&(le.preventDefault(),pt.current=le.clientY,se(E),Ct.current=false,we(false),ht({x:le.clientX,y:le.clientY}));},[Et]),St=react.useCallback(E=>{if(!H||(Math.abs(E.clientY-pt.current)>5&&!Ct.current&&(Ct.current=true,we(true)),ht({x:E.clientX,y:E.clientY}),!Ct.current))return;let ge=document.querySelectorAll("[data-listview-row]"),Me=null,Ie=null;ge.forEach(ot=>{let be=ot.getBoundingClientRect(),Je=ot.getAttribute("data-listview-row");if(Je&&Je!==H&&E.clientY>=be.top&&E.clientY<=be.bottom){Me=Je;let et=E.clientY-be.top,dt=be.height;Ie=et<dt*.25?"above":et>dt*.75?"below":"child";}}),ze(Me),ct(Ie);},[H]),zt=react.useCallback(()=>{if(Ct.current&&H&&He&&Be){if(Be==="child"&&a.onTaskReparent)a.onTaskReparent(H,He);else if(Be==="above"||Be==="below"){let E=(Me,Ie,ot=null)=>{for(let be of Me){if(be.id===Ie)return ot;if(be.subtasks){let Je=E(be.subtasks,Ie,be.id);if(Je!==void 0)return Je}}},le=E(e,H,null),ge=E(e,He,null);if(a.onTaskReparent){let Me=(dt,Zt)=>{if(Zt===null)return dt;for(let Dt of dt){if(Dt.id===Zt)return Dt.subtasks||[];if(Dt.subtasks){let Vt=Me(Dt.subtasks,Zt);if(Vt.length>0||Dt.subtasks.some(ia=>ia.id===Zt))return Vt}}return []},Ie=Me(e,ge??null),ot=Ie.findIndex(dt=>dt.id===He),be=le===ge,Je=be?Ie.findIndex(dt=>dt.id===H):-1,et=Be==="below"?ot+1:ot;be&&Je!==-1&&Je<ot&&(et-=1),a.onTaskReparent(H,ge??null,Math.max(0,et));}}}se(null),ze(null),ct(null),ht(null),Ct.current=false,we(false);},[H,He,Be,e,a]);react.useEffect(()=>{if(H)return document.addEventListener("mousemove",St),document.addEventListener("mouseup",zt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",zt),document.body.style.cursor="",document.body.style.userSelect="";}},[H,St,zt]);let[it,jt]=react.useState("all"),[mt,lt]=react.useState(false),ne=react.useRef(null),me=react.useRef(null),$=react.useMemo(()=>{let E=0;function le(ge,Me){for(let Ie of ge)Me>E&&(E=Me),Ie.subtasks?.length&&le(Ie.subtasks,Me+1);}return le(e,1),E},[e]);react.useEffect(()=>{if(!mt)return;let E=le=>{ne.current?.contains(le.target)||me.current?.contains(le.target)||lt(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[mt]),react.useEffect(()=>{if(it==="all"){let ge=function(Me){for(let Ie of Me)Ie.subtasks?.length&&(Ie.isExpanded===false&&a.onTaskToggleExpand?.(Ie.id),ge(Ie.subtasks));};ge(e);}else {let ge=function(Me,Ie){for(let ot of Me)if(ot.subtasks?.length){let be=Ie<it,Je=ot.isExpanded!==false;be!==Je&&a.onTaskToggleExpand?.(ot.id),ge(ot.subtasks,Ie+1);}};ge(e,1);}},[it]);let[Y,Se]=react.useState(null),[Ze,gt]=react.useState(0),[Ft,Rt]=react.useState(0),Mt=react.useRef(null),[Yt,Qt]=react.useState(null),[Z,Oe]=react.useState(null);react.useEffect(()=>{h&&Ke(E=>{if(E.length===h.length){let le=true;for(let ge=0;ge<E.length;ge++){let Me=E[ge],Ie=h[ge];if(!Me||!Ie||Me.id!==Ie.id||Me.visible!==Ie.visible||Me.width!==Ie.width||Me.label!==Ie.label){le=false;break}}if(le)return E}return h});},[h]),react.useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:bt,hideCompleted:st}));}catch(E){console.error("Error persisting filter state:",E);}},[k,bt,st]);let Ae=react.useMemo(()=>{let E=new Set;function le(ge){for(let Me of ge)Me.subtasks?.length&&(Me.isExpanded!==false&&E.add(Me.id),le(Me.subtasks));}return le(e),E},[e]),I=react.useMemo(()=>tt.filter(E=>E.visible),[tt]),xe=react.useCallback(E=>{a.onTaskToggleExpand?.(E);},[a]),te=react.useCallback(E=>{$e===E?Xe(le=>le==="asc"?"desc":"asc"):(nt(E),Xe("asc")),a.onSortChange?.({column:E,direction:ce==="asc"?"desc":"asc"});},[$e,ce,a]),T=react.useCallback(E=>{Ke(E),a.onColumnsChange?.(E);},[a]),J=react.useCallback(E=>{let le=tt.map(ge=>ge.id===E?{...ge,visible:false}:ge);T(le);},[tt,T]),Ce=react.useCallback((E,le)=>{nt(E),Xe(le);},[]),Le=react.useCallback((E,le,ge)=>{N&&(E.preventDefault(),Ne({isOpen:true,x:E.clientX,y:E.clientY,type:le?"task":"header",task:le,columnId:ge}));},[N]),$t=react.useCallback(()=>{Ne(E=>({...E,isOpen:false}));},[]),Nt=react.useCallback((E,le)=>{if(!C)return;E.preventDefault(),E.stopPropagation();let ge=tt.find(Me=>Me.id===le);ge&&(Se(le),gt(E.clientX),Rt(ge.width));},[tt,C]);react.useEffect(()=>{if(!Y)return;let E=tt,le=Me=>{let Ie=Me.clientX-Ze,ot=Math.max(50,Ft+Ie);E=E.map(be=>be.id===Y?{...be,width:ot}:be),Ke(E);},ge=()=>{a.onColumnsChange?.(E),Se(null);};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",ge),()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ge);}},[Y,Ze,Ft,a]);let Jt=react.useCallback((E,le)=>{if(le==="name"){E.preventDefault();return}Qt(le),E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",le),E.currentTarget instanceof HTMLElement&&(E.currentTarget.style.opacity="0.5");},[]),Ua=react.useCallback(E=>{E.currentTarget instanceof HTMLElement&&(E.currentTarget.style.opacity="1"),Qt(null),Oe(null);},[]),ya=react.useCallback((E,le)=>{E.preventDefault(),le!=="name"&&(E.dataTransfer.dropEffect="move",Oe(le));},[]),Ma=react.useCallback(()=>{Oe(null);},[]),Sr=react.useCallback((E,le)=>{if(E.preventDefault(),!Yt||Yt===le||le==="name")return;let ge=[...tt],Me=ge.findIndex(be=>be.id===Yt),Ie=ge.findIndex(be=>be.id===le);if(Me===-1||Ie===-1)return;let ot=ge.splice(Me,1);ot[0]&&(ge.splice(Ie,0,ot[0]),T(ge),Qt(null),Oe(null));},[Yt,tt,T]),Wr=react.useCallback(async E=>{if(a.onCreateCustomField){let le={...E,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(le);}j(false);},[a]),wn=react.useCallback(E=>E.progress===100||E.status==="completed"?"completed":E.progress&&E.progress>0||E.status==="in-progress"?"in-progress":"todo",[]),Vr=react.useMemo(()=>{let E=n0(e);if(_e.trim()){let le=_e.toLowerCase();E=E.filter(ge=>ge.name.toLowerCase().includes(le));}if(bt!=="all"){let le=new Set(E.filter(ge=>wn(ge)===bt).flatMap(ge=>ge.parentPath));E=E.filter(ge=>le.has(ge.id));}if(st){let le=new Set(E.filter(ge=>wn(ge)!=="completed").flatMap(ge=>ge.parentPath));E=E.filter(ge=>le.has(ge.id));}return E.sort((le,ge)=>{let Me,Ie;switch($e){case "name":Me=le.name.toLowerCase(),Ie=ge.name.toLowerCase();break;case "startDate":Me=le.startDate?.getTime()||0,Ie=ge.startDate?.getTime()||0;break;case "endDate":Me=le.endDate?.getTime()||0,Ie=ge.endDate?.getTime()||0;break;case "progress":Me=le.progress||0,Ie=ge.progress||0;break;case "status":Me=le.status||"todo",Ie=ge.status||"todo";break;case "priority":let ot={urgent:0,high:1,medium:2,low:3,none:4};Me=ot[le.priority]??4,Ie=ot[ge.priority]??4;break;case "position":return 0;default:return 0}return Me<Ie?ce==="asc"?-1:1:Me>Ie?ce==="asc"?1:-1:0}),E},[e,_e,bt,st,$e,ce,wn]),as=react.useCallback((E,le)=>{let ge=ot=>{a.onTaskUpdate?.({...E,...ot});},Me=ot=>ot?E.customFields?.find(Je=>Je.fieldId===ot)?.value:void 0,Ie=(ot,be)=>{if(!ot)return;let et=[...E.customFields||[]],dt=et.findIndex(Zt=>Zt.fieldId===ot);dt>=0?et[dt]={fieldId:ot,value:be}:et.push({fieldId:ot,value:be}),ge({customFields:et});};switch(le.type){case "name":return null;case "status":return jsxRuntime.jsx(Km,{value:E.status||(E.progress===100?"completed":E.progress&&E.progress>0?"in-progress":"todo"),onChange:be=>{ge({status:be,progress:be==="completed"?100:be==="in-progress"?50:0});},isDark:z,locale:f,translations:q.status});case "priority":return jsxRuntime.jsx(Ym,{value:E.priority,onChange:be=>ge({priority:be}),isDark:z,locale:f});case "assignees":{let be=E.hasChildren,Je=E.assignees||[];if(be&&E.subtasks?.length){let et=new Map,dt=Zt=>{(Zt||[]).forEach(Dt=>{(Dt.assignees||[]).forEach(Vt=>{et.has(Vt.name)||et.set(Vt.name,Vt);}),Dt.subtasks?.length&&dt(Dt.subtasks);});};dt(E.subtasks),Je=Array.from(et.values());}else be&&(Je=[]);return jsxRuntime.jsx(Qd,{value:Je,availableUsers:l,onChange:et=>ge({assignees:et}),isDark:z,locale:f,disabled:be})}case "startDate":return jsxRuntime.jsx(Yi,{value:E.startDate,onChange:be=>ge({startDate:be}),isDark:z,locale:f,dateField:"start",startDate:E.startDate,endDate:E.endDate});case "endDate":return jsxRuntime.jsx(Yi,{value:E.endDate,onChange:be=>ge({endDate:be}),isDark:z,locale:f,dateField:"end",startDate:E.startDate,endDate:E.endDate});case "progress":{let be=!!(E.subtasks&&E.subtasks.length>0),Je=be?r0(fc(E.subtasks||[])):E.progress||0;return jsxRuntime.jsx(og,{value:Je,onChange:be?void 0:et=>{let dt=et===100?"completed":et>0?"in-progress":"todo";ge({progress:et,status:dt});},isDark:z,disabled:be})}case "tags":return jsxRuntime.jsx(bg,{value:E.tags||[],isDark:z});case "text":return jsxRuntime.jsx(ig,{value:Me(le.customFieldId)||"",onChange:be=>Ie(le.customFieldId,be),isDark:z});case "number":return jsxRuntime.jsx(cg,{value:Me(le.customFieldId)||0,onChange:be=>Ie(le.customFieldId,be),isDark:z});case "date":let ot=Me(le.customFieldId);return jsxRuntime.jsx(Yi,{value:ot?new Date(ot):void 0,onChange:be=>Ie(le.customFieldId,be),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(ug,{value:Me(le.customFieldId)||"",options:le.options||[],onChange:be=>Ie(le.customFieldId,be),isDark:z});case "checkbox":return jsxRuntime.jsx(mg,{value:Me(le.customFieldId)||false,onChange:be=>Ie(le.customFieldId,be),isDark:z});case "estimatedTime":{let be=E.status==="completed"||E.progress===100;return jsxRuntime.jsx(Dr,{value:E.estimatedTime,onChange:Je=>ge({estimatedTime:Je}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E)})}case "quotedTime":{let be=E.status==="completed"||E.progress===100,Je=F?.enabled&&(!F.columns||F.columns.includes("quotedTime"));return jsxRuntime.jsx(Dr,{value:E.quotedTime,onChange:et=>ge({quotedTime:et}),isDark:z,locale:f,disabled:be,isBlurred:Je,lens:w,hourlyRate:B(E)})}case "elapsedTime":{let be=E.status==="completed"||E.progress===100,Je=E.executedDollarsCanonical;return jsxRuntime.jsx(Dr,{value:E.elapsedTime,onChange:et=>ge({elapsedTime:et}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E),financialOverride:Je})}case "effortMinutes":{if(ae&&E.subtasks&&E.subtasks.length>0){let{allocated:Zt}=Zn(E);if(w==="financial"){let Dt=X(E),Vt=Math.round(Dt.dollarAllocated),ia=Math.round(Dt.dollarQuoted),wt=ia-Vt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Vt>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Vt.toLocaleString("es-CO")]}):null,wt!==0&&Vt>0&&ia>0&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",wt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[wt>0?"+":"",Math.abs(wt)>=1e3?`$${(wt/1e3).toFixed(1)}K`:`$${wt}`]})]})}return jsxRuntime.jsx(Dr,{value:Zt>0?Zt:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:_})}let be=E.status==="completed"||E.progress===100,Je=E.effortMinutes||0,et=E.soldEffortMinutes||0,dt=B(E);if(w==="financial"&&dt&&Je>0&&et>0){let Zt=Math.round(Je/60*dt),Vt=Math.round(et/60*dt)-Zt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Dr,{value:Je,onChange:ia=>ge({effortMinutes:ia}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E)}),Vt!==0&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Vt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Vt>0?"+":"",Math.abs(Vt)>=1e3?`$${(Vt/1e3).toFixed(1)}K`:`$${Vt}`]})]})}return jsxRuntime.jsx(Dr,{value:Je,onChange:Zt=>ge({effortMinutes:Zt}),isDark:z,locale:f,disabled:be,lens:w,hourlyRate:B(E)})}case "timeLoggedMinutes":{let be=E.executedDollarsCanonical;if(ae&&E.subtasks&&E.subtasks.length>0){let{spent:et}=Zn(E);return jsxRuntime.jsx(Dr,{value:et>0?et:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E),financialOverride:be})}let Je=E.status==="completed"||E.progress===100;return jsxRuntime.jsx(Dr,{value:E.timeLoggedMinutes,onChange:a.onLogTime?et=>{a.onLogTime?.(E,et);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Je,lens:w,hourlyRate:B(E),financialOverride:be})}case "soldEffortMinutes":{if(ae&&E.subtasks&&E.subtasks.length>0){let{quoted:et}=Zn(E),dt=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:et>0?et:void 0,isDark:z,locale:f,disabled:true,isBlurred:dt,lens:w,hourlyRate:B(E)})}let be=E.status==="completed"||E.progress===100,Je=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:E.soldEffortMinutes,onChange:et=>ge({soldEffortMinutes:et}),isDark:z,locale:f,disabled:be,isBlurred:Je,lens:w,hourlyRate:B(E)})}case "scheduleVariance":{let be=E.effortMinutes||0,Je=E.soldEffortMinutes||0,et=E.timeLoggedMinutes||0,dt=be>0||Je>0||et>0;return jsxRuntime.jsx(vg,{startDate:E.startDate,endDate:E.endDate,scheduleVariance:E.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:dt})}case "hoursBar":{if(ae&&E.hasChildren){let{spent:be,allocated:Je,quoted:et}=Zn(E),dt=be>Je&&Je>0;return jsxRuntime.jsxs("span",{className:c("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:c("font-bold",dt?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:Qn(be)}),Je>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:Qn(Je)})]}),et>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:Qn(et)})]})]})}return jsxRuntime.jsx(kg,{task:E,isDark:z,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:B(E)})}case "teamLoad":return E.hasChildren||E.subtasks&&E.subtasks.length>0?jsxRuntime.jsx(Tg,{task:E,isDark:z,locale:f}):jsxRuntime.jsx(Qd,{value:E.assignees||[],availableUsers:l,onChange:Je=>{a.onTaskUpdate?.({...E,assignees:Je});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(Dg,{blockers:E.blockers,isDark:z,locale:f});case "weight":{let be=O.get(E.id);if(be!==void 0)return jsxRuntime.jsx("span",{className:c("text-xs font-mono",be>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:be>0?`${Number(be.toFixed(2))}%`:"\u2014"});let Je=E.weight||0;return jsxRuntime.jsx(fw,{value:Je,onChange:et=>ge({weight:et}),isDark:z})}default:return jsxRuntime.jsx("span",{className:c("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[a,z,f,l,q,ae,O]),So=react.useCallback(E=>{let ge={name:q.columns.name,status:q.columns.status,priority:q.columns.priority,assignees:q.columns.assignees,startDate:q.columns.startDate,endDate:q.columns.endDate,progress:q.columns.progress,tags:q.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:q.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:q.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:q.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:q.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:q.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:q.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:q.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:q.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:q.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:q.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:q.columns.weight||(f==="es"?"Peso":"Weight")}[E.type]||E.label;return typeof ge=="string"?ge:String(ge||E.type)},[q,f]),Jo=react.useMemo(()=>{let ge=I.reduce((Ie,ot)=>Ie+ot.width,0)+(v?48:0),Me={};for(let Ie of I)Me[Ie.id]=`${Ie.width/ge*100}%`;return Me},[I,v]);return r?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",z?"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-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:[q.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",z?"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:c("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",z?"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-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:c("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:q.empty.noTasks}),jsxRuntime.jsx("p",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:q.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Mt,className:c(z?"bg-[#0D0D0D]":"bg-white",Y&&"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:c("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:c("text-sm",z?"text-white/60":"text-gray-600"),children:[Vr.length," ",q.pagination.tasks]}),y&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:c("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:_e,onChange:E=>ke(E.target.value),placeholder:q.toolbar.searchPlaceholder,className:c("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",z?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&$>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:ne,onClick:()=>lt(!mt),className:c("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?mt?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":mt?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),it==="all"?f==="es"?"Todos":"All":`L${it}`]}),mt&&jsxRuntime.jsx("div",{ref:me,className:c("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min($,5)},(E,le)=>({value:le+1,label:`L${le+1}`}))].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{jt(E.value),lt(false);},className:c("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?it===E.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":it===E.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:E.label}),it===E.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(E.value)))})]}),jsxRuntime.jsx(Yg,{value:bt,hideCompleted:st,onChange:Bt,onHideCompletedChange:Ve,isDark:z,locale:f}),ee?.enabled&&ee.data&&!ue&&jsxRuntime.jsx("button",{onClick:()=>Te(true),className:c("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,S&&M&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:M,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:q.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:c("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Et&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),I.map(E=>{let le=E.id!=="name",ge=Z===E.id&&Yt!==E.id;return jsxRuntime.jsxs("div",{className:c("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",le&&"cursor-grab",E.type!=="name"&&"justify-center",Yt===E.id&&"opacity-50",ge&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Jo[E.id],minWidth:E.minWidth},draggable:le,onDragStart:le?Me=>Jt(Me,E.id):void 0,onDragEnd:le?Ua:void 0,onDragOver:le?Me=>ya(Me,E.id):void 0,onDragLeave:le?Ma:void 0,onDrop:le?Me=>Sr(Me,E.id):void 0,onContextMenu:Me=>Le(Me,void 0,E.id),children:[le&&jsxRuntime.jsx(lucideReact.GripVertical,{className:c("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxRuntime.jsxs("button",{draggable:false,onClick:Me=>{let Ie=Me.currentTarget.getBoundingClientRect();u(E.id,Ie);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[So(E),p?.includes(E.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:m,display:"inline-block",flexShrink:0}}),$e===E.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):E.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>te(E.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[So(E),p?.includes(E.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:m,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:c("w-3 h-3",$e===E.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[So(E),p?.includes(E.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:m,display:"inline-block",flexShrink:0}})]}),C&&E.resizable&&jsxRuntime.jsx("div",{className:c("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",Y===E.id&&"bg-[#00E5CC]"),onMouseDown:Me=>Nt(Me,E.id)})]},E.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:E=>{E.stopPropagation(),W(le=>!le);},className:c("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Fe&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Wg,{isOpen:Fe,onClose:()=>W(false),columns:tt,customFields:d,onColumnsChange:T,onCreateCustomField:()=>{W(false),j(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Vr.map((E,le)=>{let ge=Ae.has(E.id),Me=Math.min(le*.01,.2),Ie=E.hasChildren&&E.level===0,ot=E.subtasks?.length||0;if(Ie){let{spent:Dt,allocated:Vt,quoted:ia}=Zn(E),wt=gw(E);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":E.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Me},className:c("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",ve===E.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(E),children:[Et&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),I.map(rr=>jsxRuntime.jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",rr.type!=="name"&&"justify-center"),style:{width:Jo[rr.id],minWidth:rr.minWidth},children:rr.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Da=>{Da.stopPropagation(),xe(E.id);},className:c("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ge?jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:c("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Da=>{Da.stopPropagation(),xe(E.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ge?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),E.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:E.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:c("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:E.name}),jsxRuntime.jsxs("span",{className:c("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",ot," ",f==="es"?ot===1?"Tarea":"Tareas":ot===1?"Item":"Items",")"]}),wt!==null&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",wt>=1?"text-[#32D74B] bg-[#32D74B]/10":wt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",wt.toFixed(2)]})]})]}):rr.type==="timeLoggedMinutes"?w==="financial"?(()=>{let Da=E.executedDollarsCanonical,dr=Da!=null?Math.round(Da):Math.round(X(E).dollarSpent);return dr>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",dr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:Dt>0?Dt:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E)}):rr.type==="soldEffortMinutes"?w==="financial"?(()=>{let Da=X(E),dr=Math.round(Da.dollarQuoted);return dr>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",dr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:ia>0?ia:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E)}):rr.type==="effortMinutes"?w==="financial"?(()=>{let Da=X(E),dr=Math.round(Da.dollarAllocated),Qo=Math.round(Da.dollarQuoted),Ar=Qo-dr;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[dr>0?jsxRuntime.jsxs("span",{className:c("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",dr.toLocaleString("es-CO")]}):null,Ar!==0&&dr>0&&Qo>0&&jsxRuntime.jsxs("span",{className:c("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(Dr,{value:Vt>0?Vt:void 0,isDark:z,locale:f,disabled:true,lens:w,hourlyRate:B(E)}):as(E,rr)},rr.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},E.id)}let be=H===E.id,Je=He===E.id,et=Je&&Be==="above",dt=Je&&Be==="below",Zt=Je&&Be==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":E.id,"data-listview-row":E.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Me},className:c("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",ve===E.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:be?.4:1,backgroundColor:Zt?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Zt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(E),onDoubleClick:()=>a.onTaskDoubleClick?.(E),onContextMenu:Dt=>Le(Dt,E),children:[et&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),dt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Et&&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:Dt=>Wt(E.id,Dt),style:{color:z?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),I.map(Dt=>jsxRuntime.jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Dt.type!=="name"&&"justify-center"),style:{width:Jo[Dt.id],minWidth:Dt.minWidth},children:Dt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&E.level>0&&jsxRuntime.jsx("div",{style:{width:`${E.level*24}px`},className:"flex-shrink-0"}),b&&E.hasChildren&&jsxRuntime.jsx("button",{onClick:Vt=>{Vt.stopPropagation(),xe(E.id);},className:c("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ge?jsxRuntime.jsx(lucideReact.ChevronDown,{className:c("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:c("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!E.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(E.wbsCode||E.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[E.wbsCode&&jsxRuntime.jsx("span",{className:c("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:E.wbsCode}),E.taskCode&&jsxRuntime.jsx("span",{className:c("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:E.taskCode})]}),jsxRuntime.jsx("span",{className:c("truncate",E.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",E.progress===100?z?"line-through text-white/50":"line-through text-gray-400":E.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:E.name}),E.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${E.tags[0].color}20`,color:E.tags[0].color},children:E.tags[0].name})]})]}):as(E,Dt)},Dt.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},E.id)})}),L&&Vr.length>0&&(()=>{let{spent:E,allocated:le,quoted:ge}=Ge,Me=le-E,Ie=Me<0,ot=Ie?`+${Qn(Math.abs(Me))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Qn(Me)} ${f==="es"?"AHORRADO":"SAVED"}`,be=w==="financial"&&_>0,Je=K?.spent!=null?K.spent:Ge.dollarSpent,et=K?.allocated!=null?K.allocated:Ge.dollarAllocated,dt=K?.quoted!=null?K.quoted:Ge.dollarQuoted,Zt=(ia,wt)=>{if(be){let rr=wt??ia/60*_;return `$${Math.round(rr).toLocaleString("es-CO")}`}return Qn(ia)},Dt=be?Math.abs(et-Je):0,Vt=be?`+$${Dt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ie?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:ot;return jsxRuntime.jsxs("div",{className:c("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Et&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),I.map(ia=>jsxRuntime.jsx("div",{className:c("flex items-center px-4 py-3",ia.type!=="name"&&"justify-center"),style:{width:Jo[ia.id],minWidth:ia.minWidth},children:ia.type==="name"?jsxRuntime.jsx("span",{className:c("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):ia.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:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Zt(E,be?Je:void 0)}),jsxRuntime.jsx("span",{className:c("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:c("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Zt(le,be?et:void 0)})]}),le>0&&jsxRuntime.jsx("span",{className:c("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ie?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:be?Vt:ot})]}):ia.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ge>0?Zt(ge,be?dt:void 0):"\u2013"}):ia.type==="effortMinutes"?(()=>{if(be&&ge>0&&le>0){let wt=Math.round(dt),rr=Math.round(et),Da=wt-rr,dr=wt>0?Math.round(Da/wt*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Zt(le,et)}),jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Da>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Da>=0?"+":"",Math.abs(Da)>=1e3?`$${(Da/1e3).toFixed(1)}K`:`$${Da}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",dr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:le>0?Zt(le,be?et:void 0):"\u2013"})})():ia.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:c("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:E>0?Zt(E,be?Je:void 0):"\u2013"}):ia.type==="progress"?(()=>{let wt=r0(fc(e||[]));return jsxRuntime.jsxs("span",{className:c("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[wt,"%"]})})():ia.type==="weight"?(()=>{let wt=e||[],rr=[],Da=bo=>{for(let ao of bo)rr.push(ao),ao.subtasks?.length&&Da(ao.subtasks);};Da(wt);let Qo=rr.filter(bo=>!bo.subtasks?.length||bo.subtasks.length===0).reduce((bo,ao)=>bo+(ao.weight||0),0),Ar=Math.abs(Qo-100)<.1;return jsxRuntime.jsxs("span",{className:c("text-[12px] font-bold font-mono",Ar?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Qo.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:c("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},ia.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Vr.length===0&&_e&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:c("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:c(z?"text-white/60":"text-gray-600"),children:q.empty.noResults})]})})]})}),ee?.enabled&&ee.data&&ue&&jsxRuntime.jsx(Jg,{data:ee.data,isDark:z,locale:f,onClose:()=>Te(false),lens:t?.lens,onUnassignedTaskClick:E=>{let le=document.querySelector(`[data-task-id="${E}"]`);le&&(le.scrollIntoView({behavior:"smooth",block:"center"}),Ue(E),setTimeout(()=>Ue(null),2e3));}})]}),jsxRuntime.jsx(Ag,{state:re,onClose:$t,isDark:z,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:J,onColumnSort:Ce,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),je&&ut&&H&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=Ee.flattenTasks(e).find(ge=>ge.id===H);return le?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:le.name})]}):null})()}),document.body),jsxRuntime.jsx(jg,{isOpen:D,onClose:()=>j(false),onSave:Wr,isDark:z,locale:f})]})}var i0=[{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}],l0=[{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"}],d0=[{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 bc={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},hc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},yc={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"},al={dark:bc,light:hc,neutral:yc};function c0(e){return al[e]||al.dark}var xc={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"}},vc={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"}},rl={en:xc,es:vc};function Rs(e){return rl[e]||rl.en}function ol(e,t){let a=Rs(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 u0(e){let t=Rs(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 p0(e,t=0,a=true){let r=Rs(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 Os(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 kc(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 f0({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:c("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var y0=26,Cw=22,Tw=10;function b0(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 Cc(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 x0(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 h0(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 Nw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:d,spanCols:i,lane:u,isStart:p,isEnd:m}=e,g=d.progress===100||d.status==="completed",f=d.isCriticalPath,x=p&&m?"rounded":p?"rounded-l":m?"rounded-r":"",y=m?Cc(d.effortMinutes,n,l):null,b=m?x0(d,n,l):null,h=m?d.blockers?.find(v=>v.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:c("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":f?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-[#00E5CC]"),style:{top:`${u*y0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Cw}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)"}:f?{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:p?"3px":void 0,borderLeftColor:p?f?"#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(0, 229, 204, 0.7), 0 0 12px rgba(0, 229, 204, 0.2)",zIndex:20}:{}},children:[f&&p&&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:d.name}),m&&(y||b)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[y&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",y]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:c(b.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:b.text})]})]}),h&&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,": ",h.type]}),d.progress>0&&d.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${d.progress}%`}})]})}function v0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:d=[],onCreateTag:i,attachmentsByTask:u,comments:p,onAddComment:m,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,onTaskOpen:y,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,timerState:C,onLogTime:N,onUpdateEstimate:S,onUpdateSoldEffort:M,onStartTimer:k,onStopTimer:F,onDiscardTimer:A,blurFinancials:w=false,suppressDetailModal:_=false,lens:U="hours",hourlyRate:ae=0}){let{theme:L="dark",locale:K="en",customTranslations:q,showBacklog:z=true}=t,B=ol(K,q),X=L==="dark"||L==="neutral",[fe,Ge]=react.useState(r||new Date),[O,ee]=react.useState(null),[ue,Te]=react.useState(null),[ve,Ue]=react.useState(null),[$e,nt]=react.useState({}),ce=3,Xe=3,_e=react.useCallback(H=>{Te(H.id),_||ee(H),y?.(H.id);},[_,y]),[ke,bt]=react.useState(null),Bt=react.useCallback(()=>{Ge(new Date(fe.getFullYear(),fe.getMonth()-1,1));},[fe]),st=react.useCallback(()=>{Ge(new Date(fe.getFullYear(),fe.getMonth()+1,1));},[fe]),Ve=react.useCallback(()=>{Ge(new Date);},[]),tt=react.useMemo(()=>{let H=fe.getFullYear(),se=fe.getMonth(),je=new Date(H,se,1),we=new Date(H,se+1,0),He=je.getDay(),ze=we.getDate(),Be=Os(e),ct=new Date;ct.setHours(0,0,0,0);let ut=[],ht=He,pt=new Date(H,se,0).getDate();for(let Et=ht-1;Et>=0;Et--){let Wt=new Date(H,se-1,pt-Et);ut.push({date:Wt,isCurrentMonth:false,isToday:false,isWeekend:Wt.getDay()===0||Wt.getDay()===6,events:Be.filter(St=>kc(Wt,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}for(let Et=1;Et<=ze;Et++){let Wt=new Date(H,se,Et),St=Wt.getTime()===ct.getTime();ut.push({date:Wt,isCurrentMonth:true,isToday:St,isWeekend:Wt.getDay()===0||Wt.getDay()===6,events:Be.filter(zt=>kc(Wt,zt)).map(zt=>({id:zt.id,title:zt.name,start:zt.startDate,end:zt.endDate,task:zt}))});}let Ct=42-ut.length;for(let Et=1;Et<=Ct;Et++){let Wt=new Date(H,se+1,Et);ut.push({date:Wt,isCurrentMonth:false,isToday:false,isWeekend:Wt.getDay()===0||Wt.getDay()===6,events:Be.filter(St=>kc(Wt,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}return ut},[fe,e]),Ke=react.useMemo(()=>Os(e).filter(H=>!H.startDate||!H.endDate),[e]),Fe=react.useMemo(()=>{let H=Os(e),se=0,je=0,we=0,He=0,ze=0;H.forEach(pt=>{pt.effortMinutes&&(se+=pt.effortMinutes),pt.soldEffortMinutes&&(je+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(we+=pt.scheduleVariance,He++),pt.soldEffortMinutes&&pt.effortMinutes&&(ze+=pt.soldEffortMinutes-pt.effortMinutes);});let Be=je>0?Math.min(100,Math.round(se/je*100)):0,ct=He>0?Math.round(we/He):0,ht=`${ze<0?"-":"+"}${h0(ze,U,ae)}`;return {budgetUtil:Be,avgVariance:ct,costDisplay:ht,hasCostData:je>0}},[e,U,ae]),W=react.useMemo(()=>{let H=[0,0,0,0,0,0];return tt.forEach((se,je)=>{let we=Math.floor(je/7);se.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let ze=new Date(He.task.startDate),Be=se.date;ze.getFullYear()===Be.getFullYear()&&ze.getMonth()===Be.getMonth()&&ze.getDate()===Be.getDate()&&we<H.length&&(H[we]-=He.task.soldEffortMinutes);}});}),H},[tt]),D=react.useMemo(()=>{let H=Os(e),se=new Map,je=new Set,we=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:se,multiDayTaskIds:je,maxLanesPerRow:we};let He=ht=>new Date(ht.getFullYear(),ht.getMonth(),ht.getDate()),ze=He(tt[0].date),Be=He(tt[tt.length-1].date),ct=[];for(let ht of H){if(!ht.startDate||!ht.endDate)continue;let pt=He(ht.startDate),Ct=He(ht.endDate);if(pt.getTime()===Ct.getTime()||Ct<ze||pt>Be)continue;let Et=pt<ze?ze:pt,Wt=Ct>Be?Be:Ct,St=b0(Et,ze),zt=b0(Wt,ze);St<0||St>41||zt<0||zt>41||St!==zt&&(je.add(ht.id),ct.push({task:ht,startIdx:St,endIdx:zt}));}ct.sort((ht,pt)=>ht.startIdx!==pt.startIdx?ht.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(ht.endIdx-ht.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:ht,startIdx:pt,endIdx:Ct}of ct){let Et=Math.floor(pt/7),Wt=Math.floor(Ct/7),St=He(ht.startDate),zt=He(ht.endDate),it=false;for(let jt=Et;jt<=Wt;jt++){let mt=jt===Et?pt%7:0,lt=jt===Wt?Ct%7:6,ne=lt-mt+1,me=0,$=ut[jt]??[];for(ut[jt]||(ut[jt]=$);me<$.length&&($[me]??-1)>=mt;)me++;if(me>=Tw){it=true;break}me>=$.length?$.push(lt):$[me]=lt,we[jt]=Math.max(we[jt]??0,me+1);let Y=jt===Et&&St>=ze,Se=jt===Wt&&zt<=Be,Ze=jt*7+mt,gt={taskId:ht.id,task:ht,rowIndex:jt,startCol:mt,endCol:lt,spanCols:ne,lane:me,isStart:Y,isEnd:Se};se.has(Ze)||se.set(Ze,[]),se.get(Ze).push(gt);}it&&(je.delete(ht.id),se.forEach((jt,mt)=>{let lt=jt.filter(ne=>ne.taskId!==ht.id);lt.length===0?se.delete(mt):se.set(mt,lt);}));}return {segmentsByCell:se,multiDayTaskIds:je,maxLanesPerRow:we}},[tt,e]),j=K==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],re=fe.toLocaleDateString(K==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ne=re.charAt(0).toUpperCase()+re.slice(1);return o?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",X?"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:c("text-sm font-mono",X?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",X?"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:c("w-12 h-12 rounded-full flex items-center justify-center",X?"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:c("text-lg font-semibold mb-2",X?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:c("text-sm",X?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:c("flex-1 flex items-center justify-center",X?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:c("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",X?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-[#00E5CC]/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-8 h-8",X?"text-[#007FFF]":"text-[#00E5CC]")})}),jsxRuntime.jsx("h3",{className:c("text-lg font-semibold mb-2",X?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:c("text-sm",X?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:c("flex-1 flex flex-col w-full h-full overflow-hidden",X?"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:c("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",X?"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:c("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",X?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-3.5 h-3.5",X?"text-[#007FFF]":"text-[#00E5CC]")}),jsxRuntime.jsx("span",{className:c("font-medium",X?"text-white":"text-gray-900"),children:K==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:c("h-4 w-px",X?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Bt,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",X?"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:c("text-sm font-semibold tracking-tight min-w-[150px] text-center",X?"text-white":"text-gray-900"),children:Ne}),jsxRuntime.jsx("button",{onClick:st,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",X?"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:c("h-4 w-px",X?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:Ve,className:c("px-2.5 py-1 text-xs rounded-md transition-all font-medium",X?"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:c("grid grid-cols-7 sticky top-0 z-10",X?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:j.map(H=>jsxRuntime.jsx("div",{className:c("py-2 text-center text-[10px] font-bold uppercase tracking-widest",X?"text-white/60 font-mono":"text-gray-500"),children:H},H))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:c("grid grid-cols-7 min-h-[800px]",X?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Te(null),children:tt.map((H,se)=>{let je=se%7===6,we=se>=35;return jsxRuntime.jsxs("div",{className:c("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!je&&(X?"border-r border-[#222]":"border-r border-gray-200"),!we&&(X?"border-b border-[#222]":"border-b border-gray-200"),X?H.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":H.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",H.isToday&&X&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",H.isToday&&!X&&"ring-2 ring-[#00E5CC] ring-inset"),children:[jsxRuntime.jsx("span",{className:c("text-xs font-mono select-none relative z-20",H.isToday?X?"text-[#007FFF] font-bold":"text-[#00C4AE] font-bold":H.isCurrentMonth?X?"text-white/60":"text-gray-900":X?"text-white/20":"text-gray-400"),children:String(H.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(se/7),ze=(D.maxLanesPerRow[He]??0)*y0,Be=D.segmentsByCell.get(se);return ze===0&&!Be?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${ze}px`,zIndex:5},children:Be?.map(ct=>jsxRuntime.jsx(Nw,{segment:ct,isDark:X,blurFinancials:w,isSelected:ue===ct.taskId,t:B,lens:U,hourlyRate:ae,onClick:()=>{_e(ct.task),a.onEventClick?.({id:ct.task.id,title:ct.task.name,start:ct.task.startDate,end:ct.task.endDate,task:ct.task});}},ct.taskId))})})(),(()=>{let He=H.events.filter(ze=>ze.task.isMilestone&&!D.multiDayTaskIds.has(ze.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(ze=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:ze.title,onClick:Be=>{Be.stopPropagation(),_e(ze.task);}},ze.id)),He.length>4&&jsxRuntime.jsxs("span",{className:c("text-[8px] font-mono",X?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];H.events.forEach(Be=>{Be.task.blockers?.forEach(ct=>{(ct.severity==="warning"||ct.severity==="critical")&&He.push({taskId:Be.id,type:ct.type,severity:ct.severity,variance:Be.task.scheduleVariance});});});let ze=He[0];return ze?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:c("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",ze.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,": ",ze.type,ze.variance?` (+${Math.abs(ze.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let He=H.events.filter(ut=>!D.multiDayTaskIds.has(ut.id)),ze=$e[se]||ce,Be=He.slice(0,ze),ct=He.length-ze;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Be.map(ut=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{_e(ut.task),a.onEventClick?.(ut);},whileHover:{scale:1.01},className:c("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ut.task.progress===100||ut.task.status==="completed"?X?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":X?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:X?ut.task.progress===100||ut.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)"}:ut.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:c("flex-shrink-0 text-[9px]",ut.task.isMilestone?X?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":X?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),ct>0&&jsxRuntime.jsxs("button",{onClick:ut=>{ut.stopPropagation(),nt(ht=>({...ht,[se]:ze+Xe}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",X?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ct," ",K==="es"?"m\xE1s":"more"]}),ze>ce&&He.length>ce&&jsxRuntime.jsx("button",{onClick:ut=>{ut.stopPropagation(),nt(ht=>({...ht,[se]:ce}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",X?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:K==="es"?"menos":"less"})]})})(),H.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=se>=28,ze=se%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Be=>{Be.stopPropagation(),bt(ke===se?null:se);},className:c("w-5 h-5 rounded flex items-center justify-center transition-all",ke===se?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",X?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-[#00E5CC] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:c("w-3.5 h-3.5 transition-transform",ke===se&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>bt(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:c("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",ze?"right-0":"left-0",X?"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(sn,{onSubmit:Be=>{a.onTaskCreate?.({name:Be.name,startDate:Be.startDate||H.date,endDate:Be.endDate||H.date,priority:Be.priority,assignees:Be.assignee?[Be.assignee]:void 0}),bt(null);},onCancel:()=>bt(null),availableUsers:t.availableUsers,isDark:X,locale:K==="es"?"es":"en",defaultDate:H.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),se%7===6&&(()=>{let He=Math.floor(se/7),ze=W[He];if(!ze||ze===0)return null;let Be=h0(ze,U,ae);return jsxRuntime.jsxs("div",{className:c("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",ze<0?"text-red-400":"text-emerald-400",w&&"blur-sm select-none"),children:[B.labels.cashOut,": ",ze<0?"-":"+",Be]})})()]},se)})})})]}),z&&jsxRuntime.jsxs("aside",{className:c("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",X?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:c("flex-shrink-0 h-14 flex items-center justify-between px-4",X?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",X?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:c("text-[10px] font-mono tabular-nums",X?"text-white/20":"text-gray-400"),children:Ke.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ke.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:c("w-10 h-10 rounded-xl flex items-center justify-center mb-3",X?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:c("w-5 h-5",X?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:c("text-xs font-mono",X?"text-white/20":"text-gray-400"),children:K==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ke.map(H=>jsxRuntime.jsxs("button",{onClick:()=>{_e(H);},className:c("w-full text-left rounded-md p-3 transition-all group/card",X?"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:c("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",X?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:c("text-sm font-medium leading-snug line-clamp-2",X?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:H.name})]}),H.tags&&H.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[H.tags.slice(0,3).map(se=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${se.color}15`,color:se.color,border:`1px solid ${se.color}30`},children:se.name},se.id)),H.tags.length>3&&jsxRuntime.jsxs("span",{className:c("text-[9px] font-mono px-1 py-0.5",X?"text-white/20":"text-gray-400"),children:["+",H.tags.length-3]})]}),(H.effortMinutes||H.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:c("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",X?"text-white/25":"text-gray-400",w&&"blur-sm select-none"),children:[Cc(H.effortMinutes,U,ae)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",Cc(H.effortMinutes,U,ae)]}),(()=>{let se=x0(H,U,ae);return se?jsxRuntime.jsx("span",{className:se.isNegative?"text-red-400":"text-emerald-400",children:se.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:[H.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:c("w-3 h-3",H.priority==="urgent"||H.priority==="high"?"text-red-400":H.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(f0,{task:H,isDark:X})]}),H.assignees&&H.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,2).map((se,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:se.color||"#007FFF"},title:se.name,children:se.initials||se.name?.slice(0,2).toUpperCase()},je))})]})]},H.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:c("flex-shrink-0 px-3 py-2.5 border-t",X?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:c("w-full text-[11px] font-mono bg-transparent outline-none",X?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:H=>{H.key==="Enter"&&H.target.value.trim()&&(a.onTaskCreate?.({name:H.target.value.trim()}),H.target.value="");}})}),Fe.hasCostData&&jsxRuntime.jsxs("div",{className:c("flex-shrink-0 px-4 py-3 border-t space-y-2.5",X?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",X?"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:c("text-[10px] font-mono",X?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:c("text-[10px] font-mono font-bold tabular-nums",X?"text-white/60":"text-gray-700",w&&"blur-sm select-none"),children:[Fe.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:c("h-1.5 rounded-full overflow-hidden",X?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fe.budgetUtil}%`,background:Fe.budgetUtil>90?"#EF4444":Fe.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #00E5CC, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",X?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",X?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Fe.avgVariance>0?"text-emerald-400":Fe.avgVariance<0?"text-red-400":X?"text-white/50":"text-gray-600"),children:[Fe.avgVariance>0?"+":"",Fe.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",X?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",X?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Fe.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",w&&"blur-sm select-none"),children:Fe.costDisplay})]})]})]})]})]}),!_&&jsxRuntime.jsx(vo,{task:O,isOpen:!!O,onClose:()=>ee(null),onTaskUpdate:H=>{a.onTaskUpdate?.(H),ee(H);},theme:L==="dark"?"dark":"light",locale:K,availableUsers:t.availableUsers?.map(H=>({id:H.id,name:H.name,avatar:H.avatar,initials:H.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:d,onCreateTag:i,attachments:O?u?.get(O.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Os(e).filter(H=>H.id!==O?.id),comments:p?.filter(H=>H.taskId===O?.id).map(H=>({...H,createdAt:H.createdAt instanceof Date?H.createdAt:new Date(H.createdAt),updatedAt:H.updatedAt instanceof Date?H.updatedAt:H.updatedAt?new Date(H.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:S,onSoldEffortUpdate:M,onTimerStart:k,onTimerStop:F,onTimerDiscard:A,blurFinancials:w}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ue(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:c("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",X?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between",X?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:c("font-medium text-sm",X?"text-white/90":"text-gray-900"),children:ve.date.toLocaleDateString(K==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ue(null),className:c("p-1 rounded",X?"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:ve.events.map(H=>jsxRuntime.jsxs("button",{onClick:()=>{Ue(null),_e(H.task);},className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",X?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(f0,{task:H.task,isDark:X}),jsxRuntime.jsx("span",{className:c("text-sm truncate flex-1",X?"text-white/80":"text-gray-900"),children:H.title}),(H.task.priority==="high"||H.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},H.id))})]})]})})]})}var Tc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 229, 204, 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, 229, 204, 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, 229, 204, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Nc={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, 229, 204, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},Dc={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)"},il={dark:Tc,light:Nc,neutral:Dc};function w0(e){return il[e]||il.dark}function Sw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[d,i]=react.useState(false),u=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),p=react.useMemo(()=>{let g=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,x=u.map(b=>b.priority).filter(Boolean),y=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:f,priorities:x,labels:y}},[u]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:c("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:c("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:p.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),d&&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:[p.uniqueAssignees," assignees"]})]}),p.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[p.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(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:f=>{f.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 C0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function zs(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 Us(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 T0(e){return {created:"#10b981",status_changed:"#00E5CC",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 N0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let d=react.useMemo(()=>({...C0,...n}),[n]),[i,u]=react.useState(new Set),p=react.useRef(null),m=react.useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let C=v.timestamp.toISOString().split("T")[0],N=h.get(C);N?N.push(v):h.set(C,[v]);}),Array.from(h.entries()).sort((v,C)=>C[0].localeCompare(v[0])).map(([v,C])=>({date:new Date(v),events:C.sort((N,S)=>S.timestamp.getTime()-N.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:g,uniqueTypes:f}=react.useMemo(()=>{let h=new Set,v=new Set;return e.forEach(C=>{h.add(C.userId),v.add(C.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{u(v=>{let C=new Set(v);return C.has(h)?C.delete(h):C.add(h),C});},y=h=>{let C=new Date().getTime()-h.getTime(),N=Math.floor(C/6e4),S=Math.floor(C/36e5),M=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:S<24?`${S}h ago`:M<7?`${M}d ago`:h.toLocaleDateString()},b=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&p.current){let h=p.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:c("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:c("history-timeline",d.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:h=>{let v=h.target.value;a({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxRuntime.jsxs("option",{value:h,children:[Us(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:p,children:m.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[d.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((v,C)=>{let N=i.has(v.id),S=s===v.id,M=T0(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:c("history-timeline-event",N&&"expanded",S&&"selected"),onClick:()=>o?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:M},children:d.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Us(v.type)})}),C<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:M}})]}),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:[d.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:zs(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.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(([k,F])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),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)})]})]},k)),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(([k,F])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(F)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function S0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:d,className:i}){let u=[.5,1,1.5,2,3],p=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:c("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:c("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:p&&Us(p.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:p&&zs(p)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:p&&p.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange: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,f)=>jsxRuntime.jsx("div",{className:c("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:zs(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:u.map(g=>jsxRuntime.jsxs("button",{className:c("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>d(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:p&&p.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:c("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 Sc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Ec(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 E0(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 M0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Lw(e,t,a,r,o,s=100){let n=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(d=>[d.id,d]));for(let d=0;d<s;d++){let i=1-d/s;n.forEach(u=>{let p=a/2,m=r/2;u.vx+=(p-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let f=u.x-g.x,x=u.y-g.y,y=Math.sqrt(f*f+x*x)||1,b=o.chargeStrength*i/(y*y);u.vx+=f/y*b,u.vy+=x/y*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),m=l.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!m)return;let g=m.x-p.x,f=m.y-p.y,x=Math.sqrt(g*g+f*f)||1,y=(x-o.linkDistance)/x*o.forceStrength*i;p.vx+=g*y,p.vy+=f*y,m.vx-=g*y,m.vy-=f*y;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function P0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:d}){let i=react.useRef(null),[u,p]=react.useState([]),[m,g]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(1),[C,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Lw(e,t,a.width,a.height,a,150);p(U);},[e,t,a]);let S=react.useCallback((U,ae)=>{a.enableDragging&&(ae.stopPropagation(),g(U));},[a.enableDragging]),M=react.useCallback(U=>{if(!m||!i.current)return;let L=i.current.getBoundingClientRect(),K=(U.clientX-L.left-C.x)/h,q=(U.clientY-L.top-C.y)/h;p(z=>z.map(B=>B.id===m?{...B,x:K,y:q,fx:K,fy:q}:B));},[m,h,C]),k=react.useCallback(()=>{g(null);},[]),F=react.useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"node-click",node:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),A=react.useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"edge-click",edge:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),w=react.useCallback(U=>{let ae=u.find(L=>L.id===U);return ae?{x:ae.x,y:ae.y}:{x:0,y:0}},[u]),_=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ae=U.card.priority;return ae==="URGENT"?"#ef4444":ae==="HIGH"?"#f59e0b":ae==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:c("relationships-graph-empty",d),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:c("relationships-graph",d),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(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(U=>Math.max(U-.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(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Sc(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[E0(U)," ",Ec(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:M,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let ae=w(typeof U.source=="string"?U.source:U.source.id),L=w(typeof U.target=="string"?U.target:U.target.id),K=M0(U.type),q=y===U.id,z=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:c("relationships-graph-edge",q&&"hovered",z&&"critical"),onMouseEnter:()=>b(U.id),onMouseLeave:()=>b(null),onClick:B=>A(U,B),children:[jsxRuntime.jsx("line",{x1:ae.x,y1:ae.y,x2:L.x,y2:L.y,stroke:Sc(U.type),strokeWidth:z?a.edgeWidth*2:a.edgeWidth,strokeOpacity:q?1:.6,markerEnd:K?"url(#arrowhead)":void 0}),a.showEdgeLabels&&q&&jsxRuntime.jsx("text",{x:(ae.x+L.x)/2,y:(ae.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ec(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(U=>{let ae=f===U.id,L=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:c("relationships-graph-node",ae&&"hovered",L&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:K=>S(U.id,K),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:K=>F(U,K),children:[jsxRuntime.jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:_(U),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ae?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 L0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,d]=react.useState(false),[i,u]=react.useState(null),[p,m]=react.useState(null),g=react.useRef(null),f=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let x=()=>{f||(n(""),u(null),m(null),t());},y=async()=>{if(!(!s.trim()||f)){d(true),u(null),m(null);try{let h=await r(s.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{d(false);}}},b=()=>{p&&(a(p),x());};return e?jsxRuntime.jsxs(ta,{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:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),p.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((h,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:h.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((h,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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},v)),p.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,v)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:f,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),p?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Mc={"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 Bw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Rw={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 $w(e,t,a){let r=Mc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ws(e){return `$${e.toFixed(4)}`}var Pc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=$w(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(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let r=a.length,o=a.reduce((p,m)=>p+m.cost,0),s=a.reduce((p,m)=>p+m.inputTokens,0),n=a.reduce((p,m)=>p+m.outputTokens,0),l=a.filter(p=>p.success),d=a.reduce((p,m)=>p+m.duration,0),i={},u={};return a.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?d/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(u=>u.timestamp>=n).length,d=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:d,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)}},hn=new Pc;function R0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(hn.getStats()),[s,n]=react.useState(hn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let d=setInterval(()=>{o(hn.getStats()),n(hn.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),react.useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let l=hn.getRecentOperations(5);return jsxRuntime.jsxs(ta,{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:d=>d.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ws(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([d,i])=>{let u=r.costsByFeature[d]||0,p=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:d.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:Ws(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},d)})})]}),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(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ws(d.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 H0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[d,i]=react.useState(""),[u,p]=react.useState(""),[m,g]=react.useState(false),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(null),C=react.useRef(null),N=m||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let A=w=>{w.key==="Escape"&&!N&&S();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,N]);let S=()=>{N||(l(""),i(""),p(""),x(null),b(null),v(null),t());},M=async()=>{if(!(!n.trim()||N)){g(true),x(null),b(null),v(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:d||void 0,endDate:u||void 0});b(A.tasks.tasks),v({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){x(A instanceof Error?A.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{y&&(a(y),S());};if(!e)return null;let F=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ta,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),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:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:S,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:y?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:[h?.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"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((A,w)=>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:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:A.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"})]}),A.start," \u2192 ",A.end]}),jsxRuntime.jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:A.priority})]})},A.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:A=>l(A.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled: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:d,onChange:A=>i(A.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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:u,onChange:A=>p(A.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:N})]})]}),f&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((A,w)=>jsxRuntime.jsx("button",{onClick:()=>l(A),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:A},w))})]})]})}),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-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:S,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"}),y?jsxRuntime.jsx("button",{onClick:k,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:M,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, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function cl({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&Qs(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(y,b,h)=>{r(v=>{let C=v.cards.find(A=>A.id===y);if(!C)return v;let N=C.columnId,S={...C,columnId:b,position:h},M=v.cards.map(A=>A.id===y?S:A),k=v.columns.map(A=>{if(A.id===N)return {...A,cardIds:A.cardIds.filter(w=>w!==y)};if(A.id===b){let w=M.filter(_=>_.columnId===b).sort((_,U)=>_.position-U.position);return {...A,cardIds:w.map(_=>_.id)}}return A}),F={...v,cards:M,columns:k};return o(F),F});},[o]),n=react.useCallback(async(y,b)=>{r(h=>{let v=h.cards.map(N=>N.id===y?{...N,...b}:N),C={...h,cards:v};return o(C),C});},[o]),l=react.useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b},C=h.columns.map(S=>S.id===y.columnId?{...S,cardIds:[...S.cardIds,b]}:S),N={...h,cards:[...h.cards,v],columns:C};return o(N),N});},[o]),d=react.useCallback(async y=>{r(b=>{let h=b.cards.find(S=>S.id===y);if(!h)return b;let v=b.cards.filter(S=>S.id!==y),C=b.columns.map(S=>S.id===h.columnId?{...S,cardIds:S.cardIds.filter(M=>M!==y)}:S),N={...b,cards:v,columns:C};return o(N),N});},[o]),i=react.useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b,cardIds:[]},C={...h,columns:[...h.columns,v]};return o(C),C});},[o]),u=react.useCallback(async(y,b)=>{r(h=>{let v=h.columns.map(N=>N.id===y?{...N,...b}:N),C={...h,columns:v};return o(C),C});},[o]),p=react.useCallback(async y=>{r(b=>{let h=b.cards.filter(N=>N.columnId!==y),v=b.columns.filter(N=>N.id!==y),C={...b,cards:h,columns:v};return o(C),C});},[o]),m=react.useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),b},[l]),g=react.useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=react.useCallback(()=>{r(y=>{let b={...y,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:d,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:d,deleteColumn:p,clearBoard:f}}}function U0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=cl({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(d,i,u={})=>{s.addCard({title:i,columnId:d,position:r.cards.filter(p=>p.columnId===d).length,...u});},addColumn:(d,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:d,position:i??u+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 Vs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},V0={by:"none",order:"asc"};function G0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Vs,...e}),[s,n]=react.useState({...V0,...t}),l=react.useCallback(x=>{o(y=>({...y,...x}));},[]),d=react.useCallback(x=>{n(y=>({...y,...x}));},[]),i=react.useCallback(()=>{o(Vs),n(V0);},[]),u=react.useCallback(()=>{a&&o({...Vs,assignees:[a]});},[a]),p=react.useCallback(()=>{o({...Vs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...Vs,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]),f=react.useCallback(x=>{let y=[...x];if(r.search){let b=r.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),C=String(b.getDate()).padStart(2,"0"),N=`${h}-${v}-${C}`;y=y.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let M=S.endDate||S.dueDate;if(!M)return false;let k;if(typeof M=="string")k=M.split("T")[0]||M;else {let F=M.getUTCFullYear(),A=String(M.getUTCMonth()+1).padStart(2,"0"),w=String(M.getUTCDate()).padStart(2,"0");k=`${F}-${A}-${w}`;}switch(r.dateFilter){case "overdue":return k<N;case "today":return k===N;case "this-week":let F=new Date(N+"T00:00:00"),A=new Date(k+"T00:00:00"),w=new Date(F);return w.setDate(w.getDate()+7),A>=F&&A<=w;case "custom":if(r.dateRange){let _=typeof M=="string"?new Date(M):M;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(y=y.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let C=b.createdAt?new Date(b.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;v=C-N;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},M=S[b.priority||"LOW"],k=S[h.priority||"LOW"];v=M-k;break;case "dueDate":let F=b.endDate||b.dueDate,A=h.endDate||h.dueDate;if(!F)return 1;if(!A)return -1;let w=typeof F=="string"?new Date(F).getTime():F.getTime(),_=typeof A=="string"?new Date(A).getTime():A.getTime();v=w-_;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let U=b.estimatedTime||0,ae=h.estimatedTime||0;v=U-ae;break;default:v=0;}return s.order==="asc"?v:-v}),y},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:d,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:m,applyFilters:f,hasActiveFilters:g}}var _0,K0;if(typeof window<"u")try{let e=Ys("ai");_0=e.generateObject,K0=e.generateText;}catch{}function q0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(_0&&K0&&e.apiKey),n=react.useCallback(async p=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",p),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(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 p=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",p.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]),d=react.useCallback(async p=>{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 p=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",p.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:d,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Ac(){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 Y0(e){let{cards:t}=e,[a,r]=Ac(),o=react.useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=react.useCallback((p,m)=>{if(!m){r({selectedCardIds:[p],lastSelectedCardId:p});return}let g=m.ctrlKey||m.metaKey,f=m.shiftKey;if(g)a.selectedCardIds.includes(p)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==p),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let x=t.find(b=>b.id===p),y=t.find(b=>b.id===a.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,F)=>k.position-F.position),h=b.findIndex(k=>k.id===a.lastSelectedCardId),v=b.findIndex(k=>k.id===p),[C,N]=h<v?[h,v]:[v,h],S=b.slice(C,N+1).map(k=>k.id),M=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:M,lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,r]),n=react.useCallback(p=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=react.useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(p=>{a.selectedCardIds.includes(p)?n(p):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,n,r]),u=react.useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:d,toggleCard:i,getSelectedCards:u}}var X0={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(()=>({...X0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((x,y,b,h,v)=>{if(y.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:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),d=react.useCallback(x=>{n(y=>y.filter(b=>b.id!==x));},[]),i=react.useCallback(x=>{n(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((x,y)=>{n(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),p=react.useCallback((x,y)=>{n(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(C=>C!==y);return v.length<o.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),m=react.useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),g=react.useCallback(async x=>{let y=t.filter(N=>N.columnId===x);if(y.length<o.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(S=>{h.has(S)||h.set(S,[]),h.get(S).push(N);});}),h.forEach((N,S)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:N.map(M=>M.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${N.length} cards with label "${S}"`,confidence:.85});});let v=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(S=>{v.has(S)||v.set(S,[]),v.get(S).push(N);});}),v.forEach((N,S)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:N.map(M=>M.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(y.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,S)=>{if(N.length>=o.minCardsPerStack){let M={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";b.push({stack:{title:`${M} ${S} Priority`,cardIds:N.map(k=>k.id),columnId:x,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of y){let M=(await r.findSimilar(N,y)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(M.length>=o.minCardsPerStack-1){let k=[N.id,...M.map(A=>A.card.id)],F=M.reduce((A,w)=>A+w.similarity,0)/M.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${M.length+1} similar tasks`,confidence:F});}}return b.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,S)=>S.confidence-N.confidence).slice(0,5)},[t,o,r]),f=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(y=>y.columnId)).forEach(async y=>{let b=await g(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:l,deleteStack:d,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:m,getSuggestions:g,applySuggestion:f,config:o}}var Q0=react.createContext(null);function Z0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(d=>{let{Column:i}=Ys("@libxai/core");s.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=Ys("@libxai/core");n.set(d.id,new i(d));});let l=null;if(t?.board){let{Board:d}=Ys("@libxai/core");l=new d(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(Q0.Provider,{value:{store:o},children:e})}function ul(){let e=react.useContext(Q0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function js(){let e=ul(),[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(h=>{e.updateBoard(h);},[e]),d=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,v)=>{e.updateColumn(h,v);},[e]),u=react.useCallback(h=>{e.deleteColumn(h);},[e]),p=react.useCallback(h=>e.getColumn(h),[e]),m=react.useCallback(h=>{e.addCard(h);},[e]),g=react.useCallback((h,v)=>{e.updateCard(h,v);},[e]),f=react.useCallback(h=>{e.deleteCard(h);},[e]),x=react.useCallback((h,v,C)=>{e.moveCard(h,v,C);},[e]),y=react.useCallback(h=>e.getCard(h),[e]),b=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:d,updateColumn:i,deleteColumn:u,getColumn:p,addCard:m,updateCard:g,deleteCard:f,moveCard:x,getCard:y,getCardsByColumn:b}}function tf(e){let{cards:t}=js();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 af(e="position",t="asc"){let{cards:a}=js();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},d=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=d-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 pl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=mu.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);}},e5=new pl;function of({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:d}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),p=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:p.map(f=>{let x=e[f.index];if(!x)return null;let y=d?d(x,f.index):f.index,b={position:"absolute",top:n?0:f.start,left:n?f.start:0,width:n?f.size:"100%",height:n?"100%":f.size};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:r(x,f.index)},y)})})})}function nf(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 lf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:d,horizontal:i=true}){let u=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:l}),m=p.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:g,className:s,children:jsxRuntime.jsx("div",{style:f,children:m.map(x=>{let y=e[x.index];if(!y)return null;let b=d?d(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":x.index,children:o(y,x.index)},b)})})})}function df(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 cf(e,t=10){return e>t}var Rc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$c={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Oc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Hc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},zc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Uc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Wc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Vc={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)"},Gc={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)"},jc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},_c={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}},Kc={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}},ml={spacing:Rc,borderRadius:$c,fontSize:Oc,fontWeight:Hc,lineHeight:zc,zIndex:Uc,duration:Wc,easing:Vc,shadows:Gc,opacity:jc,kanban:_c,gantt:Kc};function uf(e,t,a){return e[t]??a}function qc(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)?qc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function r5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Yc(e="asakaa"){let t=qc(ml),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=r5(o);a.push(` ${s}: ${n};`);}return `:root {
434
434
  ${a.join(`
435
435
  `)}
436
436
  }`}function _s(e,t="asakaa"){let a=[],r=qc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
437
437
  ${a.join(`
438
438
  `)}
439
- }`}var gl={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"}},Xc={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 Qc(e=gl,t="asakaa"){let a=Yc(t),r=_s(e,t);return `${a}
439
+ }`}var gl={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},Xc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},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:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function Qc(e=gl,t="asakaa"){let a=Yc(t),r=_s(e,t);return `${a}
440
440
 
441
441
  ${r}`}function pf(){return `/**
442
442
  * ASAKAA Design Tokens
@@ -460,5 +460,5 @@ ${_s(Jc,"asakaa").split(`
460
460
  `)}
461
461
  }
462
462
  `}var o5=({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 mf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Bn();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let d=n,i=d===r;return jsxRuntime.jsxs("button",{onClick:()=>o(d),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(o5,{theme:d})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},d)})})}
463
- 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=R0;exports.AI_FEATURES=Rw;exports.AI_MODELS=Mc;exports.AddCardButton=Jl;exports.AddColumnButton=_l;exports.AttachmentUploader=lo;exports.BoardProvider=Z0;exports.BulkOperationsToolbar=wi;exports.BurnDownChart=dd;exports.CUSTOM_FIELD_TYPES=d0;exports.CalendarBoard=v0;exports.Card=yo;exports.CardDetailModal=rd;exports.CardDetailModalV2=sd;exports.CardHistoryReplay=S0;exports.CardHistoryTimeline=N0;exports.CardRelationshipsGraph=F0;exports.CardStack=Sw;exports.CardTemplateSelector=bd;exports.CircuitBreaker=Nl;exports.Column=En;exports.ColumnManager=Si;exports.CommandPalette=ed;exports.ConfigMenu=vd;exports.ContextMenu=Hn;exports.DEFAULT_SHORTCUTS=xs;exports.DEFAULT_TABLE_COLUMNS=i0;exports.DEFAULT_TEMPLATES=fd;exports.DateRangePicker=ns;exports.DependenciesSelector=is;exports.DependencyLine=Ds;exports.DistributionCharts=cd;exports.EditableColumnTitle=Ll;exports.ErrorBoundary=Pn;exports.ExportDropdown=nm;exports.ExportImportModal=yd;exports.FilterBar=xd;exports.GANTT_AI_SYSTEM_PROMPT=Om;exports.GanttAIAssistant=zi;exports.GanttBoard=Im;exports.GanttI18nContext=$n;exports.GanttMilestone=Bi;exports.GanttToolbar=Di;exports.GenerateGanttTasksDialog=H0;exports.GeneratePlanModal=L0;exports.GroupBySelector=md;exports.HealthBar=Hl;exports.KanbanBoard=Ro;exports.KanbanToolbar=Gl;exports.KanbanViewAdapter=bs;exports.KeyboardShortcutsHelp=gd;exports.ListView=s0;exports.MenuIcons=ma;exports.PluginManager=pl;exports.PrioritySelector=tn;exports.ProfitabilityReport=zl;exports.QuickTaskCreate=sn;exports.RATE_LIMITS=Bw;exports.STANDARD_FIELDS=l0;exports.SwimlaneBoardView=ud;exports.TagBadge=Bl;exports.TagList=Xu;exports.TagPicker=Lo;exports.TaskBar=Fi;exports.TaskDetailModal=vo;exports.TaskFormModal=$m;exports.TaskGrid=Mi;exports.ThemeModal=Td;exports.ThemeProvider=Kp;exports.ThemeSwitcher=mf;exports.TimeInputPopover=no;exports.TimePill=Rl;exports.TimePopover=$l;exports.Timeline=$i;exports.UserAssignmentSelector=rn;exports.VelocityChart=ld;exports.VirtualGrid=lf;exports.VirtualList=of;exports.aiUsageTracker=hn;exports.borderRadius=$c;exports.calculatePosition=Js;exports.calendarDarkTheme=Tc;exports.calendarEnTranslations=xc;exports.calendarEsTranslations=vc;exports.calendarLightTheme=Nc;exports.calendarNeutralTheme=Dc;exports.calendarThemes=il;exports.calendarTranslations=rl;exports.cardToGanttTask=Vi;exports.cardsToGanttTasks=jm;exports.cn=c;exports.createKanbanView=Dp;exports.createRetryWrapper=Gf;exports.darkTheme=wd;exports.darkTokenTheme=gl;exports.defaultTheme=Ci;exports.designTokens=ml;exports.duration=Wc;exports.easing=Vc;exports.exportTokensToCSS=pf;exports.findTaskByName=No;exports.fontSize=Oc;exports.fontWeight=Hc;exports.formatCost=Ws;exports.ganttEnTranslations=Ni;exports.ganttEsTranslations=Yp;exports.ganttTaskToCardUpdate=Gm;exports.ganttThemes=xt;exports.ganttTokens=Kc;exports.ganttTranslations=Nd;exports.ganttUtils=Ee;exports.generateCSSVariables=Yc;exports.generateCompleteCSS=Qc;exports.generateInitialPositions=zf;exports.generateTasksContext=Hm;exports.generateThemeVariables=_s;exports.getCalendarTheme=w0;exports.getCalendarTranslations=Rs;exports.getListViewTheme=c0;exports.getListViewTranslations=qd;exports.getMonthNames=u0;exports.getToken=uf;exports.getTranslations=Xp;exports.getWeekdayNames=p0;exports.kanbanTokens=_c;exports.lightTheme=kd;exports.lightTokenTheme=Xc;exports.lineHeight=zc;exports.listViewDarkTheme=bc;exports.listViewEnTranslations=_d;exports.listViewEsTranslations=Kd;exports.listViewLightTheme=hc;exports.listViewNeutralTheme=yc;exports.listViewThemes=al;exports.listViewTranslations=Gi;exports.mergeCalendarTranslations=ol;exports.mergeListViewTranslations=ji;exports.mergeTranslations=Dd;exports.neutralTheme=Cd;exports.neutralTokenTheme=Jc;exports.opacity=jc;exports.parseLocalCommand=Wm;exports.parseNaturalDate=Vd;exports.parseNaturalDuration=Gd;exports.parseProgress=jd;exports.parseStatus=Um;exports.pluginManager=e5;exports.retrySyncOperation=Vf;exports.retryWithBackoff=Qs;exports.shadows=Gc;exports.shouldVirtualizeGrid=cf;exports.spacing=Rc;exports.themes=cn;exports.useAI=q0;exports.useBoard=U0;exports.useBoardCore=js;exports.useBoardStore=ul;exports.useCardStacking=J0;exports.useDragState=Wl;exports.useFilteredCards=tf;exports.useFilters=G0;exports.useGanttI18n=$r;exports.useKanbanState=cl;exports.useKeyboardShortcuts=Gp;exports.useMultiSelect=Y0;exports.useSelectionState=Ac;exports.useSortedCards=af;exports.useTheme=Bn;exports.useVirtualGrid=df;exports.useVirtualList=nf;exports.validateAIResponse=Vm;exports.withErrorBoundary=Ql;exports.wouldCreateCircularDependency=ei;exports.zIndex=Uc;//# sourceMappingURL=index.cjs.map
463
+ 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=R0;exports.AI_FEATURES=Rw;exports.AI_MODELS=Mc;exports.AddCardButton=Jl;exports.AddColumnButton=_l;exports.AttachmentUploader=lo;exports.BoardProvider=Z0;exports.BulkOperationsToolbar=wi;exports.BurnDownChart=dd;exports.CUSTOM_FIELD_TYPES=d0;exports.CalendarBoard=v0;exports.Card=yo;exports.CardDetailModal=rd;exports.CardDetailModalV2=sd;exports.CardHistoryReplay=S0;exports.CardHistoryTimeline=N0;exports.CardRelationshipsGraph=P0;exports.CardStack=Sw;exports.CardTemplateSelector=bd;exports.CircuitBreaker=Nl;exports.Column=En;exports.ColumnManager=Si;exports.CommandPalette=ed;exports.ConfigMenu=vd;exports.ContextMenu=Hn;exports.DEFAULT_SHORTCUTS=xs;exports.DEFAULT_TABLE_COLUMNS=i0;exports.DEFAULT_TEMPLATES=fd;exports.DateRangePicker=ns;exports.DependenciesSelector=is;exports.DependencyLine=Ds;exports.DistributionCharts=cd;exports.EditableColumnTitle=Ll;exports.ErrorBoundary=Fn;exports.ExportDropdown=nm;exports.ExportImportModal=yd;exports.FilterBar=xd;exports.GANTT_AI_SYSTEM_PROMPT=Om;exports.GanttAIAssistant=zi;exports.GanttBoard=Im;exports.GanttI18nContext=$n;exports.GanttMilestone=Bi;exports.GanttToolbar=Di;exports.GenerateGanttTasksDialog=H0;exports.GeneratePlanModal=L0;exports.GroupBySelector=md;exports.HealthBar=Hl;exports.KanbanBoard=Ro;exports.KanbanToolbar=Gl;exports.KanbanViewAdapter=bs;exports.KeyboardShortcutsHelp=gd;exports.ListView=s0;exports.MenuIcons=ma;exports.PluginManager=pl;exports.PrioritySelector=tn;exports.ProfitabilityReport=zl;exports.QuickTaskCreate=sn;exports.RATE_LIMITS=Bw;exports.STANDARD_FIELDS=l0;exports.SwimlaneBoardView=ud;exports.TagBadge=Bl;exports.TagList=Xu;exports.TagPicker=Lo;exports.TaskBar=Pi;exports.TaskDetailModal=vo;exports.TaskFormModal=$m;exports.TaskGrid=Mi;exports.ThemeModal=Td;exports.ThemeProvider=Kp;exports.ThemeSwitcher=mf;exports.TimeInputPopover=no;exports.TimePill=Rl;exports.TimePopover=$l;exports.Timeline=$i;exports.UserAssignmentSelector=rn;exports.VelocityChart=ld;exports.VirtualGrid=lf;exports.VirtualList=of;exports.aiUsageTracker=hn;exports.borderRadius=$c;exports.calculatePosition=Js;exports.calendarDarkTheme=Tc;exports.calendarEnTranslations=xc;exports.calendarEsTranslations=vc;exports.calendarLightTheme=Nc;exports.calendarNeutralTheme=Dc;exports.calendarThemes=il;exports.calendarTranslations=rl;exports.cardToGanttTask=Vi;exports.cardsToGanttTasks=jm;exports.cn=c;exports.createKanbanView=Dp;exports.createRetryWrapper=Gf;exports.darkTheme=wd;exports.darkTokenTheme=gl;exports.defaultTheme=Ci;exports.designTokens=ml;exports.duration=Wc;exports.easing=Vc;exports.exportTokensToCSS=pf;exports.findTaskByName=No;exports.fontSize=Oc;exports.fontWeight=Hc;exports.formatCost=Ws;exports.ganttEnTranslations=Ni;exports.ganttEsTranslations=Yp;exports.ganttTaskToCardUpdate=Gm;exports.ganttThemes=xt;exports.ganttTokens=Kc;exports.ganttTranslations=Nd;exports.ganttUtils=Ee;exports.generateCSSVariables=Yc;exports.generateCompleteCSS=Qc;exports.generateInitialPositions=zf;exports.generateTasksContext=Hm;exports.generateThemeVariables=_s;exports.getCalendarTheme=w0;exports.getCalendarTranslations=Rs;exports.getListViewTheme=c0;exports.getListViewTranslations=qd;exports.getMonthNames=u0;exports.getToken=uf;exports.getTranslations=Xp;exports.getWeekdayNames=p0;exports.kanbanTokens=_c;exports.lightTheme=kd;exports.lightTokenTheme=Xc;exports.lineHeight=zc;exports.listViewDarkTheme=bc;exports.listViewEnTranslations=_d;exports.listViewEsTranslations=Kd;exports.listViewLightTheme=hc;exports.listViewNeutralTheme=yc;exports.listViewThemes=al;exports.listViewTranslations=Gi;exports.mergeCalendarTranslations=ol;exports.mergeListViewTranslations=ji;exports.mergeTranslations=Dd;exports.neutralTheme=Cd;exports.neutralTokenTheme=Jc;exports.opacity=jc;exports.parseLocalCommand=Wm;exports.parseNaturalDate=Vd;exports.parseNaturalDuration=Gd;exports.parseProgress=jd;exports.parseStatus=Um;exports.pluginManager=e5;exports.retrySyncOperation=Vf;exports.retryWithBackoff=Qs;exports.shadows=Gc;exports.shouldVirtualizeGrid=cf;exports.spacing=Rc;exports.themes=cn;exports.useAI=q0;exports.useBoard=U0;exports.useBoardCore=js;exports.useBoardStore=ul;exports.useCardStacking=J0;exports.useDragState=Wl;exports.useFilteredCards=tf;exports.useFilters=G0;exports.useGanttI18n=$r;exports.useKanbanState=cl;exports.useKeyboardShortcuts=Gp;exports.useMultiSelect=Y0;exports.useSelectionState=Ac;exports.useSortedCards=af;exports.useTheme=Bn;exports.useVirtualGrid=df;exports.useVirtualList=nf;exports.validateAIResponse=Vm;exports.withErrorBoundary=Ql;exports.wouldCreateCircularDependency=ei;exports.zIndex=Uc;//# sourceMappingURL=index.cjs.map
464
464
  //# sourceMappingURL=index.cjs.map