@libxai/board 1.5.24 → 1.5.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Tf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Gh=require('react-markdown'),_h=require('remark-gfm'),jh=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Tf__default=/*#__PURE__*/_interopDefault(Tf);var Gh__default=/*#__PURE__*/_interopDefault(Gh);var _h__default=/*#__PURE__*/_interopDefault(_h);var jh__default=/*#__PURE__*/_interopDefault(jh);var Ts=(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 Ns=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 [Ns.Translate.toString(e),Ns.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ds(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 xf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function nl(e,t){return e.length===0?1e3:t===0?Ds(null,e[0].position):t>=e.length?Ds(e[e.length-1].position,null):Ds(e[t-1].position,e[t].position)}function jc(e,t=100){return e>t}var vf=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 Ss(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=vf,onRetry:i}=t,c,l=0;for(let p=1;p<=a;p++){l=p;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:l,success:false};let g=wf(p,r,o,s);if(i)try{i(c,p,g);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,g));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function kf(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 Cf(e,t={}){return async(...a)=>Ss(()=>e(...a),t)}var sl=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 Kc=(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))(Kc||{}),Eo=class Eo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(i,o,c?n:"");break;case "INFO":console.info(i,o,c?n:"");break;case "WARN":console.warn(i,o,c?n:"");break;case "ERROR":console.error(i,o,c?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Eo.globalOptions};}static configure(t){Eo.globalOptions={...Eo.globalOptions,...t};}child(t){return new Eo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Es((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Es(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Kc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Eo.globalOptions={};var il=Eo,Es=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}},Yc=new il;function Nf(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 Df(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(i=>i.id===s.columnId);return [s.id,ll(s.title),ll(s.description||""),ll(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function Sf(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 Tf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=n.toDataURL("image/png"),c=297,l=210,p=n.width/n.height,d=c-20,m=d/p;m>l-20&&(m=l-20,d=m*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let b=(c-d)/2;return g.addImage(i,"PNG",b,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let i=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,i.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):i.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),l.push(p.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ll(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function Xc(e,t,a,r){switch(t){case "json":return Nf(e,r);case "csv":return Df(e);case "pdf":return await Sf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Jc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:n[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Ef(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 Ff(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=Qc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=Qc(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,b)=>{l[g]=i[b]||"";});let p=l.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported: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 Qc(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 Zc(e,t){switch(t){case "json":return Ef(e);case "csv":return Ff(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function eu(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 dl=react.createContext(null);function tu(){return react.useContext(dl)}var au=react.createContext(null);function ru({children:e,themeName:t}){return jsxRuntime.jsx(au.Provider,{value:{themeName:t},children:e})}function en(){return react.useContext(au)}function Ht({children:e,container:t}){let[a,r]=react.useState(false),o=tu(),s=en();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:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var lu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Of="#BDC3C7",$f=({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 Fo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=160,f=220,y=4,w=g.right-v;w<10&&(w=g.left),w+v>h-10&&(w=h-v-10);let x=b-g.bottom,C=g.top,k;x>=f+y?k=g.bottom+y:C>=f+y?k=g.top-f-y:k=x>=C?g.bottom+y:Math.max(10,g.top-f-y),n({top:k,left:w}),o(true);};react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&!c.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?lu[e]:null,m=d?.color||Of;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(lu).map(([g,b])=>jsxRuntime.jsxs("button",{onClick:()=>p(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx($f,{color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Hf=[{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 In({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),m=(en()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),x=window.innerHeight,C=window.innerWidth,k=320,D=380,T=4,I=w.left;I+k>C-10&&(I=C-k-10),I<10&&(I=10);let $=x-w.bottom,A=w.top,_;$>=D+T?_=w.bottom+T:A>=D+T?_=w.top-D-T:_=$>=A?w.bottom+T:Math.max(10,w.top-D-T),i({top:_,left:I}),s(true);};react.useEffect(()=>{let w=x=>{c.current&&!c.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let b=w=>{let x=new Date,C=I=>{let $=I.getFullYear(),A=String(I.getMonth()+1).padStart(2,"0"),_=String(I.getDate()).padStart(2,"0");return `${$}-${A}-${_}`},k=C(x),D=new Date(x);D.setDate(D.getDate()+w);let T=C(D);a(k,T),s(false);},h=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=D.split("-").map(Number);if(T.length!==3||T.some(_=>isNaN(_)))return null;let I=T[0],$=T[1],A=T[2];return I===void 0||$===void 0||A===void 0?null:new Date(I,$-1,A)},x=w(e),C=w(t);if(!x||!C||isNaN(x.getTime())||isNaN(C.getTime()))return "Set date";let k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${k[x.getMonth()]} ${x.getDate()} \u2013 ${k[C.getMonth()]} ${C.getDate()}`},v=e&&t,y=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),w<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,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 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${h()}`:"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:h()})]}),o&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Hf.map(w=>jsxRuntime.jsx("button",{onClick:()=>b(w.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:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.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:w=>a(w.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:w=>a(e,w.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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Po({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let y=m.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,C=300,k=380,D=4,T=y.right-C;T<10&&(T=y.left),T+C>x-10&&(T=x-C-10);let I=w-y.bottom,$=y.top,A;I>=k+D?A=y.bottom+D:$>=k+D?A=y.top-k-D:A=I>=$?y.bottom+D:Math.max(10,y.top-k-D),p({top:A,left:T}),n(true);};react.useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let b=y=>{let w=e.some(x=>x.id===y.id);a(w?e.filter(x=>x.id!==y.id):[...e,y]);},h=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.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"}):h.map(y=>{let w=e.some(x=>x.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>b(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),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 Fs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(n.has(p))return true}}return n.delete(c),false};return i(a)}function Rn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=react.useState(false),[l,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,b]=react.useState({top:0,left:0}),[h,v]=react.useState(null),f=react.useRef(null),y=react.useRef(null),w=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,me=T.right-A;me<10&&(me=T.left),me+A>$-10&&(me=$-A-10);let L=I-T.bottom,X=T.top,Z;L>=_+E?Z=T.bottom+E:X>=_+E?Z=T.top-_-E:Z=L>=X?T.bottom+E:Math.max(10,T.top-_-E),b({top:Z,left:me}),c(true);};react.useEffect(()=>{if(!i||!y.current)return;let T=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,me=T.right-A;me<10&&(me=T.left),me+A>$-10&&(me=$-A-10);let L=I-T.bottom,X=T.top,Z;L>=_+E?Z=T.bottom+E:X>=_+E?Z=T.top-_-E:Z=L>=X?T.bottom+E:Math.max(10,T.top-_-E),b({top:Z,left:me});},[d,i]),react.useEffect(()=>{let T=I=>{f.current&&!f.current.contains(I.target)&&!y.current?.contains(I.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),react.useEffect(()=>{let T=I=>{I.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]);let x=T=>{let I=t.includes(T),$=a.find(A=>A.id===T);if(v(null),I){let A=t.filter(_=>_!==T);r(A),A.length===0&&m(false);}else {if(s&&Fs(a,T,e)){let _=`Cannot add "${$?.title||T}" as dependency - would create circular reference`;v(_),n?.(T,$?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},C=()=>{let T=!d;m(T),T||r([]);},k=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>i?c(false):w(),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:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),i&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:T=>p(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:k.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"}):k.map(T=>{let I=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>x(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.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:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Kr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:b}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:Ns.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:h,...l,...p,onClick:()=>a?.(e),children:t(e)});let v=i.filter(x=>e.assignedUserIds?.includes(x.id)),f=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),w={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:u("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}),C===3&&y.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Fo,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(In,{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:(x,C)=>n?.(e.id,{startDate:x,endDate:C})})}),i.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Po,{assignedUsers:v,availableUsers:i,onChange:x=>n?.(e.id,{assignedUserIds:x.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Rn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),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)));Kr.displayName="Card";var Ms={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"}},yu=({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 xu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),p=[...Object.entries(Ms).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ms).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Ms[e];if(v)return {...v,id:e};let f=r.find(y=>y.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ms.todo,id:"todo"}},m=()=>{if(!l.current)return;let v=l.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,w=180,x=280,C=4,k=v.right-w;k<10&&(k=v.left),k+w>y-10&&(k=y-w-10);let D=f-v.bottom,T=v.top,I;D>=x+C?I=v.bottom+C:T>=x+C?I=v.top-x-C:I=D>=T?v.bottom+C:Math.max(10,v.top-x-C),i({top:I,left:k}),s(true);};react.useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},b=d(),h=b.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,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:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:b.label,children:jsxRuntime.jsx(yu,{icon:b.icon,color:h})}),o&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(v=>jsxRuntime.jsxs("button",{onClick:()=>g(v.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:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(yu,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.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"})})]},v.id))})]})})]})}var vu={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 wu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=vu[s]||vu.en,[i,c]=react.useState(false),[l,p]=react.useState(false),[d,m]=react.useState(e),[g,b]=react.useState({top:0,left:0}),h=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(i&&v.current){let C=v.current.getBoundingClientRect();b({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),react.useEffect(()=>{let C=k=>{h.current&&!h.current.contains(k.target)&&!v.current?.contains(k.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{let C=k=>{k.key==="Escape"&&(c(false),p(false),m(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),react.useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let y=()=>{p(true),m(e);},w=()=>{let C=d.trim();C&&C!==e&&t(C),p(false),c(false),m(e);},x=C=>{C.key==="Enter"?w():C.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>c(!i),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"})]})}),i&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsx("div",{ref:h,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:l?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:C=>m(C.target.value),onKeyDown:x,onBlur:w,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:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var rn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:b,onColumnDelete:h,isDeletable:v=false,className:f,renderMetrics:y,locale:w})=>{let{setNodeRef:x,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),D=p??jc(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:x,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),A=$.state==="exceeded",_=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:u("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(_()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.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"})]}),$.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"})]}),$.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"})}),$.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"})]})]}),(b||h)&&jsxRuntime.jsx(wu,{columnTitle:e.title,onRename:E=>b?.(e.id,E),onDelete:h?()=>h(e.id):void 0,isDeletable:v,locale:w}),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"})]})]}),y&&y(e,t),!m&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(E=>E.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"})}):D?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(E=>{let me=t[E.index];return me?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsxRuntime.jsx(Kr,{card:me,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},me.id):null})}):t.map(E=>jsxRuntime.jsx(Kr,{card:E,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},E.id))})})]})});rn.displayName="Column";function gl({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:i,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function nb(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 Su(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(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(d=>d===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 ib(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var lb=["\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 Eu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:h=10}){let v=i==="dark",[f,y]=react.useState(false),[w,x]=react.useState([]),[C,k]=react.useState(0),[D,T]=react.useState(null),[I,$]=react.useState(false),A=react.useRef(null),_=react.useRef(null),E=react.useRef(null),me=react.useRef(null),L=react.useCallback((U,re)=>{let ee=nb(U,re);if(T(ee),ee){let Ee=r.filter(we=>we.name.toLowerCase().includes(ee.query)||we.email&&we.email.toLowerCase().includes(ee.query)).slice(0,5);x(Ee),y(Ee.length>0),k(0);}else y(false),x([]);},[r]),X=U=>{let re=U.target.value;if(t(re),L(re,U.target.selectionStart||0),A.current){A.current.style.height="24px";let ee=A.current.scrollHeight,Ee=280,we=Math.min(ee,Ee);A.current.style.height=`${we}px`,A.current.style.overflowY=ee>Ee?"auto":"hidden";}},Z=()=>{A.current&&L(e,A.current.selectionStart||0);},He=react.useCallback(U=>{if(!D||!A.current)return;let re=e.slice(0,D.start),ee=e.slice(D.end),Ee=`@${U.name.replace(/\s+/g,"")} `,we=re+Ee+ee;t(we),y(false),T(null),setTimeout(()=>{if(A.current){let Be=D.start+Ee.length;A.current.selectionStart=Be,A.current.selectionEnd=Be,A.current.focus();}},0);},[D,e,t]),O=U=>{if(f&&w.length>0)switch(U.key){case "ArrowDown":U.preventDefault(),k(re=>re<w.length-1?re+1:0);break;case "ArrowUp":U.preventDefault(),k(re=>re>0?re-1:w.length-1);break;case "Enter":{U.preventDefault();let re=w[C];re&&He(re);break}case "Tab":{U.preventDefault();let re=w[C];re&&He(re);break}case "Escape":U.preventDefault(),y(false);break}else U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),a());};react.useEffect(()=>{let U=re=>{_.current&&!_.current.contains(re.target)&&A.current&&!A.current.contains(re.target)&&y(false),me.current&&!me.current.contains(re.target)&&$(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let j=react.useCallback(U=>{if(!A.current)return;let re=A.current.selectionStart||e.length,ee=e.slice(0,re)+U+e.slice(re);t(ee),$(false),setTimeout(()=>{if(A.current){let Ee=re+U.length;A.current.selectionStart=Ee,A.current.selectionEnd=Ee,A.current.focus();}},0);},[e,t]),he=react.useCallback(U=>{if(!g||!U.target.files)return;let re=Array.from(U.target.files),ee=h*1024*1024,Ee=re.filter(we=>we.size>ee?(console.warn(`File ${we.name} exceeds max size of ${h}MB`),false):true);Ee.length>0&&g(Ee),U.target.value="";},[g,h]),je=react.useCallback(U=>U.type.startsWith("image/")?lucideReact.Image:U.type.includes("pdf")||U.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&_.current){let U=_.current.children[C];U&&U.scrollIntoView({block:"nearest"});}},[C,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(U=>{let re=je(U.file),ee=U.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[ee&&U.preview?jsxRuntime.jsx("img",{src:U.preview,alt:U.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(re,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",v?"text-white":"text-gray-900"),children:U.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:ib(U.file.size)})]}),b&&jsxRuntime.jsx("button",{onClick:()=>b(U.id),className:u("p-0.5 rounded-full transition-colors",v?"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"})})]},U.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[l&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$(!I),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",v?"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:I&&jsxRuntime.jsx(framerMotion.motion.div,{ref:me,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"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:lb.map(U=>jsxRuntime.jsx("button",{type:"button",onClick:()=>j(U),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:U},U))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:E,type:"file",multiple:true,onChange:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:A,value:e,onChange:X,onSelect:Z,onKeyDown:O,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((U,re)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>He(U),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===C?v?"bg-white/10":"bg-gray-100":v?"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:U.color||"#8B5CF6"},children:sb(U.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:U.name}),U.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:U.email})]})]},U.id))})})]})]})]})}function Fu({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((i,c)=>i.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsxRuntime.jsx("span",{children:i.value},c))})}var Bs=["#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[i,c]=react.useState(false),[l,p]=react.useState(""),[d,m]=react.useState(false),[g,b]=react.useState(Bs[10]||"#2E94FF"),[h,v]=react.useState({top:0,left:0}),f=react.useRef(null),y=react.useRef(null),w=react.useRef(null),x=react.useRef(null),C=t.filter(A=>A.name.toLowerCase().includes(l.toLowerCase())),k=t.some(A=>A.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(i&&y.current){let A=y.current.getBoundingClientRect();v({top:A.bottom+6,left:A.left});}},[i]),react.useEffect(()=>{let A=_=>{let E=_.target,me=f.current?.contains(E),L=w.current?.contains(E);!me&&!L&&(c(false),p(""),m(false));};if(i)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i]),react.useEffect(()=>{i&&x.current&&x.current.focus();},[i]);let D=A=>{let _=e.some(E=>E.id===A.id);a(_?e.filter(E=>E.id!==A.id):[...e,A]);},T=async()=>{if(!(!r||!l.trim())){m(true);try{let A=await r(l.trim(),g);A&&(a([...e,A]),p(""),b(Bs[Math.floor(Math.random()*Bs.length)]||"#2E94FF"));}finally{m(false);}}},I=(A,_)=>{_.stopPropagation(),a(e.filter(E=>E.id!==A));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,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(A=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.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:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,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:h.top,left:h.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:x,type:"text",value:l,onChange:A=>p(A.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:A=>{A.key==="Enter"&&l.trim()&&!k&&r&&T();}})}),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(A=>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:`${A.color}20`,color:A.color},onClick:_=>I(A.id,_),children:[A.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},A.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(A=>{let _=e.some(E=>E.id===A.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(A),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${A.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{_||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{_||(E.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:A.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:A.name}),_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:A.color}})]},A.id)}):l.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"})}),l.trim()&&!k&&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:Bs.map(A=>jsxRuntime.jsx("button",{type:"button",onClick:()=>b(A),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:A,outline:g===A?`2px solid ${A}`:"none",outlineOffset:"2px"}},A))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.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 Pu({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 Lo=[{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 Au(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 hb(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 yb({className:e}){return jsxRuntime.jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function hl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=hb(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"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Au(e.loggedMinutes),l=e.estimateMinutes?Au(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(yb,{className:i[t]}),jsxRuntime.jsx("span",{children:p})]})}function xb(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 Os(e){let t=xb(e);return t!==null?String(t):e}function Iu(e){let a=Os(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function $s(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 kb(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 Cb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Tb({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 Bu({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 Nb({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 yl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:d}){let[m,g]=react.useState(""),[b,h]=react.useState(t.estimateMinutes?$s(t.estimateMinutes):""),[v,f]=react.useState(""),[y,w]=react.useState(false),[x,C]=react.useState(false),k=react.useRef(null);react.useEffect(()=>{k.current?.focus();},[]);let D=async()=>{let $=Iu(m);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let $=b.trim()?Iu(b):null;await n($),C(false);},I=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),D()),$.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Bu,{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:kb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Tb,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Bu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(Cb,{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(Nb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:m,onChange:$=>g($.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:D,disabled:y||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:$=>f($.target.value),onKeyDown:I,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:$s(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"}),x?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:b,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&T(),$.key==="Escape"&&C(false);},onBlur:T,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:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?$s(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map($=>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:$.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:$s($.durationMinutes)})]},$.id))})]})]})}function Mb(e){let a=Os(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Pb(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 $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=react.useState(Pb(r)),[l,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let b=async()=>{m(true);let w=Mb(i);await o(w&&w>0?w:null,l||void 0),m(false);},h=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:l,onChange:w=>p(w.target.value),onKeyDown:v,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:h,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Ab(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 Lb(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 vl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Ab(e.health),s=Lb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function on(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 Bb(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 Rb(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 Ob(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 $b({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",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",on(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:on(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:on(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Hb({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",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?on(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:on(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,on(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Rb(e.status,a),Bb(e.status,a)),children:Ob(e.status,t)})})]})}function wl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((b,h)=>b.varianceMinutes===null?1:h.varianceMinutes===null?-1:h.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx($b,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",l),children:g.map(b=>jsxRuntime.jsx(Hb,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function nn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Zb(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 _u(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 eh(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 qr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:b=[],onAddComment:h,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:y,enableTimeTracking:w=false,timeTrackingSummary:x,timeEntries:C=[],isTimerRunning:k=false,timerElapsedSeconds:D=0,onTimeLog:T,onEstimateUpdate:I,onSoldEffortUpdate:$,onTimerStart:A,onTimerStop:_,onTimerDiscard:E,blurFinancials:me=false}){let L=s==="dark",X={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)"},Z=e&&"title"in e&&!("name"in e),He=e,[O,j]=react.useState(e?_u(e,i):null),[he,je]=react.useState(false),[U,re]=react.useState(false),[ee,Ee]=react.useState(false),[we,Be]=react.useState(null),[ze,Qe]=react.useState(new Date),[te,tt]=react.useState(false),[pe,at]=react.useState(false),[pt,Et]=react.useState(""),[Ce,rt]=react.useState(false),[it,Ze]=react.useState(false),[H,de]=react.useState(false),[N,Y]=react.useState(false),[ie,ke]=react.useState(""),V=react.useRef(null),ae=react.useRef(null),[Ve,De]=react.useState(""),Ue=react.useRef(null),[Ne,Ke]=react.useState(""),[bt,lt]=react.useState(false),[nt,et]=react.useState([]),[At,Mt]=react.useState(""),[mt,yt]=react.useState(false),gt=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 S=_u(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),j(S),ke(S.description||""),De(S.name||"");}},[e?.id,e?.quotedMinutes,i,t]),react.useEffect(()=>{if(!t||!ie)return;let S=setTimeout(()=>{let oe=ae.current;oe&&(oe.style.height="auto",oe.style.height=`${Math.max(100,oe.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,ie]),react.useEffect(()=>()=>{V.current&&clearTimeout(V.current),Ue.current&&clearTimeout(Ue.current);},[]),react.useEffect(()=>{t&&gt.current&&b.length>0&&setTimeout(()=>{gt.current&&(gt.current.scrollTop=gt.current.scrollHeight);},100);},[t,b.length]);let Pt=react.useCallback(S=>{j(S),Z&&o&&He?o(eh(S,He)):r&&r(S);},[Z,He,o,r]),Ge=react.useCallback(()=>{je(false),re(false),Ee(false),Be(null),at(false),Et(""),rt(false);},[]),Re=react.useCallback((S,oe)=>{if(!O)return;let Te={...O,[S]:oe};Pt(Te);},[O,Pt]),ut=react.useCallback(()=>{let S=ae.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),le=react.useCallback(S=>{ke(S),setTimeout(ut,0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(O){let oe={...O,description:S};Pt(oe);}},800);},[O,Pt,ut]),fe=react.useCallback(S=>{De(S),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(O&&S.trim()){let oe={...O,name:S.trim()};Pt(oe);}},800);},[O,Pt]),P=react.useCallback(S=>{let oe=S.map(Te=>{let We={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Te};return Te.type.startsWith("image/")&&(We.preview=URL.createObjectURL(Te)),We});et(Te=>[...Te,...oe]);},[]),K=react.useCallback(S=>{et(oe=>{let Te=oe.find(We=>We.id===S);return Te?.preview&&URL.revokeObjectURL(Te.preview),oe.filter(We=>We.id!==S)});},[]),q=react.useCallback(async()=>{if(!(!O||!Ne.trim()&&nt.length===0||!h)){lt(true);try{let S=Su(Ne,f),oe=[];if(nt.length>0&&y){let Te=nt.map(We=>We.file);oe=await y(Te);}await h(O.id,Ne.trim(),S.length>0?S:void 0,oe.length>0?oe:void 0),Ke(""),nt.forEach(Te=>{Te.preview&&URL.revokeObjectURL(Te.preview);}),et([]);}finally{lt(false);}}},[O,Ne,nt,h,f,y]),ce=react.useCallback(()=>{if(!O||!At.trim())return;let S=O.subtasks||[],oe={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:At.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},Te=[...S,oe],We={...O,subtasks:Te};Pt(We),Mt(""),yt(false);},[O,At,Pt]),Se=react.useCallback(S=>{if(!O?.subtasks)return;let oe=O.subtasks.map(We=>We.id===S?{...We,progress:We.progress===100?0:100}:We),Te={...O,subtasks:oe};Pt(Te);},[O,Pt]),Xe=react.useCallback(S=>{if(!O?.subtasks)return;let oe=O.subtasks.filter(We=>We.id!==S),Te={...O,subtasks:oe};Pt(Te);},[O,Pt]),_e=react.useCallback(S=>{let oe=typeof S=="string"?new Date(S):S,We=new Date().getTime()-oe.getTime(),Tt=Math.floor(We/6e4),Nt=Math.floor(We/36e5),la=Math.floor(We/864e5);return Tt<1?n==="es"?"Ahora":"Just now":Tt<60?n==="es"?`Hace ${Tt} min`:`${Tt}m ago`:Nt<24?n==="es"?`Hace ${Nt}h`:`${Nt}h ago`:la<7?n==="es"?`Hace ${la}d`:`${la}d ago`:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ie=react.useCallback(S=>{if(!O)return;let oe=O.progress||0;S==="completed"?oe=100:S==="in-progress"&&oe===0?oe=10:S==="todo"&&(oe=0);let Te={...O,status:S,progress:oe};Pt(Te),je(false);},[O,Pt]),M=react.useCallback((S,oe)=>{if(!O)return;let Te={...O,startDate:S,endDate:oe};Pt(Te);},[O,Pt]),J=react.useCallback(()=>{let S=ze.getFullYear(),oe=ze.getMonth(),Te=new Date(S,oe,1),Tt=new Date(S,oe+1,0).getDate(),Nt=Te.getDay(),la=[],aa=new Date(S,oe,0).getDate();for(let Ut=Nt-1;Ut>=0;Ut--)la.push({date:new Date(S,oe-1,aa-Ut),isCurrentMonth:false});for(let Ut=1;Ut<=Tt;Ut++)la.push({date:new Date(S,oe,Ut),isCurrentMonth:true});let ya=42-la.length;for(let Ut=1;Ut<=ya;Ut++)la.push({date:new Date(S,oe+1,Ut),isCurrentMonth:false});return la},[ze]),ye=react.useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),de(false),!O||!d)return;let oe=Array.from(S.dataTransfer.files);if(oe.length!==0){Y(true);try{await d(O.id,oe);}finally{Y(false);}}},[O,d]),Le=react.useCallback(async S=>{if(!O||!d||!S.target.files)return;let oe=Array.from(S.target.files);if(oe.length!==0){Y(true);try{await d(O.id,oe);}finally{Y(false);}S.target.value="";}},[O,d]),Oe=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),de(true);},[]),B=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),de(false);},[]),z=react.useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),ne=react.useCallback(S=>S.startsWith("image/")?lucideReact.Image:S.includes("pdf")||S.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!O?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("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:u("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:O.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 S=O.progress===100?0:100,Te={...O,progress:S,status:S===100?"completed":"todo"};Pt(Te);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",O.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ve,onChange:S=>fe(S.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",O.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:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ge(),je(!he);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",O.progress===100||O.status==="completed"?"bg-green-500/20 text-green-400":O.progress&&O.progress>0||O.status==="in-progress"?"bg-blue-500/20 text-blue-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:O.progress===100||O.status==="completed"?n==="es"?"COMPLETADO":"DONE":O.progress&&O.progress>0||O.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>je(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",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(S=>jsxRuntime.jsxs("button",{onClick:()=>Ie(S.id),className:u("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",O.status===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ge(),Ee(!ee);},className:u("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:[O.assignees&&O.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[O.assignees.slice(0,3).map((S,oe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},oe)),O.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",O.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(S=>{let oe=O.assignees?.some(Te=>Te.name===S.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Te=O.assignees||[],We;oe?We=Te.filter(Tt=>Tt.name!==S.name):We=[...Te,S],Re("assignees",We);},className:u("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",oe&&(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:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",L?"text-white":"text-gray-900"),children:S.name}),oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsxRuntime.jsx("div",{className:u("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:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Be(we?null:"start"),Qe(O.startDate||new Date);},className:u("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:[O.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),O.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,oe=new Date(S);oe.setDate(S.getDate()+1);let Te=new Date(S);Te.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let We=new Date(S);We.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let Tt=new Date(S);Tt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let Nt=new Date(S);Nt.setDate(S.getDate()+14);let la=new Date(S);return la.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:oe,display:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Te,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:We,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Tt,display:Tt.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:la,display:la.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ya,Ut)=>jsxRuntime.jsxs("button",{className:u("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(we==="start"){let ua=O.endDate&&ya.date>O.endDate?ya.date:O.endDate;M(ya.date,ua),Be("end");}else {let ua=O.startDate&&ya.date<O.startDate?ya.date:O.startDate;M(ua,ya.date),Be(null);}},children:[jsxRuntime.jsx("span",{children:ya.label}),jsxRuntime.jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ya.display})]},Ut))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{M(void 0,void 0),Be(null);},className:u("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:u("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:we==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",L?"text-white":"text-gray-900"),children:ze.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:()=>Qe(new Date),className:u("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:()=>Qe(new Date(ze.getFullYear(),ze.getMonth()-1)),className:u("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>Qe(new Date(ze.getFullYear(),ze.getMonth()+1)),className:u("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(S=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:J().map((S,oe)=>{let Te=S.date.toDateString()===new Date().toDateString(),We=O.startDate?.toDateString()===S.date.toDateString(),Tt=O.endDate?.toDateString()===S.date.toDateString(),Nt=We||Tt,la=O.startDate&&O.endDate&&S.date>=O.startDate&&S.date<=O.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let aa=new Date(S.date);if(we==="start"){let ya=O.endDate&&aa>O.endDate?aa:O.endDate;M(aa,ya),Be("end");}else {let ya=O.startDate&&aa<O.startDate?aa:O.startDate;M(ya,aa),Be(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(L?"text-white":"text-gray-900"),Te&&"ring-2 ring-[#2E94FF]",We&&"bg-[#2E94FF] text-white",Tt&&!We&&"bg-[#7C3AED] text-white",la&&!Nt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Nt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},oe)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ge(),re(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",O.priority==="high"||O.priority==="urgent"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":O.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:O.priority?O.priority==="high"||O.priority==="urgent"?n==="es"?"Alta":"High":O.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>re(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",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(S=>jsxRuntime.jsxs("button",{onClick:()=>{Re("priority",S.id),re(false);},className:u("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",O.priority===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:O.startDate&&O.endDate?`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("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:[te?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:O.progress||0,onChange:S=>{let oe=parseInt(S.target.value),Te=O.status;oe===100?Te="completed":oe>0?Te="in-progress":Te="todo";let We={...O,progress:oe,status:Te};Pt(We);},onBlur:()=>tt(false),className:u("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:()=>tt(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",O.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${O.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[O.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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:O.status==="completed"||O.progress===100?jsxRuntime.jsx("span",{className:u("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:x?.estimateMinutes?nn(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ze("estimate"),className:u("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ze("estimate"),className:u("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:it==="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($r,{mode:"estimate",locale:n,isDark:L,currentValue:x?.estimateMinutes||null,onSave:async S=>{await I?.(O.id,S),Ze(false);},onClose:()=>Ze(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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:me?jsxRuntime.jsx("span",{className:u("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"}):O.status==="completed"||O.progress===100?jsxRuntime.jsx("span",{className:u("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:O.quotedMinutes?nn(O.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):O.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ze("quoted"),className:u("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(O.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ze("quoted"),className:u("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:it==="quoted"&&!me&&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($r,{mode:"quoted",locale:n,isDark:L,currentValue:O.quotedMinutes||null,onSave:async S=>{$?(await $(O.id,S),j(oe=>oe?{...oe,quotedMinutes:S}:null)):Re("quotedMinutes",S),Ze(false);},onClose:()=>Ze(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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:[O.status==="completed"||O.progress===100?jsxRuntime.jsx("div",{className:u("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"})}):k?jsxRuntime.jsxs("button",{type:"button",onClick:()=>_?.(O.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),Zb(D||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>A?.(O.id),className:u("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"})}),O.status==="completed"||O.progress===100?jsxRuntime.jsxs("div",{className:u("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:()=>Ze("log"),className:u("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"]}),x&&x.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[nn(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",nn(x.estimateMinutes)]})]}),x.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:it==="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($r,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(S,oe)=>{S&&await T?.(O.id,{durationMinutes:S,note:oe,source:"manual"}),Ze(false);},onClose:()=>Ze(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(lo,{selectedTags:O.tags||[],availableTags:c,onChange:S=>{Re("tags",S);},onCreateTag:l,theme:X})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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:[O.dependencies&&O.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:O.dependencies.map(S=>{let oe=g.find(Te=>Te.id===S);return jsxRuntime.jsxs("span",{className:u("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:[oe?.name||S.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Te=(O.dependencies||[]).filter(We=>We!==S);Re("dependencies",Te);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ge(),at(!pe);},className:u("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:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{at(false),Et("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:pt,onChange:S=>Et(S.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("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(S=>S.id!==O.id).filter(S=>pt===""||S.name.toLowerCase().includes(pt.toLowerCase())).map(S=>{let oe=O.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Te=O.dependencies||[],We;oe?We=Te.filter(Tt=>Tt!==S.id):We=[...Te,S.id],Re("dependencies",We);},className:u("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",oe&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",oe?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:u("block truncate",L?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsxRuntime.jsx("div",{className:u("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:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ge(),rt(!Ce);},className:u("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:O.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:Lo.find(S=>S.value===O.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>rt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",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:Lo.map(S=>{let oe=O.color===S.value;return jsxRuntime.jsx("button",{onClick:()=>{Re("color",S.value),rt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",oe&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:oe?S.value:void 0},title:S.name,children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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:O.isMilestone||false,onChange:S=>Re("isMilestone",S.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",O.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:u("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",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:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:ae,value:ie,onChange:S=>le(S.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",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:u("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:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",O.subtasks&&O.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",O.subtasks.filter(S=>S.progress===100).length,"/",O.subtasks.length,")"]})]})}),O.subtasks&&O.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...O.subtasks].sort((S,oe)=>(S.position??0)-(oe.position??0)).map(S=>jsxRuntime.jsxs("div",{className:u("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:()=>Se(S.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.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:S.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("button",{onClick:()=>Xe(S.id),className:u("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"})})]},S.id))}),mt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:At,onChange:S=>Mt(S.target.value),onKeyDown:S=>{S.key==="Enter"&&At.trim()?ce():S.key==="Escape"&&(yt(false),Mt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",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:ce,disabled:!At.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",At.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:()=>{yt(false),Mt("");},className:u("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:()=>yt(true),className:u("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:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(S=>{let oe=ne(S.type),Te=S.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("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:[Te&&S.thumbnailUrl?jsxRuntime.jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(oe,{className:u("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("p",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:z(S.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(S.id),className:u("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"})})]},S.id)})}),jsxRuntime.jsxs("div",{onDragOver:Oe,onDragLeave:B,onDrop:ye,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?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",N&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Le,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||N}),N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Nf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),_h=require('react-markdown'),jh=require('remark-gfm'),Kh=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Nf__default=/*#__PURE__*/_interopDefault(Nf);var _h__default=/*#__PURE__*/_interopDefault(_h);var jh__default=/*#__PURE__*/_interopDefault(jh);var Kh__default=/*#__PURE__*/_interopDefault(Kh);var Ds=(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 Ss=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 [Ss.Translate.toString(e),Ss.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Es(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 vf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function il(e,t){return e.length===0?1e3:t===0?Es(null,e[0].position):t>=e.length?Es(e[e.length-1].position,null):Es(e[t-1].position,e[t].position)}function Kc(e,t=100){return e>t}var wf=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 kf(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 Fs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=wf,onRetry:i}=t,c,l=0;for(let p=1;p<=a;p++){l=p;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:l,success:false};let g=kf(p,r,o,s);if(i)try{i(c,p,g);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,g));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function Cf(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 Tf(e,t={}){return async(...a)=>Fs(()=>e(...a),t)}var ll=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 Yc=(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))(Yc||{}),Mo=class Mo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(i,o,c?n:"");break;case "INFO":console.info(i,o,c?n:"");break;case "WARN":console.warn(i,o,c?n:"");break;case "ERROR":console.error(i,o,c?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Mo.globalOptions};}static configure(t){Mo.globalOptions={...Mo.globalOptions,...t};}child(t){return new Mo({...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 Ms((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ms(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Yc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Mo.globalOptions={};var dl=Mo,Ms=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}},qc=new dl;function Df(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 Sf(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(i=>i.id===s.columnId);return [s.id,cl(s.title),cl(s.description||""),cl(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
+ `)}async function Ef(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 Nf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=n.toDataURL("image/png"),c=297,l=210,p=n.width/n.height,d=c-20,m=d/p;m>l-20&&(m=l-20,d=m*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let b=(c-d)/2;return g.addImage(i,"PNG",b,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let i=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,i.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):i.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),l.push(p.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function cl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Jc(e,t,a,r){switch(t){case "json":return Df(e,r);case "csv":return Sf(e);case "pdf":return await Ef(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Qc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:n[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Ff(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 Mf(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=Zc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=Zc(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,b)=>{l[g]=i[b]||"";});let p=l.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported: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 Zc(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 eu(e,t){switch(t){case "json":return Ff(e);case "csv":return Mf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function tu(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 ul=react.createContext(null);function au(){return react.useContext(ul)}var ru=react.createContext(null);function ou({children:e,themeName:t}){return jsxRuntime.jsx(ru.Provider,{value:{themeName:t},children:e})}function tn(){return react.useContext(ru)}function Wt({children:e,container:t}){let[a,r]=react.useState(false),o=au(),s=tn();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:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var du={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},$f="#BDC3C7",Hf=({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 Po({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=160,f=220,y=4,w=g.right-v;w<10&&(w=g.left),w+v>h-10&&(w=h-v-10);let x=b-g.bottom,N=g.top,k;x>=f+y?k=g.bottom+y:N>=f+y?k=g.top-f-y:k=x>=N?g.bottom+y:Math.max(10,g.top-f-y),n({top:k,left:w}),o(true);};react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&!c.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?du[e]:null,m=d?.color||$f;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(du).map(([g,b])=>jsxRuntime.jsxs("button",{onClick:()=>p(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Hf,{color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var zf=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Bn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),m=(tn()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),x=window.innerHeight,N=window.innerWidth,k=320,S=380,C=4,I=w.left;I+k>N-10&&(I=N-k-10),I<10&&(I=10);let $=x-w.bottom,P=w.top,te;$>=S+C?te=w.bottom+C:P>=S+C?te=w.top-S-C:te=$>=P?w.bottom+C:Math.max(10,w.top-S-C),i({top:te,left:I}),s(true);};react.useEffect(()=>{let w=x=>{c.current&&!c.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let b=w=>{let x=new Date,N=I=>{let $=I.getFullYear(),P=String(I.getMonth()+1).padStart(2,"0"),te=String(I.getDate()).padStart(2,"0");return `${$}-${P}-${te}`},k=N(x),S=new Date(x);S.setDate(S.getDate()+w);let C=N(S);a(k,C),s(false);},h=()=>{if(!e||!t)return "Set date";let w=S=>{if(S instanceof Date)return S;if(typeof S!="string"||!S.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=S.split("-").map(Number);if(C.length!==3||C.some(te=>isNaN(te)))return null;let I=C[0],$=C[1],P=C[2];return I===void 0||$===void 0||P===void 0?null:new Date(I,$-1,P)},x=w(e),N=w(t);if(!x||!N||isNaN(x.getTime())||isNaN(N.getTime()))return "Set date";let k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${k[x.getMonth()]} ${x.getDate()} \u2013 ${k[N.getMonth()]} ${N.getDate()}`},v=e&&t,y=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),w<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,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 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${h()}`:"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:h()})]}),o&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:zf.map(w=>jsxRuntime.jsx("button",{onClick:()=>b(w.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:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.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:w=>a(w.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:w=>a(e,w.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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Lo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let y=m.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,N=300,k=380,S=4,C=y.right-N;C<10&&(C=y.left),C+N>x-10&&(C=x-N-10);let I=w-y.bottom,$=y.top,P;I>=k+S?P=y.bottom+S:$>=k+S?P=y.top-k-S:P=I>=$?y.bottom+S:Math.max(10,y.top-k-S),p({top:P,left:C}),n(true);};react.useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let b=y=>{let w=e.some(x=>x.id===y.id);a(w?e.filter(x=>x.id!==y.id):[...e,y]);},h=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.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"}):h.map(y=>{let w=e.some(x=>x.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>b(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),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 Ps(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(n.has(p))return true}}return n.delete(c),false};return i(a)}function On({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=react.useState(false),[l,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,b]=react.useState({top:0,left:0}),[h,v]=react.useState(null),f=react.useRef(null),y=react.useRef(null),w=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,P=300,te=d?380:120,O=4,H=C.right-P;H<10&&(H=C.left),H+P>$-10&&(H=$-P-10);let F=I-C.bottom,J=C.top,ee;F>=te+O?ee=C.bottom+O:J>=te+O?ee=C.top-te-O:ee=F>=J?C.bottom+O:Math.max(10,C.top-te-O),b({top:ee,left:H}),c(true);};react.useEffect(()=>{if(!i||!y.current)return;let C=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,P=300,te=d?380:120,O=4,H=C.right-P;H<10&&(H=C.left),H+P>$-10&&(H=$-P-10);let F=I-C.bottom,J=C.top,ee;F>=te+O?ee=C.bottom+O:J>=te+O?ee=C.top-te-O:ee=F>=J?C.bottom+O:Math.max(10,C.top-te-O),b({top:ee,left:H});},[d,i]),react.useEffect(()=>{let C=I=>{f.current&&!f.current.contains(I.target)&&!y.current?.contains(I.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{let C=I=>{I.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]);let x=C=>{let I=t.includes(C),$=a.find(P=>P.id===C);if(v(null),I){let P=t.filter(te=>te!==C);r(P),P.length===0&&m(false);}else {if(s&&Ps(a,C,e)){let te=`Cannot add "${$?.title||C}" as dependency - would create circular reference`;v(te),n?.(C,$?.title||C),setTimeout(()=>v(null),3e3);return}r([...t,C]),m(true);}},N=()=>{let C=!d;m(C),C||r([]);},k=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(l.toLowerCase())||C.id.toLowerCase().includes(l.toLowerCase())),S=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>i?c(false):w(),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:S,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:S},children:t.length})]}),i&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:C=>p(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:k.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"}):k.map(C=>{let I=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>x(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.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:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var qr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:b}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:Ss.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:h,...l,...p,onClick:()=>a?.(e),children:t(e)});let v=i.filter(x=>e.assignedUserIds?.includes(x.id)),f=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),w={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:u("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}),N===3&&y.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Po,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Bn,{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:(x,N)=>n?.(e.id,{startDate:x,endDate:N})})}),i.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Lo,{assignedUsers:v,availableUsers:i,onChange:x=>n?.(e.id,{assignedUserIds:x.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(On,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),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)));qr.displayName="Card";var As={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"}},xu=({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 vu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),p=[...Object.entries(As).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(As).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=As[e];if(v)return {...v,id:e};let f=r.find(y=>y.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...As.todo,id:"todo"}},m=()=>{if(!l.current)return;let v=l.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,w=180,x=280,N=4,k=v.right-w;k<10&&(k=v.left),k+w>y-10&&(k=y-w-10);let S=f-v.bottom,C=v.top,I;S>=x+N?I=v.bottom+N:C>=x+N?I=v.top-x-N:I=S>=C?v.bottom+N:Math.max(10,v.top-x-N),i({top:I,left:k}),s(true);};react.useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},b=d(),h=b.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,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:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:b.label,children:jsxRuntime.jsx(xu,{icon:b.icon,color:h})}),o&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(v=>jsxRuntime.jsxs("button",{onClick:()=>g(v.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:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(xu,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.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"})})]},v.id))})]})})]})}var wu={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 ku({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=wu[s]||wu.en,[i,c]=react.useState(false),[l,p]=react.useState(false),[d,m]=react.useState(e),[g,b]=react.useState({top:0,left:0}),h=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(i&&v.current){let N=v.current.getBoundingClientRect();b({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[i]),react.useEffect(()=>{let N=k=>{h.current&&!h.current.contains(k.target)&&!v.current?.contains(k.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),react.useEffect(()=>{let N=k=>{k.key==="Escape"&&(c(false),p(false),m(e));};if(i)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,e]),react.useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let y=()=>{p(true),m(e);},w=()=>{let N=d.trim();N&&N!==e&&t(N),p(false),c(false),m(e);},x=N=>{N.key==="Enter"?w():N.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>c(!i),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"})]})}),i&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{ref:h,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:l?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:N=>m(N.target.value),onKeyDown:x,onBlur:w,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:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var on=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:b,onColumnDelete:h,isDeletable:v=false,className:f,renderMetrics:y,locale:w})=>{let{setNodeRef:x,isOver:N}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),S=p??Kc(t.length),C=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:S});if(a)return jsxRuntime.jsx("div",{ref:x,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),P=$.state==="exceeded",te=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",P&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(te()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.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"})]}),$.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"})]}),$.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"})}),$.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"})]})]}),(b||h)&&jsxRuntime.jsx(ku,{columnTitle:e.title,onRename:O=>b?.(e.id,O),onDelete:h?()=>h(e.id):void 0,isDeletable:v,locale:w}),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"})]})]}),y&&y(e,t),!m&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(O=>O.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):S?jsxRuntime.jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(O=>{let H=t[O.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsxRuntime.jsx(qr,{card:H,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},H.id):null})}):t.map(O=>jsxRuntime.jsx(qr,{card:O,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},O.id))})})]})});on.displayName="Column";function bl({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:i,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function sb(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 Eu(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(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function ib(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function lb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var db=["\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 Fu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:h=10}){let v=i==="dark",[f,y]=react.useState(false),[w,x]=react.useState([]),[N,k]=react.useState(0),[S,C]=react.useState(null),[I,$]=react.useState(false),P=react.useRef(null),te=react.useRef(null),O=react.useRef(null),H=react.useRef(null),F=react.useCallback((U,oe)=>{let Z=sb(U,oe);if(C(Z),Z){let Se=r.filter(ke=>ke.name.toLowerCase().includes(Z.query)||ke.email&&ke.email.toLowerCase().includes(Z.query)).slice(0,5);x(Se),y(Se.length>0),k(0);}else y(false),x([]);},[r]),J=U=>{let oe=U.target.value;if(t(oe),F(oe,U.target.selectionStart||0),P.current){P.current.style.height="24px";let Z=P.current.scrollHeight,Se=280,ke=Math.min(Z,Se);P.current.style.height=`${ke}px`,P.current.style.overflowY=Z>Se?"auto":"hidden";}},ee=()=>{P.current&&F(e,P.current.selectionStart||0);},Re=react.useCallback(U=>{if(!S||!P.current)return;let oe=e.slice(0,S.start),Z=e.slice(S.end),Se=`@${U.name.replace(/\s+/g,"")} `,ke=oe+Se+Z;t(ke),y(false),C(null),setTimeout(()=>{if(P.current){let Ie=S.start+Se.length;P.current.selectionStart=Ie,P.current.selectionEnd=Ie,P.current.focus();}},0);},[S,e,t]),B=U=>{if(f&&w.length>0)switch(U.key){case "ArrowDown":U.preventDefault(),k(oe=>oe<w.length-1?oe+1:0);break;case "ArrowUp":U.preventDefault(),k(oe=>oe>0?oe-1:w.length-1);break;case "Enter":{U.preventDefault();let oe=w[N];oe&&Re(oe);break}case "Tab":{U.preventDefault();let oe=w[N];oe&&Re(oe);break}case "Escape":U.preventDefault(),y(false);break}else U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),a());};react.useEffect(()=>{let U=oe=>{te.current&&!te.current.contains(oe.target)&&P.current&&!P.current.contains(oe.target)&&y(false),H.current&&!H.current.contains(oe.target)&&$(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let Y=react.useCallback(U=>{if(!P.current)return;let oe=P.current.selectionStart||e.length,Z=e.slice(0,oe)+U+e.slice(oe);t(Z),$(false),setTimeout(()=>{if(P.current){let Se=oe+U.length;P.current.selectionStart=Se,P.current.selectionEnd=Se,P.current.focus();}},0);},[e,t]),ye=react.useCallback(U=>{if(!g||!U.target.files)return;let oe=Array.from(U.target.files),Z=h*1024*1024,Se=oe.filter(ke=>ke.size>Z?(console.warn(`File ${ke.name} exceeds max size of ${h}MB`),false):true);Se.length>0&&g(Se),U.target.value="";},[g,h]),Ge=react.useCallback(U=>U.type.startsWith("image/")?lucideReact.Image:U.type.includes("pdf")||U.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&te.current){let U=te.current.children[N];U&&U.scrollIntoView({block:"nearest"});}},[N,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(U=>{let oe=Ge(U.file),Z=U.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[Z&&U.preview?jsxRuntime.jsx("img",{src:U.preview,alt:U.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(oe,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",v?"text-white":"text-gray-900"),children:U.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:lb(U.file.size)})]}),b&&jsxRuntime.jsx("button",{onClick:()=>b(U.id),className:u("p-0.5 rounded-full transition-colors",v?"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"})})]},U.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[l&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$(!I),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",v?"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:I&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"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:db.map(U=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(U),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:U},U))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:O,type:"file",multiple:true,onChange:ye,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:P,value:e,onChange:J,onSelect:ee,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:te,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((U,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Re(U),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",oe===N?v?"bg-white/10":"bg-gray-100":v?"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:U.color||"#8B5CF6"},children:ib(U.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:U.name}),U.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:U.email})]})]},U.id))})})]})]})]})}function Mu({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((i,c)=>i.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsxRuntime.jsx("span",{children:i.value},c))})}var Os=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function uo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=react.useState(false),[l,p]=react.useState(""),[d,m]=react.useState(false),[g,b]=react.useState(Os[10]||"#2E94FF"),[h,v]=react.useState({top:0,left:0}),f=react.useRef(null),y=react.useRef(null),w=react.useRef(null),x=react.useRef(null),N=t.filter(P=>P.name.toLowerCase().includes(l.toLowerCase())),k=t.some(P=>P.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(i&&y.current){let P=y.current.getBoundingClientRect();v({top:P.bottom+6,left:P.left});}},[i]),react.useEffect(()=>{let P=te=>{let O=te.target,H=f.current?.contains(O),F=w.current?.contains(O);!H&&!F&&(c(false),p(""),m(false));};if(i)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[i]),react.useEffect(()=>{i&&x.current&&x.current.focus();},[i]);let S=P=>{let te=e.some(O=>O.id===P.id);a(te?e.filter(O=>O.id!==P.id):[...e,P]);},C=async()=>{if(!(!r||!l.trim())){m(true);try{let P=await r(l.trim(),g);P&&(a([...e,P]),p(""),b(Os[Math.floor(Math.random()*Os.length)]||"#2E94FF"));}finally{m(false);}}},I=(P,te)=>{te.stopPropagation(),a(e.filter(O=>O.id!==P));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,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(P=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${P.color}20`,color:P.color},children:P.name},P.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:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,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:h.top,left:h.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:x,type:"text",value:l,onChange:P=>p(P.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:P=>{P.key==="Enter"&&l.trim()&&!k&&r&&C();}})}),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(P=>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:`${P.color}20`,color:P.color},onClick:te=>I(P.id,te),children:[P.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},P.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(P=>{let te=e.some(O=>O.id===P.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>S(P),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:te?`${P.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{te||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{te||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:P.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:P.name}),te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:P.color}})]},P.id)}):l.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"})}),l.trim()&&!k&&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:Os.map(P=>jsxRuntime.jsx("button",{type:"button",onClick:()=>b(P),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:P,outline:g===P?`2px solid ${P}`:"none",outlineOffset:"2px"}},P))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function yl({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 Au({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(yl,{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 Bo=[{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 Lu(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 yb(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 xb({className:e}){return jsxRuntime.jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function xl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=yb(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"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Lu(e.loggedMinutes),l=e.estimateMinutes?Lu(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(xb,{className:i[t]}),jsxRuntime.jsx("span",{children:p})]})}function vb(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 Hs(e){let t=vb(e);return t!==null?String(t):e}function Bu(e){let a=Hs(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function zs(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 Cb(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 Tb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Nb({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 Ru({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 Db({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 vl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:d}){let[m,g]=react.useState(""),[b,h]=react.useState(t.estimateMinutes?zs(t.estimateMinutes):""),[v,f]=react.useState(""),[y,w]=react.useState(false),[x,N]=react.useState(false),k=react.useRef(null);react.useEffect(()=>{k.current?.focus();},[]);let S=async()=>{let $=Bu(m);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},C=async()=>{if(!n)return;let $=b.trim()?Bu(b):null;await n($),N(false);},I=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),S()),$.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Ru,{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:Cb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Nb,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Ru,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(Tb,{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(Db,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:m,onChange:$=>g($.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:S,disabled:y||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:$=>f($.target.value),onKeyDown:I,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:zs(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"}),x?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:b,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&C(),$.key==="Escape"&&N(false);},onBlur:C,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?zs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map($=>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:$.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:zs($.durationMinutes)})]},$.id))})]})]})}function Pb(e){let a=Hs(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Ab(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 zr({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=react.useState(Ab(r)),[l,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let b=async()=>{m(true);let w=Pb(i);await o(w&&w>0?w:null,l||void 0),m(false);},h=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:l,onChange:w=>p(w.target.value),onKeyDown:v,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:h,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Lb(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 Ib(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 kl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Lb(e.health),s=Ib(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function nn(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 Rb(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 Ob(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 $b(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 Hb({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",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",nn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:nn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:nn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function zb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?nn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:nn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,nn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Ob(e.status,a),Rb(e.status,a)),children:$b(e.status,t)})})]})}function Cl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((b,h)=>b.varianceMinutes===null?1:h.varianceMinutes===null?-1:h.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Hb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",l),children:g.map(b=>jsxRuntime.jsx(zb,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function sn(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 eh(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 ju(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 th(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 Jr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:b=[],onAddComment:h,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:y,enableTimeTracking:w=false,timeTrackingSummary:x,timeEntries:N=[],isTimerRunning:k=false,timerElapsedSeconds:S=0,onTimeLog:C,onEstimateUpdate:I,onSoldEffortUpdate:$,onTimerStart:P,onTimerStop:te,onTimerDiscard:O,blurFinancials:H=false}){let F=s==="dark",J={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ee=e&&"title"in e&&!("name"in e),Re=e,[B,Y]=react.useState(e?ju(e,i):null),[ye,Ge]=react.useState(false),[U,oe]=react.useState(false),[Z,Se]=react.useState(false),[ke,Ie]=react.useState(null),[He,et]=react.useState(new Date),[ae,Xe]=react.useState(false),[pe,at]=react.useState(false),[mt,Pt]=react.useState(""),[Ce,yt]=react.useState(false),[nt,Je]=react.useState(false),[z,ne]=react.useState(false),[D,q]=react.useState(false),[ce,Te]=react.useState(""),W=react.useRef(null),re=react.useRef(null),[Ue,Ne]=react.useState(""),ze=react.useRef(null),[Fe,Ke]=react.useState(""),[lt,ut]=react.useState(false),[st,Ze]=react.useState([]),[zt,Ct]=react.useState(""),[ht,wt]=react.useState(false),rt=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=ju(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),Y(T),Te(T.description||""),Ne(T.name||"");}},[e?.id,e?.quotedMinutes,i,t]),react.useEffect(()=>{if(!t||!ce)return;let T=setTimeout(()=>{let j=re.current;j&&(j.style.height="auto",j.style.height=`${Math.max(100,j.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,ce]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),ze.current&&clearTimeout(ze.current);},[]),react.useEffect(()=>{t&&rt.current&&b.length>0&&setTimeout(()=>{rt.current&&(rt.current.scrollTop=rt.current.scrollHeight);},100);},[t,b.length]);let Lt=react.useCallback(T=>{Y(T),ee&&o&&Re?o(th(T,Re)):r&&r(T);},[ee,Re,o,r]),We=react.useCallback(()=>{Ge(false),oe(false),Se(false),Ie(null),at(false),Pt(""),yt(false);},[]),Be=react.useCallback((T,j)=>{if(!B)return;let xe={...B,[T]:j};Lt(xe);},[B,Lt]),pt=react.useCallback(()=>{let T=re.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),ie=react.useCallback(T=>{Te(T),setTimeout(pt,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(B){let j={...B,description:T};Lt(j);}},800);},[B,Lt,pt]),be=react.useCallback(T=>{Ne(T),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>{if(B&&T.trim()){let j={...B,name:T.trim()};Lt(j);}},800);},[B,Lt]),A=react.useCallback(T=>{let j=T.map(xe=>{let Le={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:xe};return xe.type.startsWith("image/")&&(Le.preview=URL.createObjectURL(xe)),Le});Ze(xe=>[...xe,...j]);},[]),K=react.useCallback(T=>{Ze(j=>{let xe=j.find(Le=>Le.id===T);return xe?.preview&&URL.revokeObjectURL(xe.preview),j.filter(Le=>Le.id!==T)});},[]),X=react.useCallback(async()=>{if(!(!B||!Fe.trim()&&st.length===0||!h)){ut(true);try{let T=Eu(Fe,f),j=[];if(st.length>0&&y){let xe=st.map(Le=>Le.file);j=await y(xe);}await h(B.id,Fe.trim(),T.length>0?T:void 0,j.length>0?j:void 0),Ke(""),st.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),Ze([]);}finally{ut(false);}}},[B,Fe,st,h,f,y]),me=react.useCallback(()=>{if(!B||!zt.trim())return;let T=B.subtasks||[],j={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:zt.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},xe=[...T,j],Le={...B,subtasks:xe};Lt(Le),Ct(""),wt(false);},[B,zt,Lt]),Ee=react.useCallback(T=>{if(!B?.subtasks)return;let j=B.subtasks.map(Le=>Le.id===T?{...Le,progress:Le.progress===100?0:100}:Le),xe={...B,subtasks:j};Lt(xe);},[B,Lt]),Ye=react.useCallback(T=>{if(!B?.subtasks)return;let j=B.subtasks.filter(Le=>Le.id!==T),xe={...B,subtasks:j};Lt(xe);},[B,Lt]),Ve=react.useCallback(T=>{let j=typeof T=="string"?new Date(T):T,Le=new Date().getTime()-j.getTime(),Qe=Math.floor(Le/6e4),tt=Math.floor(Le/36e5),xt=Math.floor(Le/864e5);return Qe<1?n==="es"?"Ahora":"Just now":Qe<60?n==="es"?`Hace ${Qe} min`:`${Qe}m ago`:tt<24?n==="es"?`Hace ${tt}h`:`${tt}h ago`:xt<7?n==="es"?`Hace ${xt}d`:`${xt}d ago`:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Oe=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 xe={...B,status:T,progress:j};Lt(xe),Ge(false);},[B,Lt]),bt=react.useCallback((T,j)=>{if(!B)return;let xe={...B,startDate:T,endDate:j};Lt(xe);},[B,Lt]),gt=react.useCallback(()=>{let T=He.getFullYear(),j=He.getMonth(),xe=new Date(T,j,1),Qe=new Date(T,j+1,0).getDate(),tt=xe.getDay(),xt=[],Rt=new Date(T,j,0).getDate();for(let Ot=tt-1;Ot>=0;Ot--)xt.push({date:new Date(T,j-1,Rt-Ot),isCurrentMonth:false});for(let Ot=1;Ot<=Qe;Ot++)xt.push({date:new Date(T,j,Ot),isCurrentMonth:true});let na=42-xt.length;for(let Ot=1;Ot<=na;Ot++)xt.push({date:new Date(T,j+1,Ot),isCurrentMonth:false});return xt},[He]),M=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),ne(false),!B||!d)return;let j=Array.from(T.dataTransfer.files);if(j.length!==0){q(true);try{await d(B.id,j);}finally{q(false);}}},[B,d]),le=react.useCallback(async T=>{if(!B||!d||!T.target.files)return;let j=Array.from(T.target.files);if(j.length!==0){q(true);try{await d(B.id,j);}finally{q(false);}T.target.value="";}},[B,d]),fe=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),ne(true);},[]),L=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),ne(false);},[]),G=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),de=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:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",F?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=B.progress===100?0:100,xe={...B,progress:T,status:T===100?"completed":"todo"};Lt(xe);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ue,onChange:T=>be(T.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":F?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{We(),Ge(!ye);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"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:ye&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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:()=>Oe(T.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.status===T.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),Se(!Z);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((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:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Se(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(T=>{let j=B.assignees?.some(xe=>xe.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=B.assignees||[],Le;j?Le=xe.filter(Qe=>Qe.name!==T.name):Le=[...xe,T],Be("assignees",Le);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",j&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",F?"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:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(ke?null:"start"),et(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",F?"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:ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,j=new Date(T);j.setDate(T.getDate()+1);let xe=new Date(T);xe.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 Qe=new Date(T);Qe.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let tt=new Date(T);tt.setDate(T.getDate()+14);let xt=new Date(T);return xt.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:xe,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:Qe,display:Qe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:xt,display:xt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((na,Ot)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ke==="start"){let _a=B.endDate&&na.date>B.endDate?na.date:B.endDate;bt(na.date,_a),Ie("end");}else {let _a=B.startDate&&na.date<B.startDate?na.date:B.startDate;bt(_a,na.date),Ie(null);}},children:[jsxRuntime.jsx("span",{children:na.label}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:na.display})]},Ot))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{bt(void 0,void 0),Ie(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ke==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",F?"text-white":"text-gray-900"),children:He.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:()=>et(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()-1)),className:u("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()+1)),className:u("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:gt().map((T,j)=>{let xe=T.date.toDateString()===new Date().toDateString(),Le=B.startDate?.toDateString()===T.date.toDateString(),Qe=B.endDate?.toDateString()===T.date.toDateString(),tt=Le||Qe,xt=B.startDate&&B.endDate&&T.date>=B.startDate&&T.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Rt=new Date(T.date);if(ke==="start"){let na=B.endDate&&Rt>B.endDate?Rt:B.endDate;bt(Rt,na),Ie("end");}else {let na=B.startDate&&Rt<B.startDate?Rt:B.startDate;bt(na,Rt),Ie(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(F?"text-white":"text-gray-900"),xe&&"ring-2 ring-[#2E94FF]",Le&&"bg-[#2E94FF] text-white",Qe&&!Le&&"bg-[#7C3AED] text-white",xt&&!tt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!tt&&(F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{We(),oe(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":F?"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:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>oe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"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:()=>{Be("priority",T.id),oe(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.priority===T.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ae?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:T=>{let j=parseInt(T.target.value),xe=B.status;j===100?xe="completed":j>0?xe="in-progress":xe="todo";let Le={...B,progress:j,status:xe};Lt(Le);},onBlur:()=>Xe(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Xe(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?sn(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:sn(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="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(zr,{mode:"estimate",locale:n,isDark:F,currentValue:x?.estimateMinutes||null,onSave:async T=>{await I?.(B.id,T),Je(false);},onClose:()=>Je(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:H?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?sn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:sn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="quoted"&&!H&&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(zr,{mode:"quoted",locale:n,isDark:F,currentValue:B.quotedMinutes||null,onSave:async T=>{$?(await $(B.id,T),Y(j=>j?{...j,quotedMinutes:T}:null)):Be("quotedMinutes",T),Je(false);},onClose:()=>Je(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",F?"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"})}):k?jsxRuntime.jsxs("button",{type:"button",onClick:()=>te?.(B.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),eh(S||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>P?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"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:()=>Je("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[sn(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",sn(x.estimateMinutes)]})]}),x.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="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(zr,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(T,j)=>{T&&await C?.(B.id,{durationMinutes:T,note:j,source:"manual"}),Je(false);},onClose:()=>Je(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(uo,{selectedTags:B.tags||[],availableTags:c,onChange:T=>{Be("tags",T);},onCreateTag:l,theme:J})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"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(xe=>xe.id===T);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"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 xe=(B.dependencies||[]).filter(Le=>Le!==T);Be("dependencies",xe);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{We(),at(!pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{at(false),Pt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:mt,onChange:T=>Pt(T.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(T=>T.id!==B.id).filter(T=>mt===""||T.name.toLowerCase().includes(mt.toLowerCase())).map(T=>{let j=B.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=B.dependencies||[],Le;j?Le=xe.filter(Qe=>Qe!==T.id):Le=[...xe,T.id],Be("dependencies",Le);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",j&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",j?"bg-blue-500 border-blue-500":F?"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:u("block truncate",F?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),yt(!Ce);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Bo.find(T=>T.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>yt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Bo.map(T=>{let j=B.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{Be("color",T.value),yt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",j&&"ring-2 ring-offset-2",F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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=>Be("isMilestone",T.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":F?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:re,value:ce,onChange:T=>ie(T.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"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:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Ee(T.id),className:u("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":F?"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:u("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("button",{onClick:()=>Ye(T.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),ht?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:zt,onChange:T=>Ct(T.target.value),onKeyDown:T=>{T.key==="Enter"&&zt.trim()?me():T.key==="Escape"&&(wt(false),Ct(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",F?"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:me,disabled:!zt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",zt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"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:()=>{wt(false),Ct("");},className:u("p-2 rounded-lg transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>wt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(T=>{let j=de(T.type),xe=T.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[xe&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(j,{className:u("w-5 h-5",F?"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:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:G(T.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(T.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:fe,onDragLeave:L,onDrop:M,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"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:le,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",z?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:z?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
5
5
  .activity-comments-scroll::-webkit-scrollbar {
6
6
  width: 4px !important;
7
7
  }
@@ -13,10 +13,10 @@
13
13
  border-radius: 4px !important;
14
14
  }
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
- background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
16
+ background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:gt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...b].sort((S,oe)=>{let Te=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,We=typeof oe.createdAt=="string"?new Date(oe.createdAt):oe.createdAt;return Te.getTime()-We.getTime()}).map(S=>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:S.user?.color||"#8B5CF6"},children:S.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:u("text-sm font-medium",L?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:_e(S.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Fu,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(oe=>{let Te=oe.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:u("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:[Te?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:oe.name})]},oe.id)})})]})]},S.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Eu,{value:Ne,onChange:Ke,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!h,isSubmitting:bt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!y,pendingFiles:nt,onFilesSelect:P,onRemoveFile:K})})]})]})]})})}function Cl(){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 po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:h,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onTaskOpen:x,onUploadCommentAttachments:C,enableTimeTracking:k,timeTrackingSummary:D,timeEntries:T,timerState:I,onLogTime:$,onUpdateEstimate:A,onUpdateSoldEffort:_,onStartTimer:E,onStopTimer:me,onDiscardTimer:L,blurFinancials:X=false,sidePanel:Z,renderColumnMetrics:He,suppressDetailModal:O=false}){let[j,he]=Cl(),[je,U]=react.useState(null),[re,ee]=react.useState(false),Ee=react.useRef(null),we=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Be=o?.theme||"dark",ze=Be==="dark"||Be==="neutral",Qe=ze?"dark":"",te=react.useCallback((N,Y)=>{t.onCardUpdate?.(N,Y);},[t]),tt=react.useCallback((N,Y)=>{t.onColumnUpdate?.(N,{title:Y});},[t]),pe=react.useCallback(N=>{t.onColumnDelete?.(N);},[t]),at=["todo","in-progress","completed"],pt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Et=react.useMemo(()=>{let N=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(ke=>e.cards.find(V=>V.id===ke)).filter(ke=>ke!==void 0).sort((ke,V)=>ke.position-V.position);N.set(Y.id,ie);}),N},[e.cards,e.columns]);react.useEffect(()=>{let N=Ee.current;if(!N)return;let Y=ae=>{let Ve=ae.target,De=ae.button===1,Ue=Ve===N||Ve.classList.contains("asakaa-column")&&!Ve.closest(".asakaa-card");(De||ae.button===0&&Ue&&!j.isDragging)&&(ae.preventDefault(),ee(true),we.current={x:ae.clientX,y:ae.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},ie=ae=>{if(!re)return;let Ve=ae.clientX-we.current.x,De=ae.clientY-we.current.y;N.scrollLeft=we.current.scrollLeft-Ve,N.scrollTop=we.current.scrollTop-De;},ke=()=>{re&&(ee(false),N.style.cursor="",N.style.userSelect="");},V=()=>{re&&(ee(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke),N.addEventListener("mouseleave",V),()=>{N.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ke),N.removeEventListener("mouseleave",V);}},[re,j.isDragging]);let Ce=react.useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),rt=react.useCallback(N=>{let{active:Y}=N,ie=e.cards.find(ke=>ke.id===Y.id);ie&&he({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,he]),it=react.useCallback(N=>{let{active:Y,over:ie}=N;if(!ie||!e.cards.find(ae=>ae.id===Y.id))return;let V=null;ie.data.current?.type==="column"?V=ie.id:ie.data.current?.type==="card"&&(V=e.cards.find(Ve=>Ve.id===ie.id)?.columnId||null),V&&V!==j.targetColumnId&&he({...j,targetColumnId:V});},[e.cards,j,he]),Ze=react.useCallback(async N=>{let{active:Y,over:ie}=N;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let ke=e.cards.find(De=>De.id===Y.id);if(!ke)return;let V,ae;if(ie.data.current?.type==="column"){V=ie.id;let De=Et.get(V)||[];ae=nl(De,0);}else {let De=e.cards.find(Ke=>Ke.id===ie.id);if(!De)return;V=De.columnId;let Ue=Et.get(V)||[],Ne=Ue.findIndex(Ke=>Ke.id===ie.id);ae=nl(Ue,Ne);}let Ve=e.columns.find(De=>De.id===V);if(Ve&&Ve.wipLimit&&Ve.wipLimitType==="hard"){let De=Et.get(V)||[];if(ke.columnId!==V&&De.length>=Ve.wipLimit){t.onWipLimitExceeded?.(Ve,ke);return}}(ke.columnId!==V||ke.position!==ae)&&await t.onCardMove?.(ke.id,V,ae);},[e.cards,e.columns,Et,t,he]),H=react.useCallback(N=>{O||U(N),a?.(N),x?.(N.id);},[a,x,O]),de=react.useCallback(N=>{t.onCardUpdate?.(N.id,N),U(N);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",Qe,n),style:i,children:jsxRuntime.jsx(ph,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:u("asakaa-board",Qe,n),style:i,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(ru,{themeName:Be,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:pt,collisionDetection:core$1.closestCorners,onDragStart:rt,onDragOver:it,onDragEnd:Ze,children:[jsxRuntime.jsxs("div",{ref:Ee,className:u("asakaa-board",Z?"flex-1":"",Qe,n),style:{...i,cursor:re?"grabbing":void 0},"data-theme":Be,children:[e.columns.sort((N,Y)=>N.position-Y.position).map(N=>{let Y=Et.get(N.id)||[],ie=!at.includes(N.id),ke=r?.renderColumnFooter?.(N);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(rn,{column:N,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:He?(V,ae)=>He(V,ae):void 0,onCardClick:H,onCardUpdate:te,onColumnRename:t.onColumnUpdate?tt:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),ke]},N.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:j.draggedCardId?jsxRuntime.jsx(Kr,{card:e.cards.find(N=>N.id===j.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!O&&jsxRuntime.jsx(qr,{task:je,isOpen:!!je,onClose:()=>U(null),onCardUpdate:de,theme:ze?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:je?g?.get(je.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:h,availableTasks:Ce,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onUploadCommentAttachments:C,enableTimeTracking:k,timeTrackingSummary:D,timeEntries:T,isTimerRunning:I?.isRunning,timerElapsedSeconds:I?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:A,onSoldEffortUpdate:_,onTimerStart:E,onTimerStop:me,onTimerDiscard:L,blurFinancials:X})]})}function ph({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 hh={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)"},yh={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)"},xh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},vh={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),i=react.useRef(null);react.useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),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:{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((l,p)=>l.position-p.position).map((l,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function kh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,b)=>{if(b){c(g);try{await b();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),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:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((g,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===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 Ch({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 Nl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p}){let d=r==="dark"?hh:yh,m={...o==="es"?xh:vh,...l},g=n||i||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kh,{theme:d,t:m,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsxRuntime.jsx(wh,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(Ch,{onClick:()=>t(),label:a||m.newTask}))]})})}function Sl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(""),l=react.useCallback(()=>{let m=i.trim();m&&(e(m),c(""),n(false));},[i,e]),p=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),l()):m.key==="Escape"&&(c(""),n(false));},[l]),d=react.useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:i,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Io({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(false),[y,w]=react.useState(false),[x,C]=react.useState(false),[k,D]=react.useState(s||new Date),T=react.useRef(null),I=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let A=react.useCallback(()=>{f(false),w(false),C(false);},[]),_=react.useCallback(()=>{l(""),d(void 0),g(null),h(null),A(),t();},[t,A]),E=react.useCallback(()=>{let X=c.trim();if(!X)return;let Z=a.find(O=>O.id===m),He=b||s;e({name:X,priority:p,assignee:Z||void 0,assigneeId:m,startDate:He,endDate:He}),l(""),d(void 0),g(null),h(null),A(),T.current?.focus();},[c,p,m,b,s,a,e,A]),me=react.useCallback(X=>{X.key==="Enter"&&c.trim()&&(X.preventDefault(),E()),X.key==="Escape"&&_();},[E,_,c]),L=b||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>A(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:c,onChange:X=>l(X.target.value),placeholder:I?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:me})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),f(!v),w(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:I?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{d(X.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),C(!x),f(false),w(false),D(b||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",b?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(I?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Z=new Date(X);Z.setDate(X.getDate()+1);let He=new Date(X);He.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let O=new Date(X);O.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let j=new Date(X);j.setDate(X.getDate()+14);let he=new Date(X);he.setDate(X.getDate()+28);let je=I?"es-ES":"en-US";return [{label:I?"Hoy":"Today",date:X,display:X.toLocaleDateString(je,{weekday:"short"}).slice(0,3)+"."},{label:I?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(je,{weekday:"short"}).slice(0,3)+"."},{label:I?"Este fin de semana":"This weekend",date:He,display:I?"s\xE1b.":"sat."},{label:I?"Pr\xF3xima semana":"Next week",date:O,display:I?"lun.":"mon."},{label:I?"2 semanas":"2 weeks",date:j,display:j.toLocaleDateString(je,{day:"numeric",month:"short"})},{label:I?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(je,{day:"numeric",month:"short"})}].map((re,ee)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{h(re.date),C(false);},children:[jsxRuntime.jsx("span",{children:re.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},ee))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:k.toLocaleDateString(I?"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:()=>D(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:I?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(k.getFullYear(),k.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(k.getFullYear(),k.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(I?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=k.getFullYear(),Z=k.getMonth(),He=new Date(X,Z,1).getDay(),O=new Date(X,Z+1,0).getDate(),j=new Date(X,Z,0).getDate(),he=new Date().toDateString(),je=[];for(let re=He-1;re>=0;re--)je.push({dayNum:j-re,isCurrent:false,date:new Date(X,Z-1,j-re)});for(let re=1;re<=O;re++)je.push({dayNum:re,isCurrent:true,date:new Date(X,Z,re)});let U=42-je.length;for(let re=1;re<=U;re++)je.push({dayNum:re,isCurrent:false,date:new Date(X,Z+1,re)});return je.map((re,ee)=>{let Ee=re.date.toDateString()===he,we=(b||s)?.toDateString()===re.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",we&&"bg-[#007FFF] text-white",!we&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{h(re.date),C(false);},children:re.dayNum},ee)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),w(!y),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:I?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===X.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:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:I?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:E,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:I?"Guardar":"Save"})]})]})}function Al({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=react.useState(false),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[b,h]=react.useState(false),v=n==="dark",y={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let x=90,C=()=>{let k=p.current.getBoundingClientRect(),T=window.innerHeight-k.bottom<x+8;h(T),g({position:"fixed",...T?{bottom:window.innerHeight-k.top+4}:{top:k.bottom+4},left:k.left,width:k.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),react.useEffect(()=>{if(!c)return;let x=C=>{let k=C.target;d.current&&!d.current.contains(k)&&p.current&&!p.current.contains(k)&&l(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]);let w=react.useCallback(x=>{t({name:x.name,columnId:e,assigneeIds:x.assigneeId?[x.assigneeId]:void 0,startDate:x.startDate,endDate:x.endDate,priority:x.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:b?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:b?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",v?"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(Io,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:v,locale:i,dropdownDirection:"up"})})}),document.body)]})}var _n=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(po,{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 ip(e={}){return new _n(e)}var sn=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 Ll(e,t){let a=r=>jsxRuntime.jsx(sn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Bl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[d,m]=react.useState(false),[g,b]=react.useState(""),[h,v]=react.useState("home"),[f,y]=react.useState(""),[w,x]=react.useState("");react.useEffect(()=>{let T=I=>{(I.metaKey||I.ctrlKey)&&I.key===l&&(I.preventDefault(),m($=>!$)),I.key==="Escape"&&(m(false),v("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),react.useEffect(()=>{d||(v("home"),b(""),y(""),x(""));},[d]);let C=react.useCallback(()=>{m(false);},[]),k=react.useCallback(T=>{let[I,$]=T.split(":");switch(I){case "create-card":v("create-card");break;case "create-card-in":y($||"");break;case "navigate":$?(a?.($),C()):v("navigate");break;case "search":r?.(g),C();break;case "priority":v("priority");break;case "set-priority":w&&$&&(o?.(w,$),C());break;case "assign":v("assign");break;case "assign-user":w&&$&&(s?.(w,$),C());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,i,c,C]),D=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return d?jsxRuntime.jsx(Ht,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:b,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:h==="create-card"&&f?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&h==="create-card"&&f&&D();}}),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."}),h==="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:k,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:k,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:k,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:k,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},T.id))})]}),h==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),h==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let I=e.columns.find($=>$.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:k,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map($=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:$},$))})]},T.id)})})]}),h==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,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:k,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:k,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:k,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function cp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
18
+ `}),jsxRuntime.jsx("div",{ref:rt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...b].sort((T,j)=>{let xe=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,Le=typeof j.createdAt=="string"?new Date(j.createdAt):j.createdAt;return xe.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:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:T.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Ve(T.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Mu,{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 xe=j.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:j.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[xe?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"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:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Fu,{value:Fe,onChange:Ke,onSubmit:X,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!h,isSubmitting:lt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!y,pendingFiles:st,onFilesSelect:A,onRemoveFile:K})})]})]})]})})}function Nl(){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 go({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:h,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onTaskOpen:x,onUploadCommentAttachments:N,enableTimeTracking:k,timeTrackingSummary:S,timeEntries:C,timerState:I,onLogTime:$,onUpdateEstimate:P,onUpdateSoldEffort:te,onStartTimer:O,onStopTimer:H,onDiscardTimer:F,blurFinancials:J=false,sidePanel:ee,renderColumnMetrics:Re,suppressDetailModal:B=false}){let[Y,ye]=Nl(),[Ge,U]=react.useState(null),[oe,Z]=react.useState(false),Se=react.useRef(null),ke=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=o?.theme||"dark",He=Ie==="dark"||Ie==="neutral",et=He?"dark":"",ae=react.useCallback((D,q)=>{t.onCardUpdate?.(D,q);},[t]),Xe=react.useCallback((D,q)=>{t.onColumnUpdate?.(D,{title:q});},[t]),pe=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),at=["todo","in-progress","completed"],mt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Pt=react.useMemo(()=>{let D=new Map;return e.columns.forEach(q=>{let ce=q.cardIds.map(Te=>e.cards.find(W=>W.id===Te)).filter(Te=>Te!==void 0).sort((Te,W)=>Te.position-W.position);D.set(q.id,ce);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=Se.current;if(!D)return;let q=re=>{let Ue=re.target,Ne=re.button===1,ze=Ue===D||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Ne||re.button===0&&ze&&!Y.isDragging)&&(re.preventDefault(),Z(true),ke.current={x:re.clientX,y:re.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ce=re=>{if(!oe)return;let Ue=re.clientX-ke.current.x,Ne=re.clientY-ke.current.y;D.scrollLeft=ke.current.scrollLeft-Ue,D.scrollTop=ke.current.scrollTop-Ne;},Te=()=>{oe&&(Z(false),D.style.cursor="",D.style.userSelect="");},W=()=>{oe&&(Z(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",q),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Te),D.addEventListener("mouseleave",W),()=>{D.removeEventListener("mousedown",q),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Te),D.removeEventListener("mouseleave",W);}},[oe,Y.isDragging]);let Ce=react.useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),yt=react.useCallback(D=>{let{active:q}=D,ce=e.cards.find(Te=>Te.id===q.id);ce&&ye({isDragging:true,draggedCardId:ce.id,sourceColumnId:ce.columnId,targetColumnId:ce.columnId});},[e.cards,ye]),nt=react.useCallback(D=>{let{active:q,over:ce}=D;if(!ce||!e.cards.find(re=>re.id===q.id))return;let W=null;ce.data.current?.type==="column"?W=ce.id:ce.data.current?.type==="card"&&(W=e.cards.find(Ue=>Ue.id===ce.id)?.columnId||null),W&&W!==Y.targetColumnId&&ye({...Y,targetColumnId:W});},[e.cards,Y,ye]),Je=react.useCallback(async D=>{let{active:q,over:ce}=D;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ce)return;let Te=e.cards.find(Ne=>Ne.id===q.id);if(!Te)return;let W,re;if(ce.data.current?.type==="column"){W=ce.id;let Ne=Pt.get(W)||[];re=il(Ne,0);}else {let Ne=e.cards.find(Ke=>Ke.id===ce.id);if(!Ne)return;W=Ne.columnId;let ze=Pt.get(W)||[],Fe=ze.findIndex(Ke=>Ke.id===ce.id);re=il(ze,Fe);}let Ue=e.columns.find(Ne=>Ne.id===W);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Ne=Pt.get(W)||[];if(Te.columnId!==W&&Ne.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Te);return}}(Te.columnId!==W||Te.position!==re)&&await t.onCardMove?.(Te.id,W,re);},[e.cards,e.columns,Pt,t,ye]),z=react.useCallback(D=>{B||U(D),a?.(D),x?.(D.id);},[a,x,B]),ne=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),U(D);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsxRuntime.jsx(mh,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(ou,{themeName:Ie,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:mt,collisionDetection:core$1.closestCorners,onDragStart:yt,onDragOver:nt,onDragEnd:Je,children:[jsxRuntime.jsxs("div",{ref:Se,className:u("asakaa-board",ee?"flex-1":"",et,n),style:{...i,cursor:oe?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((D,q)=>D.position-q.position).map(D=>{let q=Pt.get(D.id)||[],ce=!at.includes(D.id),Te=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(on,{column:D,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Re?(W,re)=>Re(W,re):void 0,onCardClick:z,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:ce,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},D.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:Y.draggedCardId?jsxRuntime.jsx(qr,{card:e.cards.find(D=>D.id===Y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!B&&jsxRuntime.jsx(Jr,{task:Ge,isOpen:!!Ge,onClose:()=>U(null),onCardUpdate:ne,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:h,availableTasks:Ce,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onUploadCommentAttachments:N,enableTimeTracking:k,timeTrackingSummary:S,timeEntries:C,isTimerRunning:I?.isRunning,timerElapsedSeconds:I?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:P,onSoldEffortUpdate:te,onTimerStart:O,onTimerStop:H,onTimerDiscard:F,blurFinancials:J})]})}function mh({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 yh={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)"},xh={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)"},vh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},wh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function kh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),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:{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((l,p)=>l.position-p.position).map((l,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Ch({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,b)=>{if(b){c(g);try{await b();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),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:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((g,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===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 Th({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 Sl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p}){let d=r==="dark"?yh:xh,m={...o==="es"?vh:wh,...l},g=n||i||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ch,{theme:d,t:m,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsxRuntime.jsx(kh,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(Th,{onClick:()=>t(),label:a||m.newTask}))]})})}function Fl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(""),l=react.useCallback(()=>{let m=i.trim();m&&(e(m),c(""),n(false));},[i,e]),p=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),l()):m.key==="Escape"&&(c(""),n(false));},[l]),d=react.useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:i,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ro({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(false),[y,w]=react.useState(false),[x,N]=react.useState(false),[k,S]=react.useState(s||new Date),C=react.useRef(null),I=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{C.current?.focus();},[]);let P=react.useCallback(()=>{f(false),w(false),N(false);},[]),te=react.useCallback(()=>{l(""),d(void 0),g(null),h(null),P(),t();},[t,P]),O=react.useCallback(()=>{let J=c.trim();if(!J)return;let ee=a.find(B=>B.id===m),Re=b||s;e({name:J,priority:p,assignee:ee||void 0,assigneeId:m,startDate:Re,endDate:Re}),l(""),d(void 0),g(null),h(null),P(),C.current?.focus();},[c,p,m,b,s,a,e,P]),H=react.useCallback(J=>{J.key==="Enter"&&c.trim()&&(J.preventDefault(),O()),J.key==="Escape"&&te();},[O,te,c]),F=b||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>P(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:C,type:"text",value:c,onChange:J=>l(J.target.value),placeholder:I?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),f(!v),w(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:I?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{d(J.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),N(!x),f(false),w(false),S(b||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",b?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"}),F.toLocaleDateString(I?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,ee=new Date(J);ee.setDate(J.getDate()+1);let Re=new Date(J);Re.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let B=new Date(J);B.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let Y=new Date(J);Y.setDate(J.getDate()+14);let ye=new Date(J);ye.setDate(J.getDate()+28);let Ge=I?"es-ES":"en-US";return [{label:I?"Hoy":"Today",date:J,display:J.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:I?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:I?"Este fin de semana":"This weekend",date:Re,display:I?"s\xE1b.":"sat."},{label:I?"Pr\xF3xima semana":"Next week",date:B,display:I?"lun.":"mon."},{label:I?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:I?"4 semanas":"4 weeks",date:ye,display:ye.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((oe,Z)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{h(oe.date),N(false);},children:[jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},Z))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:k.toLocaleDateString(I?"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:()=>S(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:I?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>S(new Date(k.getFullYear(),k.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>S(new Date(k.getFullYear(),k.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(I?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=k.getFullYear(),ee=k.getMonth(),Re=new Date(J,ee,1).getDay(),B=new Date(J,ee+1,0).getDate(),Y=new Date(J,ee,0).getDate(),ye=new Date().toDateString(),Ge=[];for(let oe=Re-1;oe>=0;oe--)Ge.push({dayNum:Y-oe,isCurrent:false,date:new Date(J,ee-1,Y-oe)});for(let oe=1;oe<=B;oe++)Ge.push({dayNum:oe,isCurrent:true,date:new Date(J,ee,oe)});let U=42-Ge.length;for(let oe=1;oe<=U;oe++)Ge.push({dayNum:oe,isCurrent:false,date:new Date(J,ee+1,oe)});return Ge.map((oe,Z)=>{let Se=oe.date.toDateString()===ye,ke=(b||s)?.toDateString()===oe.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Se&&"ring-1 ring-[#007FFF]",ke&&"bg-[#007FFF] text-white",!ke&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{h(oe.date),N(false);},children:oe.dayNum},Z)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),w(!y),f(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(J=>J.id===m)?.color||"#007FFF"},children:a.find(J=>J.id===m)?.initials||a.find(J=>J.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:I?"Sin asignar":"Unassigned"})]}),a.map(J=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(J.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===J.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:J.color||"#007FFF"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:J.name})]},J.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:I?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:I?"Guardar":"Save"})]})]})}function Il({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=react.useState(false),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[b,h]=react.useState(false),v=n==="dark",y={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let x=90,N=()=>{let k=p.current.getBoundingClientRect(),C=window.innerHeight-k.bottom<x+8;h(C),g({position:"fixed",...C?{bottom:window.innerHeight-k.top+4}:{top:k.bottom+4},left:k.left,width:k.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),react.useEffect(()=>{if(!c)return;let x=N=>{let k=N.target;d.current&&!d.current.contains(k)&&p.current&&!p.current.contains(k)&&l(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]);let w=react.useCallback(x=>{t({name:x.name,columnId:e,assigneeIds:x.assigneeId?[x.assigneeId]:void 0,startDate:x.startDate,endDate:x.endDate,priority:x.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:b?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:b?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",v?"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(Ro,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:v,locale:i,dropdownDirection:"up"})})}),document.body)]})}var jn=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(go,{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 lp(e={}){return new jn(e)}var ln=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 Bl(e,t){let a=r=>jsxRuntime.jsx(ln,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ol({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[d,m]=react.useState(false),[g,b]=react.useState(""),[h,v]=react.useState("home"),[f,y]=react.useState(""),[w,x]=react.useState("");react.useEffect(()=>{let C=I=>{(I.metaKey||I.ctrlKey)&&I.key===l&&(I.preventDefault(),m($=>!$)),I.key==="Escape"&&(m(false),v("home"),b(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]),react.useEffect(()=>{d||(v("home"),b(""),y(""),x(""));},[d]);let N=react.useCallback(()=>{m(false);},[]),k=react.useCallback(C=>{let[I,$]=C.split(":");switch(I){case "create-card":v("create-card");break;case "create-card-in":y($||"");break;case "navigate":$?(a?.($),N()):v("navigate");break;case "search":r?.(g),N();break;case "priority":v("priority");break;case "set-priority":w&&$&&(o?.(w,$),N());break;case "assign":v("assign");break;case "assign-user":w&&$&&(s?.(w,$),N());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":i?.(),N();break;case "ai-usage":c?.(),N();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,i,c,N]),S=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:b,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:h==="create-card"&&f?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&h==="create-card"&&f&&S();}}),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."}),h==="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:k,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:k,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:k,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:k,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},C.id))})]}),h==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),h==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(C=>{let I=e.columns.find($=>$.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:k,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map($=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:$},$))})]},C.id)})})]}),h==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,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:k,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:k,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:k,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 up(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=b=>{b.stopPropagation();let h=r<a.length-1?r+1:0;l(),o(h);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function $h(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 Hh(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 Ol(e){return e.startsWith("image/")}function Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=react.useState(false),[c,l]=react.useState(false),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let b=react.useCallback((T,I)=>{I.preventDefault(),I.stopPropagation();let $=g.current.filter(E=>Ol(E.type)),A=$.findIndex(E=>E.id===T.id),_=E=>{let me=g.current.filter(X=>Ol(X.type)),L=me[E];L&&cp(L.url,L.name,me,E,_);};cp(T.url,T.name,$,A,_);},[]),h=react.useCallback(T=>{let I=[],$=[];return e.length+T.length>s?($.push(`Maximum ${s} files allowed`),{valid:I,errors:$}):(T.forEach(A=>{if(A.size/1048576>r){$.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>A.type.match(E))){$.push(`${A.name} has invalid file type`);return}I.push(A);}),{valid:I,errors:$})},[e.length,s,r,o]),v=react.useCallback(async T=>{let{valid:I,errors:$}=h(T);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){l(true),d(null);try{await t?.(I);}catch(A){d(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[h,t]),f=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(true);},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),x=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);let I=Array.from(T.dataTransfer.files);v(I);},[v]),C=react.useCallback(T=>{let I=T.target.files?Array.from(T.target.files):[];v(I),m.current&&(m.current.value="");},[v]),k=react.useCallback(()=>{m.current?.click();},[]),D=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:w,onDrop:x,onClick:k,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ol(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>b(T,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Hh(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:$h(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function $l({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:h,onEstimateEffort:v,currentUserId:f="user-1"}){let[y,w]=react.useState("details"),[x,C]=react.useState(false),[k,D]=react.useState({}),[T,I]=react.useState(""),[$,A]=react.useState(false),[_,E]=react.useState({});if(!t||!e)return null;let me=react.useCallback(()=>{C(false),D({}),w("details"),I(""),E({}),a();},[a]),L=react.useCallback(()=>{r&&Object.keys(k).length>0&&(r(e.id,k),D({}),C(false));},[e.id,k,r]),X=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),me());},[e.id,o,me]),Z=react.useCallback(()=>{p&&T.trim()&&(p(e.id,T.trim()),I(""));},[e.id,T,p]),He=react.useCallback(async()=>{if(b){A(true);try{let U=await b(e);E(re=>({...re,assignees:U}));}catch(U){console.error("Failed to suggest assignee:",U);}finally{A(false);}}},[e,b]),O=react.useCallback(async()=>{if(h){A(true);try{let U=await h(e);E(re=>({...re,subtasks:U}));}catch(U){console.error("Failed to generate subtasks:",U);}finally{A(false);}}},[e,h]),j=react.useCallback(async()=>{if(v){A(true);try{let U=await v(e);E(re=>({...re,effort:U}));}catch(U){console.error("Failed to estimate effort:",U);}finally{A(false);}}},[e,v]),he={...e,...k},je=s.filter(U=>he.assignedUserIds?.includes(U.id));return jsxRuntime.jsx(Ht,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:me,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:k.title??he.title,onChange:U=>D({...k,title:U.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{C(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>C(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:X,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:me,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:()=>w("details"),className:`card-detail-tab ${y==="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:()=>w("comments"),className:`card-detail-tab ${y==="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:()=>w("activity"),className:`card-detail-tab ${y==="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",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${y==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${y==="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:[y==="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"}),x?jsxRuntime.jsx("textarea",{value:k.description??he.description??"",onChange:U=>D({...k,description:U.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:he.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:k.assignedUserIds??he.assignedUserIds??[],onChange:U=>{let re=Array.from(U.target.selectedOptions,ee=>ee.value);D({...k,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(U=>jsxRuntime.jsx("option",{value:U.id,children:U.name},U.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:je.length>0?je.map(U=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsx("span",{children:U.name})]},U.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"}),x?jsxRuntime.jsxs("select",{value:k.priority??he.priority??"",onChange:U=>D({...k,priority:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:he.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.labels.map(U=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:U},U)):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"}),x?jsxRuntime.jsx("input",{type:"date",value:k.startDate?new Date(k.startDate).toISOString().split("T")[0]:he.startDate?new Date(he.startDate).toISOString().split("T")[0]:"",onChange:U=>D({...k,startDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.startDate?new Date(he.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:k.endDate?new Date(k.endDate).toISOString().split("T")[0]:he.endDate?new Date(he.endDate).toISOString().split("T")[0]:"",onChange:U=>D({...k,endDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:k.estimatedTime??he.estimatedTime??"",onChange:U=>D({...k,estimatedTime:U.target.value?parseFloat(U.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:he.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:he.dependencies&&he.dependencies.length>0?he.dependencies.map(U=>{let re=typeof U=="string"?U:U.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:he.createdAt?new Date(he.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:U=>I(U.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Z,disabled:!T.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(U=>{let re=s.find(ee=>ee.id===U.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[re&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(U.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(U.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:U.content})]},U.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"})]})})]}),y==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:i.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:i.map(U=>{let re=s.find(ee=>ee.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("COMMENT")&&"\u{1F4AC}",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",U.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:re?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.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"})]})}),y==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ur,{cardId:e.id,attachments:l,onUpload:m?U=>m(e.id,U):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),y==="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:He,disabled:$||!b,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:O,disabled:$||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:j,disabled:$||!v,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((U,re)=>{let ee=s.find(Ee=>Ee.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",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-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:U.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(U.confidence*100).toFixed(0),"%"]})]})]},re)})]}),_.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((U,re)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:U.title}),U.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:U.description}),U.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",U.estimatedTime,"h"]})]},re))]}),_.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),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(U=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${U.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:U.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:U.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:U.description}),U.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",U.suggestedAction]})]},U.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Kn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,b=4,h=d.left;h+o>g-10&&(h=g-o-10),h<10&&(h=10);let v=m-d.bottom,f=d.top,y;return v>=s+b?y=d.bottom+b:f>=s+b?y=d.top-s-b:v>=f?y=d.bottom+b:y=Math.max(10,d.top-s-b),{top:y,left:h}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;l.current&&!l.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Ht,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.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 dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#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 Kh=["LOW","MEDIUM","HIGH","URGENT"],Yh=["todo","in-progress","review","done"];function Ul({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:b=[],availableLabels:h=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:y,unsplashAccessKey:w,theme:x,onSubtasksChange:C,attachments:k=[],onUploadAttachments:D,onDeleteAttachment:T}){let I=en(),$=x||I?.themeName||"dark",[A,_]=react.useState(e),[E,me]=react.useState(false),[L,X]=react.useState(()=>[...e?.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0))),[Z,He]=react.useState(false),[O,j]=react.useState(""),[he,je]=react.useState(""),[U,re]=react.useState("all"),[ee,Ee]=react.useState(false),[we,Be]=react.useState(false),[ze,Qe]=react.useState(false),[te,tt]=react.useState(false),[pe,at]=react.useState(false),[pt,Et]=react.useState(false),Ce=react.useRef(null),rt=react.useRef(null),it=react.useRef(null),Ze=react.useRef(null),H=react.useRef(null),de=react.useRef(null),N=react.useRef(null),Y=react.useRef(null),ie=react.useRef(null),ke=react.useRef(null),V=react.useRef(null),ae=react.useRef(null);react.useEffect(()=>{if(e&&!A){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}else if(e&&A&&e.id!==A.id){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}},[e,A]),react.useEffect(()=>{let P=K=>{let q=K.target;Ze.current&&!Ze.current.contains(q)&&Ee(false),H.current&&!H.current.contains(q)&&Be(false),de.current&&!de.current.contains(q)&&Qe(false),N.current&&!N.current.contains(q)&&tt(false);};if(ee||we||ze||te)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[ee,we,ze,te]),react.useEffect(()=>{if(!t)return;let P=K=>{let q=K.target,ce=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(K.key==="Escape"){K.preventDefault(),ee||we||ze||te||pe||pt?(Ee(false),Be(false),Qe(false),tt(false),at(false),Et(false)):ce||a();return}if(ce&&K.key!=="Escape")return;let Se=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Ee(true);break;case "a":K.preventDefault(),Qe(true);break;case "p":K.preventDefault(),Be(true);break;case "l":K.preventDefault(),tt(true);break;case "d":Se||(K.preventDefault(),at(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Se||(K.preventDefault(),Et(true));break;case "i":K.preventDefault(),me(true),setTimeout(()=>rt.current?.focus(),0);break;case "t":K.preventDefault(),He(true);break;case "c":K.preventDefault(),it.current?.focus();break}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[t,a,ee,we,ze,te,pe,pt]);let Ve=react.useCallback(P=>{let K=P.currentTarget.textContent?.trim()||"";if(A&&K!==A.title){let q={...A,title:K};_(q),r?.(A.id,{title:K});}},[A,r]),De=react.useCallback(P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur()),P.key==="Escape"&&(P.preventDefault(),P.currentTarget.textContent=A?.title||"",P.currentTarget.blur());},[A]),Ue=react.useCallback(()=>{A&&e&&A.description!==e.description&&r?.(A.id,{description:A.description}),me(false);},[A,e,r]),Ne=react.useCallback(P=>{if(A){let K={...A,columnId:P};_(K),r?.(A.id,{columnId:P}),Ee(false);}},[A,r]),Ke=react.useCallback(P=>{if(A){let K={...A,priority:P};_(K),r?.(A.id,{priority:P}),Be(false);}},[A,r]),bt=react.useCallback(P=>{if(A){let K=A.assignedUserIds||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],ce={...A,assignedUserIds:q};_(ce),r?.(A.id,{assignedUserIds:q});}},[A,r]),lt=react.useCallback(P=>{if(A){let K=A.labels||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],ce={...A,labels:q};_(ce),r?.(A.id,{labels:q});}},[A,r]),nt=react.useCallback(P=>{if(A){let K={...A,tags:P};_(K),r?.(A.id,{tags:P});}},[A,r]),et=react.useCallback(P=>{if(A){let K=P.target.value,q={...A,endDate:K};_(q),r?.(A.id,{endDate:K}),at(false);}},[A,r]),At=react.useCallback(P=>{if(A){let K={...A,estimatedTime:parseFloat(P)||0};_(K),r?.(A.id,{estimatedTime:parseFloat(P)||0});}},[A,r]),Mt=react.useCallback(()=>{if(O.trim()&&A){let P={id:`subtask-${Date.now()}`,title:O.trim(),completed:false,position:L.length,createdAt:new Date},K=[...L,P];X(K),j(""),He(false),C?.(A.id,K);}},[O,L,A,C]),mt=react.useCallback(P=>{let K=L.map(q=>q.id===P?{...q,completed:!q.completed,updatedAt:new Date}:q);X(K),A&&C?.(A.id,K);},[L,A,C]),yt=react.useCallback(P=>{let K=L.filter(q=>q.id!==P);X(K),A&&C?.(A.id,K);},[L,A,C]),gt=react.useCallback(()=>{he.trim()&&A&&c&&(c(A.id,he.trim()),je(""));},[he,A,c]),Pt=react.useCallback(P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),gt());},[gt]),Ge=P=>jsxRuntime.jsx(Gh__default.default,{remarkPlugins:[_h__default.default],rehypePlugins:[jh__default.default],components:{a:({node:K,...q})=>jsxRuntime.jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:P}),Re=i.filter(P=>U==="comments"?P.type.includes("COMMENT"):U==="history"?!P.type.includes("COMMENT"):true);if(!t||!e)return null;let ut=A||e,le=s.filter(P=>ut.assignedUserIds?.includes(P.id)),fe=L.filter(P=>P.completed).length;return jsxRuntime.jsx(Ht,{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:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ve,onKeyDown:De,children:ut.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:Ze,children:[jsxRuntime.jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>Ee(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ut.columnId||"No status"})]}),jsxRuntime.jsx(Kn,{triggerRef:ie,isOpen:ee,onClose:()=>Ee(false),width:250,estimatedHeight:200,children:(b.length>0?b:Yh.map(P=>({id:P,title:P}))).map(P=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ut.columnId===P.id?"active":""}`,onClick:()=>Ne(P.id),children:P.title},P.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxRuntime.jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>Qe(!ze),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:le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:le.map(P=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:P.color},title:P.name,children:P.initials},P.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Kn,{triggerRef:ke,isOpen:ze,onClose:()=>Qe(false),width:280,estimatedHeight:300,children:s.map(P=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ut.assignedUserIds?.includes(P.id)?"active":""}`,onClick:()=>bt(P.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:P.color},children:P.initials}),P.name,ut.assignedUserIds?.includes(P.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"})})]},P.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxRuntime.jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>Be(!we),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ut.priority||"None"})]}),jsxRuntime.jsxs(Kn,{triggerRef:V,isOpen:we,onClose:()=>Be(false),width:180,estimatedHeight:220,children:[Kh.map(P=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${P.toLowerCase()} ${ut.priority===P?"active":""}`,onClick:()=>Ke(P),children:P},P)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),children:"None"})]})]}),v.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(lo,{selectedTags:ut.tags||[],availableTags:v,onChange:nt,onCreateTag:f,theme:dt[$]||dt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxRuntime.jsxs("button",{ref:ae,className:"modal-v2-field",onClick:()=>tt(!te),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:ut.labels&&ut.labels.length>0?jsxRuntime.jsx("span",{children:ut.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Kn,{triggerRef:ae,isOpen:te,onClose:()=>tt(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(P=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ut.labels?.includes(P)?"active":""}`,onClick:()=>lt(P),children:[P,ut.labels?.includes(P)&&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"})})]},P))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{at(!pe),setTimeout(()=>Y.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:ut.endDate?new Date(ut.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Y,type:"date",value:typeof ut.endDate=="string"?ut.endDate.split("T")[0]:ut.endDate?(()=>{let P=new Date(ut.endDate),K=P.getUTCFullYear(),q=String(P.getUTCMonth()+1).padStart(2,"0"),ce=String(P.getUTCDate()).padStart(2,"0");return `${K}-${q}-${ce}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Et(!pt),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:ut.estimatedTime?`${ut.estimatedTime}h`:"Not set"})]}),pt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ut.estimatedTime||"",onChange:P=>At(P.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Et(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"})]}),E?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ut.description||"",onChange:P=>{if(A){let K={...A,description:P.target.value};_(K);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>me(true),children:ut.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ge(ut.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:[fe,"/",L.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>He(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(P=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${P.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>mt(P.id),children:P.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:P.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>yt(P.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"})]})})]},P.id)),Z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:O,onChange:P=>j(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Mt(),P.key==="Escape"&&(He(false),j(""));},onBlur:Mt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||k.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"}),k.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:k.length})]}),jsxRuntime.jsx(Ur,{cardId:ut.id,attachments:k,onUpload:D?P=>D(ut.id,P):void 0,onDelete:T,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 ${U==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:it,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:P=>je(P.target.value),onKeyDown:Pt,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:gt,disabled:!he.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Re.map(P=>{let K=s.find(ce=>ce.id===P.userId);if(P.type.includes("COMMENT")){let ce=n.find(Se=>Se.id===P.metadata?.commentId);return ce?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.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:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ce.content})]})]},P.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.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:K?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)}),Re.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function ry({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 Vl({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((i,c)=>i+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ry,{})}),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,i)=>n+i.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,i)=>n+i.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,i)=>n+(i.planned||0),0)})]})]})]})}function py({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 Gl({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,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(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(py,{})}),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:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children: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:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var wy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},xp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ky({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vp({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 _l({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||wy[c.name]||xp[e.indexOf(c)%xp.length]})),i=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?ky:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var Xs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=react.useState(false),[c,l]=react.useState(false),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(b,{priority:x}),i(false);},v=x=>{r.onBulkMove?.(b,x),l(false),a();},f=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},y=x=>{let C=new Set;e.forEach(D=>{D.labels?.forEach(T=>C.add(T));});let k=Array.from(new Set([...C,...x]));r.onBulkUpdate?.(b,{labels:k}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!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(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.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(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});Xs.displayName="BulkOperationsToolbar";function Sy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let b=a?.find(h=>h.id===g);n=`assignee-${g}`,i=b?.name||`User ${g}`,c=b?.color,l=b?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),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];i=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function jl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),i=react.useMemo(()=>Sy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(l=>{n(p=>{let d=new Set(p);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsxRuntime.jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let p=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(po,{board:m,callbacks:r,availableUsers:a})})]},l.id)}),i.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 Kl=[{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 Yl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),i=Kl.find(l=>l.value===e)||Kl[0];react.useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:i.icon}),jsxRuntime.jsx("span",{children:i.label}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Kl.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var Yn=[{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 My(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Np(e={}){let{shortcuts:t=Yn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),i=react.useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return react.useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(My(l,d)){r&&l.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Ay(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ly(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 Iy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ly(e),r=t?Ay(t):"";return a?`${a} + ${r}`:r}function By(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 ql({shortcuts:e=Yn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=By(e);return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(l=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Iy(l)})]},l.action))})]},i))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Xl=[{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=b=>{b.stopPropagation();let h=r<a.length-1?r+1:0;l(),o(h);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Hh(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function zh(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Hl(e){return e.startsWith("image/")}function Vr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=react.useState(false),[c,l]=react.useState(false),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let b=react.useCallback((C,I)=>{I.preventDefault(),I.stopPropagation();let $=g.current.filter(O=>Hl(O.type)),P=$.findIndex(O=>O.id===C.id),te=O=>{let H=g.current.filter(J=>Hl(J.type)),F=H[O];F&&up(F.url,F.name,H,O,te);};up(C.url,C.name,$,P,te);},[]),h=react.useCallback(C=>{let I=[],$=[];return e.length+C.length>s?($.push(`Maximum ${s} files allowed`),{valid:I,errors:$}):(C.forEach(P=>{if(P.size/1048576>r){$.push(`${P.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>P.type.match(O))){$.push(`${P.name} has invalid file type`);return}I.push(P);}),{valid:I,errors:$})},[e.length,s,r,o]),v=react.useCallback(async C=>{let{valid:I,errors:$}=h(C);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){l(true),d(null);try{await t?.(I);}catch(P){d(P instanceof Error?P.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[h,t]),f=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),i(true);},[]),y=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),i(false);},[]),w=react.useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),x=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),i(false);let I=Array.from(C.dataTransfer.files);v(I);},[v]),N=react.useCallback(C=>{let I=C.target.files?Array.from(C.target.files):[];v(I),m.current&&(m.current.value="");},[v]),k=react.useCallback(()=>{m.current?.click();},[]),S=react.useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:w,onDrop:x,onClick:k,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(C=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Hl(C.type)&&C.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>b(C,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:C.thumbnailUrl||C.url,alt:C.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:zh(C.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Hh(C.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>S(C.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},C.id))})]})}function zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:h,onEstimateEffort:v,currentUserId:f="user-1"}){let[y,w]=react.useState("details"),[x,N]=react.useState(false),[k,S]=react.useState({}),[C,I]=react.useState(""),[$,P]=react.useState(false),[te,O]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{N(false),S({}),w("details"),I(""),O({}),a();},[a]),F=react.useCallback(()=>{r&&Object.keys(k).length>0&&(r(e.id,k),S({}),N(false));},[e.id,k,r]),J=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ee=react.useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),I(""));},[e.id,C,p]),Re=react.useCallback(async()=>{if(b){P(true);try{let U=await b(e);O(oe=>({...oe,assignees:U}));}catch(U){console.error("Failed to suggest assignee:",U);}finally{P(false);}}},[e,b]),B=react.useCallback(async()=>{if(h){P(true);try{let U=await h(e);O(oe=>({...oe,subtasks:U}));}catch(U){console.error("Failed to generate subtasks:",U);}finally{P(false);}}},[e,h]),Y=react.useCallback(async()=>{if(v){P(true);try{let U=await v(e);O(oe=>({...oe,effort:U}));}catch(U){console.error("Failed to estimate effort:",U);}finally{P(false);}}},[e,v]),ye={...e,...k},Ge=s.filter(U=>ye.assignedUserIds?.includes(U.id));return jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:U=>U.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:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:k.title??ye.title,onChange:U=>S({...k,title:U.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ye.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),S({});},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:J,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:H,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:()=>w("details"),className:`card-detail-tab ${y==="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:()=>w("comments"),className:`card-detail-tab ${y==="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:()=>w("activity"),className:`card-detail-tab ${y==="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",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${y==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${y==="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:[y==="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"}),x?jsxRuntime.jsx("textarea",{value:k.description??ye.description??"",onChange:U=>S({...k,description:U.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ye.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:k.assignedUserIds??ye.assignedUserIds??[],onChange:U=>{let oe=Array.from(U.target.selectedOptions,Z=>Z.value);S({...k,assignedUserIds:oe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(U=>jsxRuntime.jsx("option",{value:U.id,children:U.name},U.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ge.length>0?Ge.map(U=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsx("span",{children:U.name})]},U.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"}),x?jsxRuntime.jsxs("select",{value:k.priority??ye.priority??"",onChange:U=>S({...k,priority:U.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:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ye.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:ye.labels&&ye.labels.length>0?ye.labels.map(U=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:U},U)):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"}),x?jsxRuntime.jsx("input",{type:"date",value:k.startDate?new Date(k.startDate).toISOString().split("T")[0]:ye.startDate?new Date(ye.startDate).toISOString().split("T")[0]:"",onChange:U=>S({...k,startDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.startDate?new Date(ye.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:k.endDate?new Date(k.endDate).toISOString().split("T")[0]:ye.endDate?new Date(ye.endDate).toISOString().split("T")[0]:"",onChange:U=>S({...k,endDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:k.estimatedTime??ye.estimatedTime??"",onChange:U=>S({...k,estimatedTime:U.target.value?parseFloat(U.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:ye.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:ye.dependencies&&ye.dependencies.length>0?ye.dependencies.map(U=>{let oe=typeof U=="string"?U:U.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",oe.slice(-4)]},oe)}):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:ye.createdAt?new Date(ye.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:U=>I(U.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ee,disabled:!C.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(U=>{let oe=s.find(Z=>Z.id===U.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:[oe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:oe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(U.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(U.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:U.content})]},U.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"})]})})]}),y==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:i.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:i.map(U=>{let oe=s.find(Z=>Z.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("COMMENT")&&"\u{1F4AC}",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",U.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:oe?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.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"})]})}),y==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Vr,{cardId:e.id,attachments:l,onUpload:m?U=>m(e.id,U):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),y==="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:Re,disabled:$||!b,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:$||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Y,disabled:$||!v,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"]})]}),te.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),te.assignees.map((U,oe)=>{let Z=s.find(Se=>Se.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Z?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:U.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(U.confidence*100).toFixed(0),"%"]})]})]},oe)})]}),te.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),te.subtasks.map((U,oe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:U.title}),U.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:U.description}),U.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",U.estimatedTime,"h"]})]},oe))]}),te.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:[te.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(te.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(U=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${U.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:U.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:U.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:U.description}),U.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",U.suggestedAction]})]},U.id))]}),!te.assignees&&!te.subtasks&&!te.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Yn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,b=4,h=d.left;h+o>g-10&&(h=g-o-10),h<10&&(h=10);let v=m-d.bottom,f=d.top,y;return v>=s+b?y=d.bottom+b:f>=s+b?y=d.top-s-b:v>=f?y=d.bottom+b:y=Math.max(10,d.top-s-b),{top:y,left:h}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;l.current&&!l.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.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 dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#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 Yh=["LOW","MEDIUM","HIGH","URGENT"],qh=["todo","in-progress","review","done"];function Vl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:b=[],availableLabels:h=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:y,unsplashAccessKey:w,theme:x,onSubtasksChange:N,attachments:k=[],onUploadAttachments:S,onDeleteAttachment:C}){let I=tn(),$=x||I?.themeName||"dark",[P,te]=react.useState(e),[O,H]=react.useState(false),[F,J]=react.useState(()=>[...e?.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0))),[ee,Re]=react.useState(false),[B,Y]=react.useState(""),[ye,Ge]=react.useState(""),[U,oe]=react.useState("all"),[Z,Se]=react.useState(false),[ke,Ie]=react.useState(false),[He,et]=react.useState(false),[ae,Xe]=react.useState(false),[pe,at]=react.useState(false),[mt,Pt]=react.useState(false),Ce=react.useRef(null),yt=react.useRef(null),nt=react.useRef(null),Je=react.useRef(null),z=react.useRef(null),ne=react.useRef(null),D=react.useRef(null),q=react.useRef(null),ce=react.useRef(null),Te=react.useRef(null),W=react.useRef(null),re=react.useRef(null);react.useEffect(()=>{if(e&&!P){te({...e});let A=[...e.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0));J(A);}else if(e&&P&&e.id!==P.id){te({...e});let A=[...e.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0));J(A);}},[e,P]),react.useEffect(()=>{let A=K=>{let X=K.target;Je.current&&!Je.current.contains(X)&&Se(false),z.current&&!z.current.contains(X)&&Ie(false),ne.current&&!ne.current.contains(X)&&et(false),D.current&&!D.current.contains(X)&&Xe(false);};if(Z||ke||He||ae)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[Z,ke,He,ae]),react.useEffect(()=>{if(!t)return;let A=K=>{let X=K.target,me=X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.isContentEditable;if(K.key==="Escape"){K.preventDefault(),Z||ke||He||ae||pe||mt?(Se(false),Ie(false),et(false),Xe(false),at(false),Pt(false)):me||a();return}if(me&&K.key!=="Escape")return;let Ee=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Se(true);break;case "a":K.preventDefault(),et(true);break;case "p":K.preventDefault(),Ie(true);break;case "l":K.preventDefault(),Xe(true);break;case "d":Ee||(K.preventDefault(),at(true),setTimeout(()=>q.current?.focus(),0));break;case "e":Ee||(K.preventDefault(),Pt(true));break;case "i":K.preventDefault(),H(true),setTimeout(()=>yt.current?.focus(),0);break;case "t":K.preventDefault(),Re(true);break;case "c":K.preventDefault(),nt.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,Z,ke,He,ae,pe,mt]);let Ue=react.useCallback(A=>{let K=A.currentTarget.textContent?.trim()||"";if(P&&K!==P.title){let X={...P,title:K};te(X),r?.(P.id,{title:K});}},[P,r]),Ne=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=P?.title||"",A.currentTarget.blur());},[P]),ze=react.useCallback(()=>{P&&e&&P.description!==e.description&&r?.(P.id,{description:P.description}),H(false);},[P,e,r]),Fe=react.useCallback(A=>{if(P){let K={...P,columnId:A};te(K),r?.(P.id,{columnId:A}),Se(false);}},[P,r]),Ke=react.useCallback(A=>{if(P){let K={...P,priority:A};te(K),r?.(P.id,{priority:A}),Ie(false);}},[P,r]),lt=react.useCallback(A=>{if(P){let K=P.assignedUserIds||[],X=K.includes(A)?K.filter(Ee=>Ee!==A):[...K,A],me={...P,assignedUserIds:X};te(me),r?.(P.id,{assignedUserIds:X});}},[P,r]),ut=react.useCallback(A=>{if(P){let K=P.labels||[],X=K.includes(A)?K.filter(Ee=>Ee!==A):[...K,A],me={...P,labels:X};te(me),r?.(P.id,{labels:X});}},[P,r]),st=react.useCallback(A=>{if(P){let K={...P,tags:A};te(K),r?.(P.id,{tags:A});}},[P,r]),Ze=react.useCallback(A=>{if(P){let K=A.target.value,X={...P,endDate:K};te(X),r?.(P.id,{endDate:K}),at(false);}},[P,r]),zt=react.useCallback(A=>{if(P){let K={...P,estimatedTime:parseFloat(A)||0};te(K),r?.(P.id,{estimatedTime:parseFloat(A)||0});}},[P,r]),Ct=react.useCallback(()=>{if(B.trim()&&P){let A={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:F.length,createdAt:new Date},K=[...F,A];J(K),Y(""),Re(false),N?.(P.id,K);}},[B,F,P,N]),ht=react.useCallback(A=>{let K=F.map(X=>X.id===A?{...X,completed:!X.completed,updatedAt:new Date}:X);J(K),P&&N?.(P.id,K);},[F,P,N]),wt=react.useCallback(A=>{let K=F.filter(X=>X.id!==A);J(K),P&&N?.(P.id,K);},[F,P,N]),rt=react.useCallback(()=>{ye.trim()&&P&&c&&(c(P.id,ye.trim()),Ge(""));},[ye,P,c]),Lt=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),rt());},[rt]),We=A=>jsxRuntime.jsx(_h__default.default,{remarkPlugins:[jh__default.default],rehypePlugins:[Kh__default.default],components:{a:({node:K,...X})=>jsxRuntime.jsx("a",{...X,target:"_blank",rel:"noopener noreferrer"})},children:A}),Be=i.filter(A=>U==="comments"?A.type.includes("COMMENT"):U==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let pt=P||e,ie=s.filter(A=>pt.assignedUserIds?.includes(A.id)),be=F.filter(A=>A.completed).length;return jsxRuntime.jsx(Wt,{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:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:Ne,children:pt.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:Je,children:[jsxRuntime.jsxs("button",{ref:ce,className:"modal-v2-field",onClick:()=>Se(!Z),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:pt.columnId||"No status"})]}),jsxRuntime.jsx(Yn,{triggerRef:ce,isOpen:Z,onClose:()=>Se(false),width:250,estimatedHeight:200,children:(b.length>0?b:qh.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${pt.columnId===A.id?"active":""}`,onClick:()=>Fe(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>et(!He),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ie.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ie.map(A=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Yn,{triggerRef:Te,isOpen:He,onClose:()=>et(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pt.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>lt(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,pt.assignedUserIds?.includes(A.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"})})]},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:z,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ie(!ke),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:pt.priority||"None"})]}),jsxRuntime.jsxs(Yn,{triggerRef:W,isOpen:ke,onClose:()=>Ie(false),width:180,estimatedHeight:220,children:[Yh.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${pt.priority===A?"active":""}`,onClick:()=>Ke(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),children:"None"})]})]}),v.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(uo,{selectedTags:pt.tags||[],availableTags:v,onChange:st,onCreateTag:f,theme:dt[$]||dt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:re,className:"modal-v2-field",onClick:()=>Xe(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.labels&&pt.labels.length>0?jsxRuntime.jsx("span",{children:pt.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Yn,{triggerRef:re,isOpen:ae,onClose:()=>Xe(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pt.labels?.includes(A)?"active":""}`,onClick:()=>ut(A),children:[A,pt.labels?.includes(A)&&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"})})]},A))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{at(!pe),setTimeout(()=>q.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:pt.endDate?new Date(pt.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof pt.endDate=="string"?pt.endDate.split("T")[0]:pt.endDate?(()=>{let A=new Date(pt.endDate),K=A.getUTCFullYear(),X=String(A.getUTCMonth()+1).padStart(2,"0"),me=String(A.getUTCDate()).padStart(2,"0");return `${K}-${X}-${me}`})():"",onChange:Ze,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Pt(!mt),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:pt.estimatedTime?`${pt.estimatedTime}h`:"Not set"})]}),mt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pt.estimatedTime||"",onChange:A=>zt(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Pt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:pt.description||"",onChange:A=>{if(P){let K={...P,description:A.target.value};te(K);}},onBlur:ze,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:pt.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:We(pt.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"}),F.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[be,"/",F.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Re(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:[F.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ht(A.id),children:A.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:A.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>wt(A.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"})]})})]},A.id)),ee&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:A=>Y(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Ct(),A.key==="Escape"&&(Re(false),Y(""));},onBlur:Ct,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(S||k.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"}),k.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:k.length})]}),jsxRuntime.jsx(Vr,{cardId:pt.id,attachments:k,onUpload:S?A=>S(pt.id,A):void 0,onDelete:C,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 ${U==="all"?"active":""}`,onClick:()=>oe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>oe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>oe("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:nt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ye,onChange:A=>Ge(A.target.value),onKeyDown:Lt,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:rt,disabled:!ye.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Be.map(A=>{let K=s.find(me=>me.id===A.userId);if(A.type.includes("COMMENT")){let me=n.find(Ee=>Ee.id===A.metadata?.commentId);return me?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.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:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:me.content})]})]},A.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.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:K?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),Be.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 oy({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 _l({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((i,c)=>i+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(oy,{})}),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,i)=>n+i.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,i)=>n+i.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,i)=>n+(i.planned||0),0)})]})]})]})}function my({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 jl({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,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(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(my,{})}),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:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children: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:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ky={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},vp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Cy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function wp({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 Kl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||ky[c.name]||vp[e.indexOf(c)%vp.length]})),i=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Cy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var Qs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=react.useState(false),[c,l]=react.useState(false),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(b,{priority:x}),i(false);},v=x=>{r.onBulkMove?.(b,x),l(false),a();},f=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},y=x=>{let N=new Set;e.forEach(S=>{S.labels?.forEach(C=>N.add(C));});let k=Array.from(new Set([...N,...x]));r.onBulkUpdate?.(b,{labels:k}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!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(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.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(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});Qs.displayName="BulkOperationsToolbar";function Ey(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let b=a?.find(h=>h.id===g);n=`assignee-${g}`,i=b?.name||`User ${g}`,c=b?.color,l=b?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),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];i=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Yl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),i=react.useMemo(()=>Ey(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(l=>{n(p=>{let d=new Set(p);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsxRuntime.jsx(go,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let p=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(go,{board:m,callbacks:r,availableUsers:a})})]},l.id)}),i.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 ql=[{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 Xl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),i=ql.find(l=>l.value===e)||ql[0];react.useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:i.icon}),jsxRuntime.jsx("span",{children:i.label}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:ql.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var qn=[{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 Py(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Dp(e={}){let{shortcuts:t=qn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),i=react.useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return react.useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(Py(l,d)){r&&l.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Ly(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Iy(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 By(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Iy(e),r=t?Ly(t):"";return a?`${a} + ${r}`:r}function Ry(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 Jl({shortcuts:e=qn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=Ry(e);return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(l=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:By(l)})]},l.action))})]},i))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Ql=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
86
86
  1.
87
87
 
88
88
  **Expected behavior:**
@@ -122,12 +122,12 @@
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Jl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,p)=>{let d=p.category||"Other";return l[d]||(l[d]=[]),l[d].push(p),l},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Zl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=react.useState("export"),[c,l]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let h=o?.current||void 0,v=await Xc(e,c,h);Jc(v,c);},b=async h=>{let v=h.target.files?.[0];if(v){try{let f=await eu(v),y=v.name.endsWith(".json")?"json":"csv",w=Zc(f,y);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(h=>jsxRuntime.jsxs("button",{onClick:()=>l(h),className:u("p-4 rounded-lg border-2 transition-all text-center",c===h?"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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),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:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((h,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},v))})]})]})]})]})]})}var zy=["URGENT","HIGH","MEDIUM","LOW"],Uy=[{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"}],Wy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ed({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:b}){let[h,v]=react.useState(true),f=react.useCallback(k=>{a({search:k.target.value});},[a]),y=react.useCallback(k=>{a({dateFilter:k.target.value});},[a]),w=react.useCallback(k=>{r({by:k.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${h?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:k=>{k.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:h?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!h&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:k=>{let D=k.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),zy.map(k=>jsxRuntime.jsx("option",{value:k,children:k},k))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:k=>{let D=k.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(k=>jsxRuntime.jsx("option",{value:k.id,children:k.name},k.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:k=>{let D=k.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(k=>jsxRuntime.jsx("option",{value:k,children:k},k))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Uy.map(k=>jsxRuntime.jsx("option",{value:k.value,children:k.label},k.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:k=>b(k.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Wy.map(k=>jsxRuntime.jsx("option",{value:k.value,children:k.label},k.value))})}),C&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function td({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&p(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":l,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),l&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[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 i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ad={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"}},rd={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"}},od={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"}},Oo={dark:ad,light:rd,neutral:od},Qs="dark";var Zs=react.createContext(void 0),Qy="asakaa-theme";function Ep({children:e,defaultTheme:t=Qs,storageKey:a=Qy}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=react.useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Oo[r];Object.entries(c.colors).forEach(([p,d])=>{d&&i.style.setProperty(`--theme-${Zy(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let m=c.colors[p];m&&i.style.setProperty(d,m);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Oo};return jsxRuntime.jsx(Zs.Provider,{value:n,children:e})}function un(){let e=react.useContext(Zs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Zy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function nd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=un();return e?jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Oo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Fp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var ei={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"}},Mp={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"}},sd={en:ei,es:Mp};function Pp(e){return sd[e]||sd.en}function id(e,t){let a=Pp(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 mn=react.createContext(ei);function Er(){return react.useContext(mn)}function ri(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(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Lp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=react.useState(false),[c,l]=react.useState(null),[p,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),b=Er(),h=ri(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=b.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let C=k=>{let D=k.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);let y=[{id:"png",label:b.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:b.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:b.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:b.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(C=>C.handler),w=async(C,k)=>{if(k){l(C);try{await k();}catch(D){console.error(`Export ${C} failed:`,D);}finally{l(null),i(false);}}},x=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>i(!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:b.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:h.top,left:h.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((C,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===C.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:p?b.toolbar.copied:b.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Nx({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 Dx({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 Ip({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),i=react.useRef(null),c=Er(),l=ri(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let b=g.target;n.current&&!n.current.contains(b)&&i.current&&!i.current.contains(b)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((m,g)=>{let b=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:b?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:b?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:b?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:b?600:500},children:m.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Bp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),i=react.useRef(null),c=react.useRef(null),l=Er(),p=ri(i,s,"left");react.useEffect(()=>{if(!s)return;let b=setTimeout(()=>{let h=f=>{let y=f.target;i.current&&!i.current.contains(y)&&c.current&&!c.current.contains(y)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(b),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.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:l.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],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:i,onClick:b=>{b.stopPropagation(),n(h=>!h);},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:l.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(b=>{let h=t===b.value&&!r,v=()=>b.value==="all"?h?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"}):b.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(b.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:h?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:`${h?b.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:b.label}),h&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},b.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:l.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 Sx({value:e,onChange:t,theme:a}){let r=Er(),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 i=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:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?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 Ex({theme:e,forecast:t}){let a=Er(),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,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",b=t?.budgetVariancePercent,h=b!=null&&b!==0,v=b!=null?b>0?`+${b.toFixed(0)}% ${a.toolbar.budgetOver}`:`${b.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<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&&i&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),h&&v&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function Fx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=react.useState(false),b=react.useRef(null),h=react.useRef(null),v=Er(),f=ri(b,m,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let k=D=>{let T=D.target;b.current&&!b.current.contains(T)&&h.current&&!h.current.contains(T)&&g(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]);let w=v.toolbar.visibility==="Visibilidad",x=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:i,onChange:c}],C=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:b,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:v.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:h,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:x.map((k,D)=>{let T=k.icon,I=k.disabled,$=k.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!I&&k.onChange?.(!k.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:I?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:I?"not-allowed":"pointer"},whileHover:I?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},title:$,children:[jsxRuntime.jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:I?y?"rgba(255,255,255,0.2)":"#D1D5DB":k.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label}),k.active&&!I&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((k,D)=>{let T=l===k.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(k.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+D)*.03},children:[jsxRuntime.jsx("span",{style:{color:T?e.accent||"#2E94FF":y?"rgba(255,255,255,0.85)":e.textPrimary},children:k.label}),T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.value)})]})]})}),document.body)]})}function oi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:h=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:y,onWbsLevelChange:w,maxWbsDepth:x=4,viewMode:C="execution",onViewModeChange:k,projectForecast:D,onExportPNG:T,onExportPDF:I,onExportExcel:$,onExportCSV:A,onExportJSON:_,onExportMSProject:E,showCriticalPath:me=true,onShowCriticalPathChange:L,showDependencies:X=true,onShowDependenciesChange:Z,highlightWeekends:He=true,onHighlightWeekendsChange:O,showBaseline:j=false,onShowBaselineChange:he,onCopySnapshotLink:je,hasDependencies:U=true}){let re=Er(),ee=T||I||$||A||_||E,Ee=!!e.glassToolbar,[we,Be]=react.useState(false),ze=react.useRef(null);react.useEffect(()=>{we&&ze.current&&ze.current.focus();},[we]);let Qe=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],te=[{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"})}],tt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ee){let pe=tt?"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:tt?"#1A1A1A":e.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Be(!we),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),we&&jsxRuntime.jsx("input",{ref:ze,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:()=>Be(false),onKeyDown:at=>{at.key==="Escape"&&Be(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),k&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:tt?"#000000":e.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>k("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?tt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>k("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?tt?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:C==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Sx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),w&&jsxRuntime.jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsxRuntime.jsx(Fx,{theme:e,showCriticalPath:me,onShowCriticalPathChange:L,showBaseline:j,onShowBaselineChange:he,highlightWeekends:He,onHighlightWeekendsChange:O,showDependencies:X,onShowDependenciesChange:Z,rowDensity:i,onRowDensityChange:c,hasDependencies:U}),jsxRuntime.jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:je}),p&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${tt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${tt?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]})]})]}),D&&jsxRuntime.jsx(Ex,{theme:e,forecast:D})]})}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(Dx,{options:Qe,value:t,onChange:pe=>a(pe),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]}),(ee||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:je}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsxRuntime.jsx(Nx,{options:te,value:s,onChange:pe=>n(pe),theme:e})]})]})}function ni({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),i=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let l=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ht,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function bn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[i,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,b=window.innerHeight,h=t,v=a;t+p+m>g&&(h=t-p,h<m&&(h=m)),a+d+m>b&&(v=b-d-m,v<m&&(v=m)),c({x:h,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var qt={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 Vp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),b=react.useCallback(w=>{g.current=w;},[]),h=react.useCallback(w=>{let x=[],C=k=>{for(let D of k)x.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&C(D.subtasks);};return C(w),x},[]),v=react.useCallback(()=>{let w=h(e);for(let x of w)if(t.has(x.id))return x;return null},[e,t,h]),f=react.useCallback((w,x)=>{let C=h(e);if(C.length===0)return;let k=v();if(!k){a(C[0].id,false);return}let D=C.findIndex($=>$.id===k.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=C.length)return;let I=C[T];a(I.id,x);},[e,v,h,a]),y=react.useCallback(w=>{if(!m)return;let x=w.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||g.current){w.key==="Escape"&&(x.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),I=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(I&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!I.isExpanded||w.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),i(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){I&&(w.preventDefault(),r(I.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){I&&(w.preventDefault(),r(I.id,"above"));return}if(w.key==="Enter"&&D){I&&(w.preventDefault(),d(I.id));return}if(w.key==="F2"){I&&(w.preventDefault(),l(I.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,i,c,l,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[m,y]),{setIsEditing:b}}function _p(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),b=m.indexOf(d);if(g===-1||b===-1){o(d);return}let h=Math.min(g,b),v=Math.max(g,b),f=m.slice(h,v+1);t(new Set(f)),r(d);},[a,o]),i=react.useCallback((d,m,g,b)=>{b?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:p}}function cd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?cd(t.subtasks):t.subtasks}))}function hn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function si(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=si(a.subtasks,t);if(r)return r}}return null}function dd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=dd(a.subtasks,t);if(r)return r}return null}function ud(e,t){if(t.length===0)return e;let a=hn(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 b=[];return {tasks:m.filter(v=>{if(g.has(v.id))return b.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,b.push(...f.removed);}return true}),removed:b}},i=(m,g,b)=>m.map(h=>h.id===g?{...h,subtasks:[...h.subtasks||[],...b],isExpanded:true}:h.subtasks?{...h,subtasks:i(h.subtasks,g,b)}:h),c=new Set(t),{tasks:l,removed:p}=n(e,c),d=i(l,s.id,p);return cd(d)}function pd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=dd(a,r);if(!o)continue;let s=dd(a,o.id),n=(l,p,d)=>{for(let m=0;m<l.length;m++){let g=l[m];if(g.id===p&&g.subtasks){let b=g.subtasks.findIndex(h=>h.id===d);if(b!==-1){let[h]=g.subtasks.splice(b,1);return h}}if(g.subtasks){let b=n(g.subtasks,p,d);if(b)return b}}return null},i=(l,p,d)=>{let m=l.findIndex(g=>g.id===p);if(m!==-1)return l.splice(m+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,p,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return cd(a)}function md(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=n.length?false:([n[l],n[p]]=[n[p],n[l]],n[l]={...n[l],position:l},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function gd(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 Xn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let b=n(g.subtasks);if(b)return b}return null}let p=c[l],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(l+1,0,m),m},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function jp(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"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,n),true};return i(r),{tasks:r,newTask:n}}function fd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:fd(r.subtasks,t,a)}:r)}function bd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:bd(a.subtasks,t)}:a)}function hd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let b=a(g.subtasks);if(b)return b}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let b=c(g.subtasks);if(b>=0)return b}}return 0},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=m=>m.map(g=>{if(g.id===t){let b=g.subtasks||[];return {...g,subtasks:[...b,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function Kp(e,t,a,r){if(t===a)return e;let o=si(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,d)=>{let m=l?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((b,h)=>({...b,position:h}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),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((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function li({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:y,onTaskCreate:w,onTaskRename:x,onCreateSubtask:C,onOpenTaskModal:k,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:I,showCriticalPath:$=false}){let A=react.useContext(mn),[_,E]=react.useState(null),[me,L]=react.useState(null),[X,Z]=react.useState(""),He=react.useRef(null),[O,j]=react.useState(null),[he,je]=react.useState(0),[U,re]=react.useState(0),[ee,Ee]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[we,Be]=react.useState(null),[ze,Qe]=react.useState(null),[te,tt]=react.useState(null),pe=react.useRef(0),at=5,pt=react.useRef(false),[Et,Ce]=react.useState(null),[rt,it]=react.useState(false),Ze=react.useRef(null),[H,de]=react.useState(null),[N,Y]=react.useState(false),ie=react.useRef(null);react.useEffect(()=>{function le(fe){ie.current&&!ie.current.contains(fe.target)&&Y(false);}if(N)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[N]),react.useEffect(()=>{me&&He.current&&(He.current.focus(),He.current.select());},[me]),react.useEffect(()=>{if(!O)return;let le=P=>{let K=P.clientX-he,q=U+K;m?.(O,q);},fe=()=>{j(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[O,he,U,m]);let{selectedTaskIds:ke,handleTaskClick:V,isTaskSelected:ae}=_p(),{setIsEditing:Ve}=Vp({tasks:e,selectedTaskIds:ke,onTaskSelect:(le,fe)=>{let K=hn(e).map(q=>q.id);V(le,K,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:le=>{let fe=hn(e).find(P=>P.id===le);fe&&lt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:le=>{let fe=hn(e).find(P=>P.id===le);fe&&k&&k(fe);},enableKeyboard:true}),De=(le,fe=0,P="")=>{let K=[],q=[...le].sort((ce,Se)=>(ce.position??0)-(Se.position??0));for(let ce=0;ce<q.length;ce++){let Se=q[ce],Xe=ce+1,_e=P?`${P}.${Xe}`:`${Xe}.0`;if(Se.wbsCode=_e,K.push({task:Se,level:fe}),Se.subtasks&&Se.subtasks.length>0&&Se.isExpanded){let Ie=P?`${P}.${Xe}`:`${Xe}`;K.push(...De(Se.subtasks,fe+1,Ie));}}return K},Ue=De(e),Ne=48,Ke=Math.max(Ue.length*a,600-Ne),bt=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,lt=le=>{L(le.id),Z(le.name),Ve(true);},nt=le=>{X.trim()&&X!==e.find(fe=>fe.id===le)?.name&&x?.(le,X.trim()),L(null),Z(""),Ve(false);},et=()=>{L(null),Z(""),Ve(false);},At=(le,fe)=>{fe.stopPropagation(),C?.(le.id);},Mt=(le,fe)=>{fe.preventDefault(),pe.current=fe.clientY,Be(le),pt.current=false,it(false),Ce({x:fe.clientX,y:fe.clientY});},mt=le=>{if(!we||(Math.abs(le.clientY-pe.current)>at&&!pt.current&&(pt.current=true,it(true)),Ce({x:le.clientX,y:le.clientY}),!pt.current))return;if(I?.current){let ce=I.current,Se=ce.getBoundingClientRect(),Xe=60,_e=12;Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=null);let Ie=le.clientY-Se.top,M=Se.bottom-le.clientY;if(Ie<Xe&&ce.scrollTop>0){let J=Math.round(_e*(1-Ie/Xe)),ye=()=>{ce.scrollTop-=J,pt.current&&ce.scrollTop>0&&(Ze.current=requestAnimationFrame(ye));};Ze.current=requestAnimationFrame(ye);}else if(M<Xe&&ce.scrollTop<ce.scrollHeight-ce.clientHeight){let J=Math.round(_e*(1-M/Xe)),ye=()=>{ce.scrollTop+=J,pt.current&&ce.scrollTop<ce.scrollHeight-ce.clientHeight&&(Ze.current=requestAnimationFrame(ye));};Ze.current=requestAnimationFrame(ye);}}let P=document.querySelectorAll("[data-task-row]"),K=null,q=null;P.forEach(ce=>{let Se=ce.getBoundingClientRect(),Xe=ce.getAttribute("data-task-row");if(Xe&&Xe!==we&&le.clientY>=Se.top&&le.clientY<=Se.bottom){K=Xe;let _e=le.clientY-Se.top,Ie=Se.height;_e<Ie*.25?q="above":_e>Ie*.75?q="below":q="child";}}),Qe(K),tt(q);},yt=()=>{if(pt.current&&we&&ze&&te){if(te==="child")T?.(we,ze);else if(te==="above"||te==="below"){let le=(q,ce,Se=null)=>{for(let Xe of q){if(Xe.id===ce)return Se;if(Xe.subtasks){let _e=le(Xe.subtasks,ce,Xe.id);if(_e!==void 0)return _e}}},fe=le(e,we,null),P=le(e,ze,null),K=(q,ce,Se,Xe)=>{let _e=q.findIndex(J=>J.id===ce),Ie=Xe?q.findIndex(J=>J.id===Se):-1,M=te==="below"?_e+1:_e;return Xe&&Ie!==-1&&Ie<_e&&(M-=1),Math.max(0,M)};if(P===null){let ce=K(e,ze,we,fe===null);T?.(we,null,ce);}else {let q=Ue.find(ce=>ce.task.id===P)?.task;if(q?.subtasks){let ce=fe===P,Se=K(q.subtasks,ze,we,ce);T?.(we,P,Se);}}}}Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=null),Be(null),Qe(null),tt(null),Ce(null),pt.current=false,it(false);};react.useEffect(()=>{if(we)return document.addEventListener("mousemove",mt),document.addEventListener("mouseup",yt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",mt),document.removeEventListener("mouseup",yt),document.body.style.cursor="",document.body.style.userSelect="";}},[we,ze,te]);let gt=(le,fe,P)=>{let K=fe.subtasks&&fe.subtasks.length>0;switch(le.id){case "name":let q=me===fe.id,ce=_===fe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${P*20}px`},children:[T&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ce?1:.3},onMouseDown:B=>Mt(fe.id,B),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),q?jsxRuntime.jsx("input",{ref:He,type:"text",value:X,onChange:B=>Z(B.target.value),onKeyDown:B=>{B.key==="Enter"?nt(fe.id):B.key==="Escape"&&et();},onBlur:()=>nt(fe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:B=>B.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),$&&fe.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&fe.cpmData&&jsxRuntime.jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ce&&!q&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:B=>At(fe,B),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:B=>{B.stopPropagation(),lt(fe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Xe=le.id==="startDate"?"startDate":"endDate",_e=fe[Xe],Ie=H?.taskId===fe.id&&H?.field===Xe,M=B=>B?(typeof B=="string"?new Date(B):B).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:B=>B.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:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:B=>{if(!K)if(Ie)de(null);else {let z=B.currentTarget.getBoundingClientRect();de({taskId:fe.id,field:Xe,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:z.bottom+4,left:z.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:M(_e)}),K&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Ie&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>de(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:H?.position.top,left:H?.position.left},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let B=new Date,z=new Date(B);z.setDate(B.getDate()+1);let ne=new Date(B);ne.setDate(B.getDate()+7);let S=new Date(B);return S.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:z},{label:"Pr\xF3xima semana",date:ne},{label:"2 semanas",date:S}].map((Te,We)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Tt=>Tt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Tt=>Tt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:Te.date}),de(null);},children:Te.label},We))})(),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:B=>B.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:void 0}),de(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:()=>de(B=>B?{...B,month:new Date(B.month.getFullYear(),B.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>de(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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((B,z)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:B},z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let B=H?.month||new Date,z=B.getFullYear(),ne=B.getMonth(),S=new Date(z,ne,1).getDay(),oe=new Date(z,ne+1,0).getDate(),Te=new Date,We=[];for(let Nt=S-1;Nt>=0;Nt--)We.push({day:new Date(z,ne,-Nt).getDate(),date:new Date(z,ne-1,new Date(z,ne,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=oe;Nt++)We.push({day:Nt,date:new Date(z,ne,Nt),isCurrentMonth:true});let Tt=42-We.length;for(let Nt=1;Nt<=Tt;Nt++)We.push({day:Nt,date:new Date(z,ne+1,Nt),isCurrentMonth:false});return We.map((Nt,la)=>{let aa=Nt.date.toDateString()===Te.toDateString(),Ut=(_e?typeof _e=="string"?new Date(_e):_e: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?Ut?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ut?"#2E94FF":"transparent",boxShadow:aa&&!Ut?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Xe]:Nt.date}),de(null);},children:Nt.day},la)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:bt(fe)})});case "assignees":if(K)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 J=r.filter(B=>fe.assignees?.some(z=>z.name===B.name||z.initials===B.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx(Po,{assignedUsers:J,availableUsers:r,onChange:B=>{let z=B.map(ne=>({id:ne.id,name:ne.name,initials:ne.initials,color:ne.color}));g?.(fe.id,{assignees:z.length>0?z:void 0});}})});case "status":if(K){let B=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:B})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx(xu,{status:fe.status||"todo",onChange:B=>{g?.(fe.id,{status:B,progress:B==="completed"?100:fe.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[fe.progress,"%"]})]});case "priority":let ye={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Le={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Oe=ye[fe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx(Fo,{priority:Oe,onChange:B=>{B&&g?.(fe.id,{priority:Le[B]||"medium"});}})});default:return null}},Pt=le=>[{id:"hide",label:"Hide Column",icon:qt.Hide,onClick:()=>d(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:qt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:qt.SortDesc,onClick:()=>{}}],Ge=le=>le.subtasks&&le.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{C?.(le.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{y?.([le.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{D?D(le.id,le.name):f?.([le.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:qt.Pencil,onClick:()=>{n?.(le);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{C?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:qt.MarkIncomplete,onClick:()=>{g?.(le.id,{status:"todo",progress:0});},disabled:le.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:qt.SetInProgress,onClick:()=>{g?.(le.id,{status:"in-progress"});},disabled:le.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:qt.MarkComplete,onClick:()=>{g?.(le.id,{status:"completed",progress:100});},disabled:le.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{y?.([le.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:qt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{D?D(le.id,le.name):f?.([le.id]);}}],Re=p.filter(le=>le.visible),ut=Re.reduce((le,fe)=>le+fe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ut},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ne}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Re.map((le,fe)=>{let P=fe===Re.length-1,K=le.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(K?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:P?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ee({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:le.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:le.label,children:le.label}),le.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:O===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),j(le.id),je(q.clientX),re(le.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},le.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(ni,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Y(!N),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"})}),N&&jsxRuntime.jsxs("div",{ref:ie,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:le=>le.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>Y(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:Ke},children:Ue.map(({task:le,level:fe},P)=>{let K=ae(le.id),q=ze===le.id,ce=q&&te==="above",Se=q&&te==="below",Xe=q&&te==="child",_e={};return Xe&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${we===le.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Xe?`${t.accent}15`:P%2===0?t.bgPrimary:t.bgGrid,opacity:$?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>E(le.id),onMouseLeave:()=>E(null),onClick:Ie=>{let J=hn(e).map(Oe=>Oe.id),Le=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;V(le.id,J,Le,Ie.shiftKey),s?.(le);},onDoubleClick:Ie=>{Ie.stopPropagation(),n?.(le);},onContextMenu:Ie=>{Ie.preventDefault(),Ee({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:le}),i?.(le,Ie);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[ce&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((Ie,M)=>{let J=M===Re.length-1,ye=Ie.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${ye?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.minWidth??(ye?200:60)}px`,maxWidth:`${Ie.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:J?"none":`1px solid ${_===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:gt(Ie,le,ye?fe:0)},`${le.id}-${Ie.id}`)})]},le.id)})}),jsxRuntime.jsx(bn,{isOpen:ee.isOpen,x:ee.x,y:ee.y,items:ee.type==="header"&&ee.columnId?Pt(ee.columnId):ee.type==="task"&&ee.task?Ge(ee.task):[],onClose:()=>Ee({...ee,isOpen:false}),theme:t}),rt&&Et&&we&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Et.x+12,top:Et.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=Ue.find(fe=>fe.task.id===we)?.task;return le?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:le.name})}):null})()}),document.body)]})}function Qp(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,i]=react.useState(e),[c,l]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(0),[x,C]=react.useState(0),[k,D]=react.useState(null),[T,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:b,setActiveZone:h,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:y,setDraggedSegmentStartX:w,segmentDragOffsetX:x,setSegmentDragOffsetX:C,hoveredSegmentIndex:k,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(me,L)=>{r("none"),d(null),g(null),i(me),l(L),C(0),f(null),w(0);}}}function ui({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:b,onHoverChange:h,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:y=true,readOnly:w=false}){let x=Qp(t,r),C=react.useRef(null),k=react.useRef(false),D=react.useRef(null),T=react.useRef(null),{dragMode:I,setDragMode:$,dragOffset:A,setDragOffset:_,ghostX:E,setGhostX:me,ghostWidth:L,setGhostWidth:X,connectionLine:Z,setConnectionLine:He,hoveredTaskId:O,setHoveredTaskId:j,activeZone:he,setActiveZone:je,draggedSegmentIndex:U,setDraggedSegmentIndex:re,draggedSegmentStartX:ee,setDraggedSegmentStartX:Ee,segmentDragOffsetX:we,setSegmentDragOffsetX:Be,hoveredSegmentIndex:ze,setHoveredSegmentIndex:Qe,isHovered:te,setIsHovered:tt,isDragging:pe,isResizing:at,isConnecting:pt,resetDragState:Et}=x,Ce=18,rt=!!o.executionBarBg,it=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ze=rt?3:6,H=e.subtasks&&e.subtasks.length>0,de=e.endDate&&(()=>{let P=new Date;P.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<P})()&&e.progress<100,N=y&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,ke={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ae=y&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&ke[e.priority]?ke[e.priority]:o.taskBarPrimary,Ve=w?"default":pe?pt?"crosshair":at?"ew-resize":"grabbing":"grab",De=w?"default":"ew-resize",Ne=(P=>P>=80?20:P>=60?15:P>=50?12:10)(r),Ke=r<50,bt=r<40;react.useEffect(()=>{h&&(!te||pe||e.segments)&&h(null);},[te,pe,e.segments,h]);let lt=P=>P.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let P=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${P} day${P!==1?"s":""}`},et=P=>Math.round(P/s)*s,At=P=>{let K=Math.round(P/s),q=new Date(n);return q.setDate(q.getDate()+K),q},Mt=(P,K)=>{for(let q of g){if(q.id===e.id)continue;let ce=5;if(P>=q.x-ce&&P<=q.x+q.width+ce&&K>=q.y-ce&&K<=q.y+q.height+ce)return q.id}return null},mt=react.useCallback((P,K,q)=>{if(w)return;P.preventDefault(),P.stopPropagation();let ce=C.current?.ownerSVGElement;if(!ce)return;let Se=ce.createSVGPoint();Se.x=P.clientX,Se.y=P.clientY;let Xe=Se.matrixTransform(ce.getScreenCTM()?.inverse()),_e=q!==void 0?q:t,Ie=K;if(!Ie){let M=Xe.x-_e;P.shiftKey?(Ie="connect",He({x:t+r,y:a+Ce/2})):P.ctrlKey||P.metaKey?Ie="move":P.altKey?Ie=M<r/2?"resize-start":"resize-end":bt?M<r/2?Ie="move":Ie="resize-end":Ke?M<=Ne/2?Ie="resize-start":M>=r-Ne/2?Ie="resize-end":Ie="move":M<=Ne?Ie="resize-start":M>=r-Ne?Ie="resize-end":Ie="move";}k.current=false,$(Ie),tt(false),je(null),Ie==="move"?_(Xe.x-_e):Ie==="connect"?He({x:t+r,y:a+Ce/2}):_(0),me(_e),X(r);},[t,r,a,Ce,w]),yt=react.useCallback(P=>{let K=C.current?.ownerSVGElement;if(!K)return;let q=K.closest(".gantt-timeline-scroll");if(!q)return;let ce=q.getBoundingClientRect(),Se=60,Xe=15,_e=0;if(P.clientX<ce.left+Se){let Ie=ce.left+Se-P.clientX;_e=-Math.min(Xe,Ie/2);}else if(P.clientX>ce.right-Se){let Ie=P.clientX-(ce.right-Se);_e=Math.min(Xe,Ie/2);}return _e!==0&&(q.scrollLeft+=_e),_e!==0},[]),gt=react.useCallback(P=>{if(I==="none")return;k.current=true,T.current=P;let K=C.current?.ownerSVGElement;if(!K)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let Se=yt(P);Se&&!D.current?D.current=window.setInterval(()=>{T.current&&(yt(T.current),gt(T.current));},16):!Se&&D.current&&(window.clearInterval(D.current),D.current=null);}let q=K.createSVGPoint();q.x=P.clientX,q.y=P.clientY;let ce=q.matrixTransform(K.getScreenCTM()?.inverse());if(I==="connect"){He({x:ce.x,y:ce.y});let Se=Mt(ce.x,ce.y);j(Se);}else if(I==="move"){let Se=ce.x-A,Xe=et(Se);me(Xe),X(r);let _e=Math.round((Xe-t)/s);if(b?.(e.id,_e,true),e.segments&&e.segments.length>0&&U!==null){let Ie=Xe-ee;Be(Ie);}}else if(I==="resize-start"){let Se=ce.x,Xe=et(Se),_e=t+r-Xe;_e>=s&&(me(Xe),X(_e));}else if(I==="resize-end"){let Se=ce.x,_e=et(Se)-t;_e>=s&&X(_e);}},[I,t,r,s,A,e,et,U,ee,Mt,j,He,me,X,Be,b,yt]),Pt=react.useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,I!=="none"){if(I==="connect")O&&m&&m(e,O),He(null),j(null);else {let P=e.endDate.getTime()-e.startDate.getTime(),K,q,ce=true;if(I==="move"){if(K=At(E),q=new Date(K.getTime()+P),e.segments&&e.segments.length>0&&U!==null){let Se=Math.round(we/s),Xe=e.segments.map((J,ye)=>{if(ye===U){let Le=new Date(J.startDate),Oe=new Date(J.endDate);return Le.setDate(Le.getDate()+Se),Oe.setDate(Oe.getDate()+Se),{startDate:Le,endDate:Oe}}return J}),_e=Xe.flatMap(J=>[J.startDate,J.endDate]),Ie=new Date(Math.min(..._e.map(J=>J.getTime()))),M=new Date(Math.max(..._e.map(J=>J.getTime())));d?.({...e,segments:Xe},Ie,M),Et(t,r);return}}else I==="resize-start"?(K=At(E),q=e.endDate,K>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),ce=false)):I==="resize-end"?(K=e.startDate,q=At(E+L),q.setDate(q.getDate()-1),q<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),ce=false)):ce=false;ce&&K&&q&&(q.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,q));}b?.(e.id,0,false),Et(t,r);}},[I,E,L,e,d,O,m,t,r,s,At,we,U,Et,b]);react.useEffect(()=>{if(I==="none")return;let P=q=>{gt(q);},K=()=>{Pt();};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",K),D.current&&(window.clearInterval(D.current),D.current=null);}},[I,gt,Pt]);let Ge=pe&&!pt?E:t,Re=pe&&!pt?L:r,ut=i.taskClass(e),le=24,fe=y?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:C,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!k.current&&c?.(e),k.current=false;},onDoubleClick:P=>{!pe&&!k.current&&(P.stopPropagation(),l?.(e));},onContextMenu:P=>{P.preventDefault(),p?.(e,P);},onMouseEnter:()=>!pe&&tt(true),onMouseMove:P=>{h&&te&&!pe&&!e.segments&&h({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:P.clientX,mouseY:P.clientY});},onMouseLeave:()=>{pe||(tt(false),je(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+le,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),te&&!pe&&!Ke&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ne,height:Ce,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-start"),onMouseDown:P=>mt(P,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>je("move"),onMouseDown:P=>mt(P,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-end"),onMouseDown:P=>mt(P,"resize-end")})]}),te&&!pe&&bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>je("move"),onMouseDown:P=>mt(P,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-end"),onMouseDown:P=>mt(P,"resize-end")}),te&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:a,width:L,height:Ce,rx:Ze,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"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!pe&&(()=>{let P=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),q=n.getTime(),ce=864e5,Se=(P-q)/ce,Xe=(K-P)/ce,_e=Se*s,Ie=Math.max(Xe*s,s),M=Ge+Re,J=_e+Ie,ye=e.endDate?.getTime()??0,Le=Math.ceil((ye-K)/ce),Oe=Le>0,B=Le<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:_e,y:a,width:Ie,height:Ce,rx:Ze,fill:"none",stroke:it?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Oe&&M>J&&jsxRuntime.jsx("rect",{x:J,y:a,width:M-J,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),Oe&&jsxRuntime.jsxs("text",{x:Math.max(M,J)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Le,"d"]}),B&&jsxRuntime.jsxs("text",{x:M+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Le,"d"]})]})})(),!e.segments&&rt&&H&&(()=>{let K=a+(Ce-8)/2,q=4,ce=e.progress||0,Se=new Date;Se.setHours(0,0,0,0);let Xe=e.startDate&&Se>=e.startDate,_e=e.endDate&&(()=>{let Oe=new Date(e.endDate);return Oe.setHours(0,0,0,0),Se>Oe})(),Ie=e.startDate&&Se<e.startDate,M=1;if(Xe&&e.startDate&&e.endDate&&!Ie){let Oe=new Date(e.startDate);Oe.setHours(0,0,0,0);let B=new Date(e.endDate);B.setHours(0,0,0,0);let z=Math.max(1,(B.getTime()-Oe.getTime())/(1e3*60*60*24)),S=Math.min((Se.getTime()-Oe.getTime())/(1e3*60*60*24),z)/z*100;M=S>0?ce/S:1;}let J;ce>=100?J="#00E5CC":Ie?J="#4B5563":_e&&ce<100?J="#EF4444":M>=.95?J="#22C55E":M>=.8?J="#F59E0B":J="#EF4444";let ye=Math.max(ce/100*Re,ce>0?q*2:0),Le=Re>100&&ce>0;return jsxRuntime.jsxs("g",{"data-task-class":ut,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ge,y:K,width:Re,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),ce>0&&jsxRuntime.jsx("rect",{x:Ge,y:K,width:ye,height:8,rx:q,fill:J}),Le&&jsxRuntime.jsxs("text",{x:Ge+ye+6,y:K+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(ce),"%"]})]})})(),!e.segments&&rt&&!H&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!pt?.15:e.parentId?.6:1,scale:te&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:P=>mt(P),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!rt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:ae,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!pt?.15:e.parentId?.6:te?.9:.8,scale:te&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:P=>mt(P),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),rt&&(de||N)&&!e.segments&&jsxRuntime.jsx("rect",{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsxRuntime.jsx("rect",{x:Ge,y:a,width:Math.max(Re*(e.progress/100),Ze*2),height:Ce,rx:Ze,fill:ae,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let P=e.progress>0?Re*(e.progress/100):0,K=Ge+P,q=Re-P,ce=e.progress===0?Ze:0,Se=e.progress===0?Ge:K,Xe=e.progress===0?Re:q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Se,y:a,width:Xe,height:Ce,rx:ce,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Se,y:a,width:Xe,height:Ce,rx:ce,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),rt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!pe&&(()=>{let P=Ge+Re*(e.progress/100),K=8,q=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:P,cy:a+Ce/2,r:K,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:P,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((P,K)=>{let q=(P.startDate.getTime()-n.getTime())/864e5*s,Se=(P.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Xe=pe&&I==="move"&&U===K,_e=ze===K,Ie=Xe?q+we:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!pe&&Qe(K),onMouseLeave:()=>!pe&&Qe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie,y:a,width:Se,height:Ce,rx:Ze,fill:ae,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:_e?.9:.8,scale:_e&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:M=>{M.stopPropagation(),re(K),Ee(q),mt(M,void 0,q);},style:{cursor:Ve,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ie,y:a,width:Se*(e.progress/100),height:Ce,rx:Ze,fill:ae,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),Y&&(de||N)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[N&&!de&&jsxRuntime.jsx("rect",{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsxRuntime.jsx("rect",{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Re>60&&!e.segments&&!(rt&&H)&&(()=>{let P=i.taskLabel(e),K=typeof P=="string"?P:e.name,q=K.length>Math.floor(Re/8)?`${K.substring(0,Math.floor(Re/8))}...`:K;return jsxRuntime.jsx("text",{x:Ge+8,y:a+Ce/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:q})})(),!pe&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(rt?jsxRuntime.jsxs("text",{x:Ge+Re+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Re>100?jsxRuntime.jsxs("text",{x:Ge+Re-12,y:a+Ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Re>80&&!pe&&!e.segments&&!(rt&&H)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ge+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ge+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(te||at)&&!pt&&!e.segments&&!H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ge-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:De},onMouseEnter:()=>je("resize-start"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),mt(P,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ge+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-start"||I==="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:Ge+Re-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:De},onMouseEnter:()=>je("resize-end"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),mt(P,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ge+Re-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-end"||I==="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:te&&!pe&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>je("connect"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),mt(P,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&Z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:Z.x,y2:Z.y,stroke:O?o.statusCompleted:o.accent,strokeWidth:O?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:O?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Z.x,cy:Z.y,r:O?8:6,fill:O?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),O&&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"})]}),(te||pe)&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ge-1,y:a-1,width:Re+2,height:Ce+2,rx:Ze+1,fill:"none",stroke:pe?o.accent:rt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:rt?1:2,opacity:pe||rt?.6:.4,initial:{opacity:0},animate:{opacity:pe||rt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:E+L,y1:0,x2:E+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&!pe&&!e.segments&&!h&&(()=>{let q=a<100,ce=q?a+Ce+13:a-82-13,Se=q?`M ${Ge+Re/2-6} ${a+Ce+3} L ${Ge+Re/2} ${a+Ce+13} L ${Ge+Re/2+6} ${a+Ce+3}`:`M ${Ge+Re/2-6} ${a-13} L ${Ge+Re/2} ${a-3} L ${Ge+Re/2+6} ${a-13}`,Xe=ce+22,_e=ce+40,Ie=ce+55,M=ce+70,J=q?ce+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ge+Re/2-120,y:ce,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:Ge+Re/2,y:Xe,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:Ge+Re/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ge+Re/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:lt(e.startDate)}),jsxRuntime.jsx("text",{x:Ge+Re/2-110,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ge+Re/2-70,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:lt(e.endDate)}),jsxRuntime.jsx("text",{x:Ge+Re/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ge+Re/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsxRuntime.jsx("text",{x:Ge+Re/2+10,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ge+Re/2+65,y:Ie,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:Ge+Re/2-110,y:M,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ge+Re/2-50,y:M,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ye=>ye.name).join(", ").substring(0,30),e.assignees.map(ye=>ye.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:Ge+Re/2,y:J,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:bt?"Left: move \u2022 Right: resize":Ke?"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 yd=260,yn=8,tm=16,bv=-12;function am({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:y,mouseX:w,mouseY:x}=e,k=y.effortMinutes!=null||y.timeLoggedMinutes!=null||y.soldEffortMinutes!=null?155:105,D=w+tm,T=x+bv-k;D+yd>window.innerWidth-yn&&(D=w-yd-tm),D<yn&&(D=yn);let I=T<yn;I&&(T=x+20),T+k>window.innerHeight-yn&&(T=window.innerHeight-yn-k),o({left:D,top:T,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=y=>y.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let y=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${y} d\xEDa${y!==1?"s":""}`:`${y} day${y!==1?"s":""}`},p=y=>{if(y==null||y===0)return "N/A";let w=Math.floor(y/60),x=y%60;return w===0?`${x}m`:x===0?`${w}h`:`${w}h ${x}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",h=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:yd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:h,border:`1px solid ${v}`,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:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(pi,{label:i.duration,value:l(),labelColor:d,valueColor:m}),jsxRuntime.jsx(pi,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(pi,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(y=>y.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:b,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Zl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,p)=>{let d=p.category||"Other";return l[d]||(l[d]=[]),l[d].push(p),l},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function td({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=react.useState("export"),[c,l]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let h=o?.current||void 0,v=await Jc(e,c,h);Qc(v,c);},b=async h=>{let v=h.target.files?.[0];if(v){try{let f=await tu(v),y=v.name.endsWith(".json")?"json":"csv",w=eu(f,y);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(h=>jsxRuntime.jsxs("button",{onClick:()=>l(h),className:u("p-4 rounded-lg border-2 transition-all text-center",c===h?"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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),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:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((h,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},v))})]})]})]})]})]})}var Uy=["URGENT","HIGH","MEDIUM","LOW"],Wy=[{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"}],Vy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ad({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:b}){let[h,v]=react.useState(true),f=react.useCallback(k=>{a({search:k.target.value});},[a]),y=react.useCallback(k=>{a({dateFilter:k.target.value});},[a]),w=react.useCallback(k=>{r({by:k.target.value});},[r]),x=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":""} ${h?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:k=>{k.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:h?"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)"]})]}),!h&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:k=>{let S=k.target.value;a({priorities:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Uy.map(k=>jsxRuntime.jsx("option",{value:k,children:k},k))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:k=>{let S=k.target.value;a({assignees:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(k=>jsxRuntime.jsx("option",{value:k.id,children:k.name},k.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:k=>{let S=k.target.value;a({labels:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(k=>jsxRuntime.jsx("option",{value:k,children:k},k))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Wy.map(k=>jsxRuntime.jsx("option",{value:k.value,children:k.label},k.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:k=>b(k.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Vy.map(k=>jsxRuntime.jsx("option",{value:k.value,children:k.label},k.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function rd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&p(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":l,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),l&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[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 i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var od={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"}},nd={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"}},sd={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"}},Ho={dark:od,light:nd,neutral:sd},ei="dark";var ti=react.createContext(void 0),Zy="asakaa-theme";function Fp({children:e,defaultTheme:t=ei,storageKey:a=Zy}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=react.useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Ho[r];Object.entries(c.colors).forEach(([p,d])=>{d&&i.style.setProperty(`--theme-${ex(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let m=c.colors[p];m&&i.style.setProperty(d,m);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Ho};return jsxRuntime.jsx(ti.Provider,{value:n,children:e})}function pn(){let e=react.useContext(ti);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ex(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function id({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=pn();return e?jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ho).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Mp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var ai={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"}},Pp={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"}},ld={en:ai,es:Pp};function Ap(e){return ld[e]||ld.en}function dd(e,t){let a=Ap(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 gn=react.createContext(ai);function Mr(){return react.useContext(gn)}function ni(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(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Ip({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=react.useState(false),[c,l]=react.useState(null),[p,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),b=Mr(),h=ni(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=b.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let N=k=>{let S=k.target;m.current&&!m.current.contains(S)&&g.current&&!g.current.contains(S)&&i(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let y=[{id:"png",label:b.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:b.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:b.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:b.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),w=async(N,k)=>{if(k){l(N);try{await k();}catch(S){console.error(`Export ${N} failed:`,S);}finally{l(null),i(false);}}},x=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>i(!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:b.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:h.top,left:h.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((N,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(N.id,N.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===N.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:p?b.toolbar.copied:b.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Dx({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 Sx({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 Bp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),i=react.useRef(null),c=Mr(),l=ni(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let b=g.target;n.current&&!n.current.contains(b)&&i.current&&!i.current.contains(b)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((m,g)=>{let b=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:b?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:b?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:b?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:b?600:500},children:m.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Rp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),i=react.useRef(null),c=react.useRef(null),l=Mr(),p=ni(i,s,"left");react.useEffect(()=>{if(!s)return;let b=setTimeout(()=>{let h=f=>{let y=f.target;i.current&&!i.current.contains(y)&&c.current&&!c.current.contains(y)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(b),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.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:l.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],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:i,onClick:b=>{b.stopPropagation(),n(h=>!h);},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:l.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(b=>{let h=t===b.value&&!r,v=()=>b.value==="all"?h?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"}):b.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(b.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:h?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:`${h?b.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:b.label}),h&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},b.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:l.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 Ex({value:e,onChange:t,theme:a}){let r=Mr(),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 i=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:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?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 Fx({theme:e,forecast:t}){let a=Mr(),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,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",b=t?.budgetVariancePercent,h=b!=null&&b!==0,v=b!=null?b>0?`+${b.toFixed(0)}% ${a.toolbar.budgetOver}`:`${b.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<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&&i&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),h&&v&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function Mx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=react.useState(false),b=react.useRef(null),h=react.useRef(null),v=Mr(),f=ni(b,m,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let k=S=>{let C=S.target;b.current&&!b.current.contains(C)&&h.current&&!h.current.contains(C)&&g(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]);let w=v.toolbar.visibility==="Visibilidad",x=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:i,onChange:c}],N=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:b,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:v.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:h,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:x.map((k,S)=>{let C=k.icon,I=k.disabled,$=k.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!I&&k.onChange?.(!k.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:I?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:I?"not-allowed":"pointer"},whileHover:I?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.03},title:$,children:[jsxRuntime.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:I?y?"rgba(255,255,255,0.2)":"#D1D5DB":k.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label}),k.active&&!I&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((k,S)=>{let C=l===k.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(k.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+S)*.03},children:[jsxRuntime.jsx("span",{style:{color:C?e.accent||"#2E94FF":y?"rgba(255,255,255,0.85)":e.textPrimary},children:k.label}),C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.value)})]})]})}),document.body)]})}function si({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:h=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:y,onWbsLevelChange:w,maxWbsDepth:x=4,viewMode:N="execution",onViewModeChange:k,projectForecast:S,onExportPNG:C,onExportPDF:I,onExportExcel:$,onExportCSV:P,onExportJSON:te,onExportMSProject:O,showCriticalPath:H=true,onShowCriticalPathChange:F,showDependencies:J=true,onShowDependenciesChange:ee,highlightWeekends:Re=true,onHighlightWeekendsChange:B,showBaseline:Y=false,onShowBaselineChange:ye,onCopySnapshotLink:Ge,hasDependencies:U=true}){let oe=Mr(),Z=C||I||$||P||te||O,Se=!!e.glassToolbar,[ke,Ie]=react.useState(false),He=react.useRef(null);react.useEffect(()=>{ke&&He.current&&He.current.focus();},[ke]);let et=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],ae=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Xe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Se){let pe=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:ke?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ie(!ke),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"})}),ke&&jsxRuntime.jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Ie(false),onKeyDown:at=>{at.key==="Escape"&&Ie(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),k&&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:()=>k("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:oe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>k("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:oe.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Ex,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),w&&jsxRuntime.jsx(Bp,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsx(Rp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsxRuntime.jsx(Mx,{theme:e,showCriticalPath:H,onShowCriticalPathChange:F,showBaseline:Y,onShowBaselineChange:ye,highlightWeekends:Re,onHighlightWeekendsChange:B,showDependencies:J,onShowDependenciesChange:ee,rowDensity:i,onRowDensityChange:c,hasDependencies:U}),jsxRuntime.jsx(Ip,{theme:e,onExportPNG:C,onExportPDF:I,onExportExcel:$,onExportMSProject:O,onCopySnapshotLink:Ge}),p&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${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:d||oe.toolbar.createTask})]})]})]}),S&&jsxRuntime.jsx(Fx,{theme:e,forecast:S})]})}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(Sx,{options:et,value:t,onChange:pe=>a(pe),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Bp,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Rp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]}),(Z||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Ip,{theme:e,onExportPNG:C,onExportPDF:I,onExportExcel:$,onExportMSProject:O,onCopySnapshotLink:Ge}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsxRuntime.jsx(Dx,{options:ae,value:s,onChange:pe=>n(pe),theme:e})]})]})}function ii({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),i=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let l=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function hn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[i,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,b=window.innerHeight,h=t,v=a;t+p+m>g&&(h=t-p,h<m&&(h=m)),a+d+m>b&&(v=b-d-m,v<m&&(v=m)),c({x:h,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var Qt={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 Gp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),b=react.useCallback(w=>{g.current=w;},[]),h=react.useCallback(w=>{let x=[],N=k=>{for(let S of k)x.push(S),S.subtasks&&S.subtasks.length>0&&S.isExpanded&&N(S.subtasks);};return N(w),x},[]),v=react.useCallback(()=>{let w=h(e);for(let x of w)if(t.has(x.id))return x;return null},[e,t,h]),f=react.useCallback((w,x)=>{let N=h(e);if(N.length===0)return;let k=v();if(!k){a(N[0].id,false);return}let S=N.findIndex($=>$.id===k.id);if(S===-1)return;let C=w==="up"?S-1:S+1;if(C<0||C>=N.length)return;let I=N[C];a(I.id,x);},[e,v,h,a]),y=react.useCallback(w=>{if(!m)return;let x=w.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||g.current){w.key==="Escape"&&(x.blur(),g.current=false);return}let S=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,C=Array.from(t),I=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(I&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!I.isExpanded||w.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){C.length>0&&(w.preventDefault(),n(C,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){C.length>0&&(w.preventDefault(),i(C));return}if(w.key==="Tab"&&w.shiftKey){C.length>0&&(w.preventDefault(),c(C));return}if(w.key==="Enter"&&!w.shiftKey&&!S){I&&(w.preventDefault(),r(I.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!S){I&&(w.preventDefault(),r(I.id,"above"));return}if(w.key==="Enter"&&S){I&&(w.preventDefault(),d(I.id));return}if(w.key==="F2"){I&&(w.preventDefault(),l(I.id));return}if(w.key==="Delete"||w.key==="Backspace"&&S){C.length>0&&(w.preventDefault(),o(C));return}if(w.key==="d"&&S&&!w.shiftKey){C.length>0&&(w.preventDefault(),s(C));return}},[m,t,v,f,r,o,s,n,i,c,l,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[m,y]),{setIsEditing:b}}function jp(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),b=m.indexOf(d);if(g===-1||b===-1){o(d);return}let h=Math.min(g,b),v=Math.max(g,b),f=m.slice(h,v+1);t(new Set(f)),r(d);},[a,o]),i=react.useCallback((d,m,g,b)=>{b?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:p}}function pd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?pd(t.subtasks):t.subtasks}))}function yn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function li(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=li(a.subtasks,t);if(r)return r}}return null}function ud(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ud(a.subtasks,t);if(r)return r}return null}function md(e,t){if(t.length===0)return e;let a=yn(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 b=[];return {tasks:m.filter(v=>{if(g.has(v.id))return b.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,b.push(...f.removed);}return true}),removed:b}},i=(m,g,b)=>m.map(h=>h.id===g?{...h,subtasks:[...h.subtasks||[],...b],isExpanded:true}:h.subtasks?{...h,subtasks:i(h.subtasks,g,b)}:h),c=new Set(t),{tasks:l,removed:p}=n(e,c),d=i(l,s.id,p);return pd(d)}function gd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ud(a,r);if(!o)continue;let s=ud(a,o.id),n=(l,p,d)=>{for(let m=0;m<l.length;m++){let g=l[m];if(g.id===p&&g.subtasks){let b=g.subtasks.findIndex(h=>h.id===d);if(b!==-1){let[h]=g.subtasks.splice(b,1);return h}}if(g.subtasks){let b=n(g.subtasks,p,d);if(b)return b}}return null},i=(l,p,d)=>{let m=l.findIndex(g=>g.id===p);if(m!==-1)return l.splice(m+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,p,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return pd(a)}function fd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=n.length?false:([n[l],n[p]]=[n[p],n[l]],n[l]={...n[l],position:l},n[p]={...n[p],position:p},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 Jn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let b=n(g.subtasks);if(b)return b}return null}let p=c[l],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(l+1,0,m),m},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function Kp(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"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,n),true};return i(r),{tasks:r,newTask:n}}function hd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:hd(r.subtasks,t,a)}:r)}function yd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:yd(a.subtasks,t)}:a)}function xd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let b=a(g.subtasks);if(b)return b}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let b=c(g.subtasks);if(b>=0)return b}}return 0},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=m=>m.map(g=>{if(g.id===t){let b=g.subtasks||[];return {...g,subtasks:[...b,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function Yp(e,t,a,r){if(t===a)return e;let o=li(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,d)=>{let m=l?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((b,h)=>({...b,position:h}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function vr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=vr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),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((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ci({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:y,onTaskCreate:w,onTaskRename:x,onCreateSubtask:N,onOpenTaskModal:k,onDeleteRequest:S,onTaskReparent:C,scrollContainerRef:I,showCriticalPath:$=false}){let P=react.useContext(gn),[te,O]=react.useState(null),[H,F]=react.useState(null),[J,ee]=react.useState(""),Re=react.useRef(null),[B,Y]=react.useState(null),[ye,Ge]=react.useState(0),[U,oe]=react.useState(0),[Z,Se]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ke,Ie]=react.useState(null),[He,et]=react.useState(null),[ae,Xe]=react.useState(null),pe=react.useRef(0),at=5,mt=react.useRef(false),[Pt,Ce]=react.useState(null),[yt,nt]=react.useState(false),Je=react.useRef(null),[z,ne]=react.useState(null),[D,q]=react.useState(false),ce=react.useRef(null);react.useEffect(()=>{function ie(be){ce.current&&!ce.current.contains(be.target)&&q(false);}if(D)return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[D]),react.useEffect(()=>{H&&Re.current&&(Re.current.focus(),Re.current.select());},[H]),react.useEffect(()=>{if(!B)return;let ie=A=>{let K=A.clientX-ye,X=U+K;m?.(B,X);},be=()=>{Y(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",be),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",be),document.body.style.cursor="",document.body.style.userSelect="";}},[B,ye,U,m]);let{selectedTaskIds:Te,handleTaskClick:W,isTaskSelected:re}=jp(),{setIsEditing:Ue}=Gp({tasks:e,selectedTaskIds:Te,onTaskSelect:(ie,be)=>{let K=yn(e).map(X=>X.id);W(ie,K,be||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:ie=>{let be=yn(e).find(A=>A.id===ie);be&&ut(be);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:ie=>{let be=yn(e).find(A=>A.id===ie);be&&k&&k(be);},enableKeyboard:true}),Ne=(ie,be=0,A="")=>{let K=[],X=[...ie].sort((me,Ee)=>(me.position??0)-(Ee.position??0));for(let me=0;me<X.length;me++){let Ee=X[me],Ye=me+1,Ve=A?`${A}.${Ye}`:`${Ye}.0`;if(Ee.wbsCode=Ve,K.push({task:Ee,level:be}),Ee.subtasks&&Ee.subtasks.length>0&&Ee.isExpanded){let Oe=A?`${A}.${Ye}`:`${Ye}`;K.push(...Ne(Ee.subtasks,be+1,Oe));}}return K},ze=Ne(e),Fe=48,Ke=Math.max(ze.length*a,600-Fe),lt=ie=>!ie.startDate||!ie.endDate?"-":`${Math.ceil((ie.endDate.getTime()-ie.startDate.getTime())/(1e3*60*60*24))}d`,ut=ie=>{F(ie.id),ee(ie.name),Ue(true);},st=ie=>{J.trim()&&J!==e.find(be=>be.id===ie)?.name&&x?.(ie,J.trim()),F(null),ee(""),Ue(false);},Ze=()=>{F(null),ee(""),Ue(false);},zt=(ie,be)=>{be.stopPropagation(),N?.(ie.id);},Ct=(ie,be)=>{be.preventDefault(),pe.current=be.clientY,Ie(ie),mt.current=false,nt(false),Ce({x:be.clientX,y:be.clientY});},ht=ie=>{if(!ke||(Math.abs(ie.clientY-pe.current)>at&&!mt.current&&(mt.current=true,nt(true)),Ce({x:ie.clientX,y:ie.clientY}),!mt.current))return;if(I?.current){let me=I.current,Ee=me.getBoundingClientRect(),Ye=60,Ve=12;Je.current&&(cancelAnimationFrame(Je.current),Je.current=null);let Oe=ie.clientY-Ee.top,bt=Ee.bottom-ie.clientY;if(Oe<Ye&&me.scrollTop>0){let gt=Math.round(Ve*(1-Oe/Ye)),M=()=>{me.scrollTop-=gt,mt.current&&me.scrollTop>0&&(Je.current=requestAnimationFrame(M));};Je.current=requestAnimationFrame(M);}else if(bt<Ye&&me.scrollTop<me.scrollHeight-me.clientHeight){let gt=Math.round(Ve*(1-bt/Ye)),M=()=>{me.scrollTop+=gt,mt.current&&me.scrollTop<me.scrollHeight-me.clientHeight&&(Je.current=requestAnimationFrame(M));};Je.current=requestAnimationFrame(M);}}let A=document.querySelectorAll("[data-task-row]"),K=null,X=null;A.forEach(me=>{let Ee=me.getBoundingClientRect(),Ye=me.getAttribute("data-task-row");if(Ye&&Ye!==ke&&ie.clientY>=Ee.top&&ie.clientY<=Ee.bottom){K=Ye;let Ve=ie.clientY-Ee.top,Oe=Ee.height;Ve<Oe*.25?X="above":Ve>Oe*.75?X="below":X="child";}}),et(K),Xe(X);},wt=()=>{if(mt.current&&ke&&He&&ae){if(ae==="child")C?.(ke,He);else if(ae==="above"||ae==="below"){let ie=(X,me,Ee=null)=>{for(let Ye of X){if(Ye.id===me)return Ee;if(Ye.subtasks){let Ve=ie(Ye.subtasks,me,Ye.id);if(Ve!==void 0)return Ve}}},be=ie(e,ke,null),A=ie(e,He,null),K=(X,me,Ee,Ye)=>{let Ve=X.findIndex(gt=>gt.id===me),Oe=Ye?X.findIndex(gt=>gt.id===Ee):-1,bt=ae==="below"?Ve+1:Ve;return Ye&&Oe!==-1&&Oe<Ve&&(bt-=1),Math.max(0,bt)};if(A===null){let me=K(e,He,ke,be===null);C?.(ke,null,me);}else {let X=ze.find(me=>me.task.id===A)?.task;if(X?.subtasks){let me=be===A,Ee=K(X.subtasks,He,ke,me);C?.(ke,A,Ee);}}}}Je.current&&(cancelAnimationFrame(Je.current),Je.current=null),Ie(null),et(null),Xe(null),Ce(null),mt.current=false,nt(false);};react.useEffect(()=>{if(ke)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",wt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",wt),document.body.style.cursor="",document.body.style.userSelect="";}},[ke,He,ae]);let rt=(ie,be,A)=>{let K=be.subtasks&&be.subtasks.length>0;switch(ie.id){case "name":let X=H===be.id,me=te===be.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${A*20}px`},children:[C&&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:me?1:.3},onMouseDown:L=>Ct(be.id,L),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),be.subtasks&&be.subtasks.length>0?jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),c?.(be.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:be.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"}),X?jsxRuntime.jsx("input",{ref:Re,type:"text",value:J,onChange:L=>ee(L.target.value),onKeyDown:L=>{L.key==="Enter"?st(be.id):L.key==="Escape"&&Ze();},onBlur:()=>st(be.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:L=>L.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:be.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:be.parentId?"13px":"14px",fontWeight:be.isMilestone?600:be.parentId?400:600,letterSpacing:be.parentId?"0":"-0.01em"},title:be.name,children:[be.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:be.wbsCode}),be.isHighlighted&&be.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:be.name}),be.subtasks&&be.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(be.progress||0),"%"]}),$&&be.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&be.cpmData&&jsxRuntime.jsxs("span",{style:{color:be.cpmData.totalFloat<=0?"#EF4444":be.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(be.cpmData.totalFloat),"d"]})]}),me&&!X&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:L=>zt(be,L),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:L=>{L.stopPropagation(),ut(be);},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 Ye=ie.id==="startDate"?"startDate":"endDate",Ve=be[Ye],Oe=z?.taskId===be.id&&z?.field===Ye,bt=L=>L?(typeof L=="string"?new Date(L):L).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:L=>L.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:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:L=>{if(!K)if(Oe)ne(null);else {let G=L.currentTarget.getBoundingClientRect();ne({taskId:be.id,field:Ye,month:Ve?typeof Ve=="string"?new Date(Ve):Ve:new Date,position:{top:G.bottom+4,left:G.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:bt(Ve)}),K&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ne(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:z?.position.top,left:z?.position.left},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let L=new Date,G=new Date(L);G.setDate(L.getDate()+1);let de=new Date(L);de.setDate(L.getDate()+7);let T=new Date(L);return T.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:G},{label:"Pr\xF3xima semana",date:de},{label:"2 semanas",date:T}].map((xe,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:Qe=>Qe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Qe=>Qe.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(be.id,{[Ye]:xe.date}),ne(null);},children:xe.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:L=>L.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(be.id,{[Ye]:void 0}),ne(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>ne(L=>L?{...L,month:new Date(L.month.getFullYear(),L.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:z?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ne(L=>L?{...L,month:new Date(L.month.getFullYear(),L.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((L,G)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:L},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let L=z?.month||new Date,G=L.getFullYear(),de=L.getMonth(),T=new Date(G,de,1).getDay(),j=new Date(G,de+1,0).getDate(),xe=new Date,Le=[];for(let tt=T-1;tt>=0;tt--)Le.push({day:new Date(G,de,-tt).getDate(),date:new Date(G,de-1,new Date(G,de,-tt).getDate()),isCurrentMonth:false});for(let tt=1;tt<=j;tt++)Le.push({day:tt,date:new Date(G,de,tt),isCurrentMonth:true});let Qe=42-Le.length;for(let tt=1;tt<=Qe;tt++)Le.push({day:tt,date:new Date(G,de+1,tt),isCurrentMonth:false});return Le.map((tt,xt)=>{let Rt=tt.date.toDateString()===xe.toDateString(),Ot=(Ve?typeof Ve=="string"?new Date(Ve):Ve:null)?.toDateString()===tt.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:tt.isCurrentMonth?Ot?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ot?"#2E94FF":"transparent",boxShadow:Rt&&!Ot?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(be.id,{[Ye]:tt.date}),ne(null);},children:tt.day},xt)})})()})]})]})]}),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:lt(be)})});case "assignees":if(K)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 gt=r.filter(L=>be.assignees?.some(G=>G.name===L.name||G.initials===L.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:L=>L.stopPropagation(),children:jsxRuntime.jsx(Lo,{assignedUsers:gt,availableUsers:r,onChange:L=>{let G=L.map(de=>({id:de.id,name:de.name,initials:de.initials,color:de.color}));g?.(be.id,{assignees:G.length>0?G:void 0});}})});case "status":if(K){let L=be.progress===100?"\u2713":be.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:L})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:L=>L.stopPropagation(),children:jsxRuntime.jsx(vu,{status:be.status||"todo",onChange:L=>{g?.(be.id,{status:L,progress:L==="completed"?100:be.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.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:`${be.progress}%`,backgroundColor:be.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:[be.progress,"%"]})]});case "priority":let M={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},le={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},fe=M[be.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:L=>L.stopPropagation(),children:jsxRuntime.jsx(Po,{priority:fe,onChange:L=>{L&&g?.(be.id,{priority:le[L]||"medium"});}})});default:return null}},Lt=ie=>[{id:"hide",label:"Hide Column",icon:Qt.Hide,onClick:()=>d(ie),disabled:ie==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Qt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Qt.SortDesc,onClick:()=>{}}],We=ie=>ie.subtasks&&ie.subtasks.length>0?[{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{N?.(ie.id);}},{id:"duplicate",label:P?.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{y?.([ie.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{S?S(ie.id,ie.name):f?.([ie.id]);}}]:[{id:"edit",label:P?.contextMenu?.editTask||"Edit Task",icon:Qt.Pencil,onClick:()=>{n?.(ie);}},{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{N?.(ie.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:P?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qt.MarkIncomplete,onClick:()=>{g?.(ie.id,{status:"todo",progress:0});},disabled:ie.status==="todo"},{id:"setInProgress",label:P?.contextMenu?.setInProgress||"Set In Progress",icon:Qt.SetInProgress,onClick:()=>{g?.(ie.id,{status:"in-progress"});},disabled:ie.status==="in-progress"},{id:"markComplete",label:P?.contextMenu?.markComplete||"Mark Complete",icon:Qt.MarkComplete,onClick:()=>{g?.(ie.id,{status:"completed",progress:100});},disabled:ie.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:P?.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{y?.([ie.id]);}},{id:"split",label:P?.contextMenu?.splitTask||"Split Task",icon:Qt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{S?S(ie.id,ie.name):f?.([ie.id]);}}],Be=p.filter(ie=>ie.visible),pt=Be.reduce((ie,be)=>ie+be.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:pt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Fe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((ie,be)=>{let A=be===Be.length-1,K=ie.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${ie.width}px`,minWidth:`${ie.minWidth??(K?200:60)}px`,maxWidth:`${ie.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:A?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:X=>{X.preventDefault(),Se({isOpen:true,x:X.clientX,y:X.clientY,type:"header",columnId:ie.id});},onMouseEnter:X=>{X.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:X=>{X.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ie.label,children:ie.label}),ie.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===ie.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:X=>{X.preventDefault(),X.stopPropagation(),Y(ie.id),Ge(X.clientX),oe(ie.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},ie.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(ii,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>q(!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:ce,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>q(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:Ke},children:ze.map(({task:ie,level:be},A)=>{let K=re(ie.id),X=He===ie.id,me=X&&ae==="above",Ee=X&&ae==="below",Ye=X&&ae==="child",Ve={};return Ye&&(Ve.backgroundColor=`${t.accent}15`,Ve.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ie.id,className:`flex items-center cursor-pointer group ${ke===ie.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Ye?`${t.accent}15`:A%2===0?t.bgPrimary:t.bgGrid,opacity:$?ie.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Ve},onMouseEnter:()=>O(ie.id),onMouseLeave:()=>O(null),onClick:Oe=>{let gt=yn(e).map(fe=>fe.id),le=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;W(ie.id,gt,le,Oe.shiftKey),s?.(ie);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(ie);},onContextMenu:Oe=>{Oe.preventDefault(),Se({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:ie}),i?.(ie,Oe);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[me&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ee&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Oe,bt)=>{let gt=bt===Be.length-1,M=Oe.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${M?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(M?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${te===ie.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:rt(Oe,ie,M?be:0)},`${ie.id}-${Oe.id}`)})]},ie.id)})}),jsxRuntime.jsx(hn,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?Lt(Z.columnId):Z.type==="task"&&Z.task?We(Z.task):[],onClose:()=>Se({...Z,isOpen:false}),theme:t}),yt&&Pt&&ke&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Pt.x+12,top:Pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ie=ze.find(be=>be.task.id===ke)?.task;return ie?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ie.name})}):null})()}),document.body)]})}function Zp(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,i]=react.useState(e),[c,l]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(0),[x,N]=react.useState(0),[k,S]=react.useState(null),[C,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:b,setActiveZone:h,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:y,setDraggedSegmentStartX:w,segmentDragOffsetX:x,setSegmentDragOffsetX:N,hoveredSegmentIndex:k,setHoveredSegmentIndex:S,isHovered:C,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,F)=>{r("none"),d(null),g(null),i(H),l(F),N(0),f(null),w(0);}}}function mi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:b,onHoverChange:h,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:y=true,readOnly:w=false}){let x=Zp(t,r),N=react.useRef(null),k=react.useRef(false),S=react.useRef(null),C=react.useRef(null),{dragMode:I,setDragMode:$,dragOffset:P,setDragOffset:te,ghostX:O,setGhostX:H,ghostWidth:F,setGhostWidth:J,connectionLine:ee,setConnectionLine:Re,hoveredTaskId:B,setHoveredTaskId:Y,activeZone:ye,setActiveZone:Ge,draggedSegmentIndex:U,setDraggedSegmentIndex:oe,draggedSegmentStartX:Z,setDraggedSegmentStartX:Se,segmentDragOffsetX:ke,setSegmentDragOffsetX:Ie,hoveredSegmentIndex:He,setHoveredSegmentIndex:et,isHovered:ae,setIsHovered:Xe,isDragging:pe,isResizing:at,isConnecting:mt,resetDragState:Pt}=x,Ce=18,yt=!!o.executionBarBg,nt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Je=yt?3:6,z=e.subtasks&&e.subtasks.length>0,ne=e.endDate&&(()=>{let A=new Date;A.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<A})()&&e.progress<100,D=y&&e.isCriticalPath,q=o.name==="neutral"||o.today==="#1C1917",ce=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},re=y&&e.isCriticalPath||ne?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,Ue=w?"default":pe?mt?"crosshair":at?"ew-resize":"grabbing":"grab",Ne=w?"default":"ew-resize",Fe=(A=>A>=80?20:A>=60?15:A>=50?12:10)(r),Ke=r<50,lt=r<40;react.useEffect(()=>{h&&(!ae||pe||e.segments)&&h(null);},[ae,pe,e.segments,h]);let ut=A=>A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),st=()=>{let A=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${A} day${A!==1?"s":""}`},Ze=A=>Math.round(A/s)*s,zt=A=>{let K=Math.round(A/s),X=new Date(n);return X.setDate(X.getDate()+K),X},Ct=(A,K)=>{for(let X of g){if(X.id===e.id)continue;let me=5;if(A>=X.x-me&&A<=X.x+X.width+me&&K>=X.y-me&&K<=X.y+X.height+me)return X.id}return null},ht=react.useCallback((A,K,X)=>{if(w)return;A.preventDefault(),A.stopPropagation();let me=N.current?.ownerSVGElement;if(!me)return;let Ee=me.createSVGPoint();Ee.x=A.clientX,Ee.y=A.clientY;let Ye=Ee.matrixTransform(me.getScreenCTM()?.inverse()),Ve=X!==void 0?X:t,Oe=K;if(!Oe){let bt=Ye.x-Ve;A.shiftKey?(Oe="connect",Re({x:t+r,y:a+Ce/2})):A.ctrlKey||A.metaKey?Oe="move":A.altKey?Oe=bt<r/2?"resize-start":"resize-end":lt?bt<r/2?Oe="move":Oe="resize-end":Ke?bt<=Fe/2?Oe="resize-start":bt>=r-Fe/2?Oe="resize-end":Oe="move":bt<=Fe?Oe="resize-start":bt>=r-Fe?Oe="resize-end":Oe="move";}k.current=false,$(Oe),Xe(false),Ge(null),Oe==="move"?te(Ye.x-Ve):Oe==="connect"?Re({x:t+r,y:a+Ce/2}):te(0),H(Ve),J(r);},[t,r,a,Ce,w]),wt=react.useCallback(A=>{let K=N.current?.ownerSVGElement;if(!K)return;let X=K.closest(".gantt-timeline-scroll");if(!X)return;let me=X.getBoundingClientRect(),Ee=60,Ye=15,Ve=0;if(A.clientX<me.left+Ee){let Oe=me.left+Ee-A.clientX;Ve=-Math.min(Ye,Oe/2);}else if(A.clientX>me.right-Ee){let Oe=A.clientX-(me.right-Ee);Ve=Math.min(Ye,Oe/2);}return Ve!==0&&(X.scrollLeft+=Ve),Ve!==0},[]),rt=react.useCallback(A=>{if(I==="none")return;k.current=true,C.current=A;let K=N.current?.ownerSVGElement;if(!K)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let Ee=wt(A);Ee&&!S.current?S.current=window.setInterval(()=>{C.current&&(wt(C.current),rt(C.current));},16):!Ee&&S.current&&(window.clearInterval(S.current),S.current=null);}let X=K.createSVGPoint();X.x=A.clientX,X.y=A.clientY;let me=X.matrixTransform(K.getScreenCTM()?.inverse());if(I==="connect"){Re({x:me.x,y:me.y});let Ee=Ct(me.x,me.y);Y(Ee);}else if(I==="move"){let Ee=me.x-P,Ye=Ze(Ee);H(Ye),J(r);let Ve=Math.round((Ye-t)/s);if(b?.(e.id,Ve,true),e.segments&&e.segments.length>0&&U!==null){let Oe=Ye-Z;Ie(Oe);}}else if(I==="resize-start"){let Ee=me.x,Ye=Ze(Ee),Ve=t+r-Ye;Ve>=s&&(H(Ye),J(Ve));}else if(I==="resize-end"){let Ee=me.x,Ve=Ze(Ee)-t;Ve>=s&&J(Ve);}},[I,t,r,s,P,e,Ze,U,Z,Ct,Y,Re,H,J,Ie,b,wt]),Lt=react.useCallback(()=>{if(S.current&&(window.clearInterval(S.current),S.current=null),C.current=null,I!=="none"){if(I==="connect")B&&m&&m(e,B),Re(null),Y(null);else {let A=e.endDate.getTime()-e.startDate.getTime(),K,X,me=true;if(I==="move"){if(K=zt(O),X=new Date(K.getTime()+A),e.segments&&e.segments.length>0&&U!==null){let Ee=Math.round(ke/s),Ye=e.segments.map((gt,M)=>{if(M===U){let le=new Date(gt.startDate),fe=new Date(gt.endDate);return le.setDate(le.getDate()+Ee),fe.setDate(fe.getDate()+Ee),{startDate:le,endDate:fe}}return gt}),Ve=Ye.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ve.map(gt=>gt.getTime()))),bt=new Date(Math.max(...Ve.map(gt=>gt.getTime())));d?.({...e,segments:Ye},Oe,bt),Pt(t,r);return}}else I==="resize-start"?(K=zt(O),X=e.endDate,K>X&&(console.warn("Invalid date range: start date must be before or equal to end date"),me=false)):I==="resize-end"?(K=e.startDate,X=zt(O+F),X.setDate(X.getDate()-1),X<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),me=false)):me=false;me&&K&&X&&(X.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,X));}b?.(e.id,0,false),Pt(t,r);}},[I,O,F,e,d,B,m,t,r,s,zt,ke,U,Pt,b]);react.useEffect(()=>{if(I==="none")return;let A=X=>{rt(X);},K=()=>{Lt();};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",K),S.current&&(window.clearInterval(S.current),S.current=null);}},[I,rt,Lt]);let We=pe&&!mt?O:t,Be=pe&&!mt?F:r,pt=i.taskClass(e),ie=24,be=y?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:be,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!k.current&&c?.(e),k.current=false;},onDoubleClick:A=>{!pe&&!k.current&&(A.stopPropagation(),l?.(e));},onContextMenu:A=>{A.preventDefault(),p?.(e,A);},onMouseEnter:()=>!pe&&Xe(true),onMouseMove:A=>{h&&ae&&!pe&&!e.segments&&h({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:A.clientX,mouseY:A.clientY});},onMouseLeave:()=>{pe||(Xe(false),Ge(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+ie,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!pe&&!Ke&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Fe,height:Ce,fill:ye==="resize-start"?o.accent:"transparent",opacity:ye==="resize-start"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-start"),onMouseDown:A=>ht(A,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Fe,y:a,width:r-Fe*2,height:Ce,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ge("move"),onMouseDown:A=>ht(A,"move")}),jsxRuntime.jsx("rect",{x:t+r-Fe,y:a,width:Fe,height:Ce,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-end"),onMouseDown:A=>ht(A,"resize-end")})]}),ae&&!pe&&lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ge("move"),onMouseDown:A=>ht(A,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.2:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-end"),onMouseDown:A=>ht(A,"resize-end")}),ae&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:F,height:Ce,rx:Je,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"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!pe&&(()=>{let A=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),X=n.getTime(),me=864e5,Ee=(A-X)/me,Ye=(K-A)/me,Ve=Ee*s,Oe=Math.max(Ye*s,s),bt=We+Be,gt=Ve+Oe,M=e.endDate?.getTime()??0,le=Math.ceil((M-K)/me),fe=le>0,L=le<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Ve,y:a,width:Oe,height:Ce,rx:Je,fill:"none",stroke:nt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),fe&&bt>gt&&jsxRuntime.jsx("rect",{x:gt,y:a,width:bt-gt,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),fe&&jsxRuntime.jsxs("text",{x:Math.max(bt,gt)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",le,"d"]}),L&&jsxRuntime.jsxs("text",{x:bt+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[le,"d"]})]})})(),!e.segments&&yt&&z&&(()=>{let K=a+(Ce-8)/2,X=4,me=e.progress||0,Ee=new Date;Ee.setHours(0,0,0,0);let Ye=e.startDate&&Ee>=e.startDate,Ve=e.endDate&&(()=>{let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),Ee>fe})(),Oe=e.startDate&&Ee<e.startDate,bt=1;if(Ye&&e.startDate&&e.endDate&&!Oe){let fe=new Date(e.startDate);fe.setHours(0,0,0,0);let L=new Date(e.endDate);L.setHours(0,0,0,0);let G=Math.max(1,(L.getTime()-fe.getTime())/(1e3*60*60*24)),T=Math.min((Ee.getTime()-fe.getTime())/(1e3*60*60*24),G)/G*100;bt=T>0?me/T:1;}let gt;me>=100?gt="#00E5CC":Oe?gt="#4B5563":Ve&&me<100?gt="#EF4444":bt>=.95?gt="#22C55E":bt>=.8?gt="#F59E0B":gt="#EF4444";let M=Math.max(me/100*Be,me>0?X*2:0),le=Be>100&&me>0;return jsxRuntime.jsxs("g",{"data-task-class":pt,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:We,y:K,width:Be,height:8,rx:X,fill:"rgba(255,255,255,0.10)"}),me>0&&jsxRuntime.jsx("rect",{x:We,y:K,width:M,height:8,rx:X,fill:gt}),le&&jsxRuntime.jsxs("text",{x:We+M+6,y:K+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(me),"%"]})]})})(),!e.segments&&yt&&!z&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Be,height:Ce,rx:Je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!mt?.15:e.parentId?.6:1,scale:ae&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>ht(A),style:{cursor:Ue,pointerEvents:"all"}}),!e.segments&&!yt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Be,height:Ce,rx:Je,fill:re,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!mt?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:z?void 0:A=>ht(A),style:{cursor:z?"default":Ue,pointerEvents:"all"}}),yt&&(ne||D)&&!e.segments&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!z&&jsxRuntime.jsx("rect",{x:We,y:a,width:Math.max(Be*(e.progress/100),Je*2),height:Ce,rx:Je,fill:re,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!z&&e.progress<100&&(()=>{let A=e.progress>0?Be*(e.progress/100):0,K=We+A,X=Be-A,me=e.progress===0?Je:0,Ee=e.progress===0?We:K,Ye=e.progress===0?Be:X;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Ee,y:a,width:Ye,height:Ce,rx:me,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Ee,y:a,width:Ye,height:Ce,rx:me,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),yt&&!e.segments&&e.progress>0&&e.progress<100&&!z&&!pe&&(()=>{let A=We+Be*(e.progress/100),K=8,X=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:A,cy:a+Ce/2,r:K,fill:X?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:A,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:X?.initials||X?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((A,K)=>{let X=(A.startDate.getTime()-n.getTime())/864e5*s,Ee=(A.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-X+s,Ye=pe&&I==="move"&&U===K,Ve=He===K,Oe=Ye?X+ke:X;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!pe&&et(K),onMouseLeave:()=>!pe&&et(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:Ee,height:Ce,rx:Je,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:Ye||e.parentId?.6:Ve?.9:.8,scale:Ve&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:bt=>{bt.stopPropagation(),oe(K),Se(X),ht(bt,void 0,X);},style:{cursor:Ue,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Oe,y:a,width:Ee*(e.progress/100),height:Ce,rx:Je,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),q&&(ne||D)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&!ne&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Be>60&&!e.segments&&!(yt&&z)&&(()=>{let A=i.taskLabel(e),K=typeof A=="string"?A:e.name,X=K.length>Math.floor(Be/8)?`${K.substring(0,Math.floor(Be/8))}...`:K;return jsxRuntime.jsx("text",{x:We+8,y:a+Ce/2,dominantBaseline:"middle",fill:ce?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ce?"line-through":"none"},children:X})})(),!pe&&!e.segments&&!z&&e.progress>0&&e.progress<100&&(yt?jsxRuntime.jsxs("text",{x:We+Be+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Be>100?jsxRuntime.jsxs("text",{x:We+Be-12,y:a+Ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Be>80&&!pe&&!e.segments&&!(yt&&z)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:We+Be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:We+Be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||at)&&!mt&&!e.segments&&!z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ge("resize-start"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ye==="resize-start"||I==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We+Be-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ge("resize-end"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+Be-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ye==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!pe&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ge("connect"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ye==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:ee.x,y2:ee.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:ee.x,cy:ee.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:ee.x+15,y:ee.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ee.x+10},animate:{opacity:1,x:ee.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||pe)&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We-1,y:a-1,width:Be+2,height:Ce+2,rx:Je+1,fill:"none",stroke:pe?o.accent:yt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:yt?1:2,opacity:pe||yt?.6:.4,initial:{opacity:0},animate:{opacity:pe||yt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O+F,y1:0,x2:O+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!pe&&!e.segments&&!h&&(()=>{let X=a<100,me=X?a+Ce+13:a-82-13,Ee=X?`M ${We+Be/2-6} ${a+Ce+3} L ${We+Be/2} ${a+Ce+13} L ${We+Be/2+6} ${a+Ce+3}`:`M ${We+Be/2-6} ${a-13} L ${We+Be/2} ${a-3} L ${We+Be/2+6} ${a-13}`,Ye=me+22,Ve=me+40,Oe=me+55,bt=me+70,gt=X?me+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:X?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:X?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ee,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:We+Be/2-120,y:me,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:We+Be/2,y:Ye,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:We+Be/2-110,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:We+Be/2-70,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut(e.startDate)}),jsxRuntime.jsx("text",{x:We+Be/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:We+Be/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut(e.endDate)}),jsxRuntime.jsx("text",{x:We+Be/2+10,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:We+Be/2+65,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st()}),jsxRuntime.jsx("text",{x:We+Be/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:We+Be/2+65,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:We+Be/2-110,y:bt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:We+Be/2-50,y:bt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(M=>M.name).join(", ").substring(0,30),e.assignees.map(M=>M.name).join(", ").length>30?"...":""]})]}),!X&&jsxRuntime.jsx("text",{x:We+Be/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":Ke?"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 vd=260,xn=8,am=16,hv=-12;function rm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:y,mouseX:w,mouseY:x}=e,k=y.effortMinutes!=null||y.timeLoggedMinutes!=null||y.soldEffortMinutes!=null?155:105,S=w+am,C=x+hv-k;S+vd>window.innerWidth-xn&&(S=w-vd-am),S<xn&&(S=xn);let I=C<xn;I&&(C=x+20),C+k>window.innerHeight-xn&&(C=window.innerHeight-xn-k),o({left:S,top:C,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=y=>y.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let y=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${y} d\xEDa${y!==1?"s":""}`:`${y} day${y!==1?"s":""}`},p=y=>{if(y==null||y===0)return "N/A";let w=Math.floor(y/60),x=y%60;return w===0?`${x}m`:x===0?`${w}h`:`${w}h ${x}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",h=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:vd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:h,border:`1px solid ${v}`,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(gi,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(gi,{label:i.duration,value:l(),labelColor:d,valueColor:m}),jsxRuntime.jsx(gi,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(gi,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(y=>y.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:b,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
126
126
  @keyframes gantt-tooltip-fade {
127
127
  from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
128
128
  to { opacity: 1; transform: translateY(0); }
129
129
  }
130
- `})]});return reactDom.createPortal(f,document.body)}function 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 Qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[b,h]=react.useState(null),v=r-t,f=v>0,y=Math.abs(v)<5,w=20,x=!y&&a<=e,C,k,D=a-e,T=e+D/2;k=T;let I=8;if(n==="squared")if(y)C=`M ${e} ${t} L ${a} ${r}`;else if(x){let we=e+15,Be=a-w,ze=f?t+20:t-20;k=Be;let Qe=f?1:-1;C=`M ${e} ${t} L ${we-I} ${t} Q ${we} ${t} ${we} ${t+Qe*I} L ${we} ${ze-Qe*I} Q ${we} ${ze} ${we-I} ${ze} L ${Be+I} ${ze} Q ${Be} ${ze} ${Be} ${ze+Qe*I} L ${Be} ${r-Qe*I} Q ${Be} ${r} ${Be+I} ${r} L ${a} ${r}`;}else {k=a-w;let Ee=f?1:-1;C=`M ${e} ${t} L ${k-I} ${t} Q ${k} ${t} ${k} ${t+Ee*I} L ${k} ${r-Ee*I} Q ${k} ${r} ${k+I} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let $=6,A=5,_=`M ${a} ${r} L ${a-$} ${r-A/2} L ${a-$} ${r+A/2} Z`,E=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),me=p||(E?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=d||1,X=o.dependencyHover||(E?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Z="#f87171",He="rgba(248, 113, 113, 0.15)",O=k,j=(t+r)/2;if(b)if(n==="squared")if(y)O=Math.max(e+10,Math.min(a-10,b.x)),j=t;else if(x){let Ee=e+15,we=a-w,Be=f?t+20:t-20,ze=[[e,t,Ee,t],[Ee,t,Ee,Be],[Ee,Be,we,Be],[we,Be,we,r],[we,r,a,r]],Qe=1/0,te={x:O,y:j};for(let tt of ze){let pe=he(b.x,b.y,tt[0],tt[1],tt[2],tt[3]),at=Math.hypot(b.x-pe.x,b.y-pe.y);at<Qe&&(Qe=at,te=pe);}O=te.x,j=te.y;}else {let Ee=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],we=1/0,Be={x:O,y:j};for(let ze of Ee){let Qe=he(b.x,b.y,ze[0],ze[1],ze[2],ze[3]),te=Math.hypot(b.x-Qe.x,b.y-Qe.y);te<we&&(we=te,Be=Qe);}O=Be.x,j=Be.y;}else {let Ee=T,we=t,Be=T,ze=r,Qe=1/0,te=O,tt=j;for(let pe=0;pe<=1;pe+=.02){let at=1-pe,pt=at*at*at*e+3*at*at*pe*Ee+3*at*pe*pe*Be+pe*pe*pe*a,Et=at*at*at*t+3*at*at*pe*we+3*at*pe*pe*ze+pe*pe*pe*r,Ce=Math.hypot(b.x-pt,b.y-Et);Ce<Qe&&(Qe=Ce,te=pt,tt=Et);}O=te,j=tt;}function he(Ee,we,Be,ze,Qe,te){let tt=Qe-Be,pe=te-ze,at=tt*tt+pe*pe;if(at===0)return {x:Be,y:ze};let pt=((Ee-Be)*tt+(we-ze)*pe)/at;return pt=Math.max(0,Math.min(1,pt)),{x:Be+pt*tt,y:ze+pt*pe}}let je=Ee=>{let we=Ee.currentTarget.ownerSVGElement;if(!we)return;let Be=we.getScreenCTM();if(!Be)return;let ze=Be.inverse();h({x:ze.a*Ee.clientX+ze.c*Ee.clientY+ze.e,y:ze.b*Ee.clientX+ze.d*Ee.clientY+ze.f});},U=()=>{g(false),h(null),c?.(false);},re=()=>{g(true),c?.(true);},ee=Ee=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ee,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:we=>{we.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:O,cy:j,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:O,cy:j,r:9,fill:He,stroke:Z,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O-3,y1:j-3,x2:O+3,y2:j+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O+3,y1:j-3,x2:O-3,y2:j+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:U,onMouseMove:je,children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:X,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:X,opacity:.9,style:{pointerEvents:"none"}}),ee({opacity:0,scale:.8})]}):l?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:U,onMouseMove:je,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:X,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:X,style:{pointerEvents:"none"}}),ee({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:U,onMouseMove:je,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:me,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:me,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:me,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),i=16,c=l=>l.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:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Pe={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=l=>{l.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,i=new Set,c=l=>{if(!n.has(l)){n.add(l),i.add(l);let p=r.get(l)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(i.has(d))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Pe.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=Pe.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(`
130
+ `})]});return reactDom.createPortal(f,document.body)}function gi({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 Zn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[b,h]=react.useState(null),v=r-t,f=v>0,y=Math.abs(v)<5,w=20,x=!y&&a<=e,N,k,S=a-e,C=e+S/2;k=C;let I=8;if(n==="squared")if(y)N=`M ${e} ${t} L ${a} ${r}`;else if(x){let ke=e+15,Ie=a-w,He=f?t+20:t-20;k=Ie;let et=f?1:-1;N=`M ${e} ${t} L ${ke-I} ${t} Q ${ke} ${t} ${ke} ${t+et*I} L ${ke} ${He-et*I} Q ${ke} ${He} ${ke-I} ${He} L ${Ie+I} ${He} Q ${Ie} ${He} ${Ie} ${He+et*I} L ${Ie} ${r-et*I} Q ${Ie} ${r} ${Ie+I} ${r} L ${a} ${r}`;}else {k=a-w;let Se=f?1:-1;N=`M ${e} ${t} L ${k-I} ${t} Q ${k} ${t} ${k} ${t+Se*I} L ${k} ${r-Se*I} Q ${k} ${r} ${k+I} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let $=6,P=5,te=`M ${a} ${r} L ${a-$} ${r-P/2} L ${a-$} ${r+P/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),H=p||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),F=d||1,J=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),ee="#f87171",Re="rgba(248, 113, 113, 0.15)",B=k,Y=(t+r)/2;if(b)if(n==="squared")if(y)B=Math.max(e+10,Math.min(a-10,b.x)),Y=t;else if(x){let Se=e+15,ke=a-w,Ie=f?t+20:t-20,He=[[e,t,Se,t],[Se,t,Se,Ie],[Se,Ie,ke,Ie],[ke,Ie,ke,r],[ke,r,a,r]],et=1/0,ae={x:B,y:Y};for(let Xe of He){let pe=ye(b.x,b.y,Xe[0],Xe[1],Xe[2],Xe[3]),at=Math.hypot(b.x-pe.x,b.y-pe.y);at<et&&(et=at,ae=pe);}B=ae.x,Y=ae.y;}else {let Se=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],ke=1/0,Ie={x:B,y:Y};for(let He of Se){let et=ye(b.x,b.y,He[0],He[1],He[2],He[3]),ae=Math.hypot(b.x-et.x,b.y-et.y);ae<ke&&(ke=ae,Ie=et);}B=Ie.x,Y=Ie.y;}else {let Se=C,ke=t,Ie=C,He=r,et=1/0,ae=B,Xe=Y;for(let pe=0;pe<=1;pe+=.02){let at=1-pe,mt=at*at*at*e+3*at*at*pe*Se+3*at*pe*pe*Ie+pe*pe*pe*a,Pt=at*at*at*t+3*at*at*pe*ke+3*at*pe*pe*He+pe*pe*pe*r,Ce=Math.hypot(b.x-mt,b.y-Pt);Ce<et&&(et=Ce,ae=mt,Xe=Pt);}B=ae,Y=Xe;}function ye(Se,ke,Ie,He,et,ae){let Xe=et-Ie,pe=ae-He,at=Xe*Xe+pe*pe;if(at===0)return {x:Ie,y:He};let mt=((Se-Ie)*Xe+(ke-He)*pe)/at;return mt=Math.max(0,Math.min(1,mt)),{x:Ie+mt*Xe,y:He+mt*pe}}let Ge=Se=>{let ke=Se.currentTarget.ownerSVGElement;if(!ke)return;let Ie=ke.getScreenCTM();if(!Ie)return;let He=Ie.inverse();h({x:He.a*Se.clientX+He.c*Se.clientY+He.e,y:He.b*Se.clientX+He.d*Se.clientY+He.f});},U=()=>{g(false),h(null),c?.(false);},oe=()=>{g(true),c?.(true);},Z=Se=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Se,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ke=>{ke.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:Y,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:Y,r:9,fill:Re,stroke:ee,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:Y-3,x2:B+3,y2:Y+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:Y-3,x2:B-3,y2:Y+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:U,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:J,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:J,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:te,fill:J,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:J,opacity:.9,style:{pointerEvents:"none"}}),Z({opacity:0,scale:.8})]}):l?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:oe,onMouseLeave:U,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:J,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:J,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:te,fill:J,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:J,style:{pointerEvents:"none"}}),Z({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:oe,onMouseLeave:U,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:H,strokeWidth:F,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:te,fill:H,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:H,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function yi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",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:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Pe={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=l=>{l.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,i=new Set,c=l=>{if(!n.has(l)){n.add(l),i.add(l);let p=r.get(l)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(i.has(d))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Pe.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=Pe.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
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=Pe.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=Pe.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)=>Pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Pe.findTaskById(e,t);return !a||!a.dependencies?[]:Pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Pe.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=Pe.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=>Pe.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=Pe.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"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Pe.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Pe.formatDate(c.startDate):"N/A",c.endDate?Pe.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t)=>{let a=await import('xlsx'),r=Pe.flattenTasks(e),o=new Map,s=(p,d="")=>{[...p].sort((g,b)=>(g.position??0)-(b.position??0)).forEach((g,b)=>{let h=d?`${d}.${b+1}`:`${b+1}`;o.set(g.id,h),g.subtasks?.length&&s(g.subtasks,h);});};s(e);let n=r.map(p=>{let d=p.startDate&&p.endDate?Pe.calculateDuration(p.startDate,p.endDate):0,m=p.effortMinutes,g=p.timeLoggedMinutes,b=p.soldEffortMinutes;return {WBS:o.get(p.id)||"","Task Name":p.name,"Start Date":p.startDate?Pe.formatDate(p.startDate):"","End Date":p.endDate?Pe.formatDate(p.endDate):"","Duration (days)":d>0?d:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(h=>h.name).join(", ")||"","Estimated (h)":typeof m=="number"?+(m/60).toFixed(1):"","Logged (h)":typeof g=="number"?+(g/60).toFixed(1):"","Quoted (h)":typeof b=="number"?+(b/60).toFixed(1):"","Is Milestone":p.isMilestone?"Yes":"No"}}),i=a.utils.json_to_sheet(n),c=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},{wch:12}];i["!cols"]=c;let l=a.utils.book_new();if(a.utils.book_append_sheet(l,i,"Gantt Tasks"),!t){let p=new Date,d=g=>String(g).padStart(2,"0");t=`Project_${`${p.getFullYear()}-${d(p.getMonth()+1)}-${d(p.getDate())}_${d(p.getHours())}${d(p.getMinutes())}`}.xlsx`;}a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Pe.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Pe.getEarliestStartDate(e)||new Date,i=Pe.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let b=o.get(m.id),h=m.startDate&&m.endDate?Pe.calculateDuration(m.startDate,m.endDate):0,v=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${o.get(f)}</PredecessorUID>
@@ -358,14 +358,14 @@
358
358
  </Calendars>
359
359
  <Tasks>${c}
360
360
  </Tasks>
361
- </Project>`,p=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Pe.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Pe.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let b=t.find(h=>h.id===g);if(b){o(b);let h=r.get(g)?.ef||0;d=Math.max(d,h);}}let m=d+p;r.set(l.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let p=l.startDate&&l.endDate?Pe.calculateDuration(l.startDate,l.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(l.id)),m=s;if(d.length>0)for(let b of d){i(b);let h=n.get(b.id)?.ls||0;m=Math.min(m,h);}let g=m-p;n.set(l.id,{ls:g,lf:m});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),d=n.get(l.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Pe.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 b=s.get(g);b&&b.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 i=new Map,c=[],l=[];for(let m of r)(n.get(m.id)||0)===0&&l.push(m.id);for(;l.length>0;){let m=l.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let b=Pe.calculateDuration(g.startDate,g.endDate),h=0;if(g.dependencies)for(let f of g.dependencies){let y=i.get(f);y&&(h=Math.max(h,y.ef));}i.set(m,{es:h,ef:h+b});let v=s.get(m)||[];for(let f of v){let y=(n.get(f)||1)-1;n.set(f,y),y===0&&l.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let b=o.get(g);if(!b||!b.startDate||!b.endDate)continue;let h=Pe.calculateDuration(b.startDate,b.endDate),v=s.get(g)||[],f=p;if(v.length>0)for(let y of v){let w=d.get(y);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-h,lf:f});}for(let m of c){let g=i.get(m),b=d.get(m),h=b.ls-g.es,v=s.get(m)||[],f;v.length>0?f=Math.min(...v.map(y=>i.get(y).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:b.ls,lateFinish:b.lf,totalFloat:Math.round(h*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:h<=.01});}return t},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let i=Pe.getLatestEndDate(e);if(!i)return null;let c=Pe.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.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=Pe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Pe.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=Pe.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),b=new Date(g);b.setDate(b.getDate()+1),p<b&&(p=b);}let d=Pe.calculateEndDate(p,l),m=g=>g.map(b=>b.id===c.id?{...b,startDate:p,endDate:d}:b.subtasks?{...b,subtasks:m(b.subtasks)}:b);i=m(i),i=Pe.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),p=1e3*60*60*24,d=Pe.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,b,h=new Set)=>{if(h.has(g))return;h.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let y=r.findIndex(A=>A.id===f.id);if(y===-1)continue;let w=f.startDate.getTime(),C=(f.endDate.getTime()-w)/p,D=(w-l)/p*s,T=D+b*s,I=Math.max(C*s,s),$=i+y*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:T,width:I,y:$,rowIndex:y,daysDelta:b,color:f.color}),m(f.id,b,h);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Pe.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 i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=p=>p.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function yi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:b,onDependencyCreate:h,onDependencyDelete:v,showBaseline:f,showCriticalPath:y=true,showDependencies:w=true,highlightWeekends:x=true,canEditTask:C}){let D=Er(),T=react.useRef(null),[I,$]=react.useState([]),[A,_]=react.useState(null),[E,me]=react.useState(null),[L,X]=react.useState(null),Z=react.useRef(false),[He,O]=react.useState(new Set),[j,he]=react.useState(null),je=react.useCallback(H=>{if(L&&!Z.current){let de=H.target,N=false;for(;de&&de!==H.currentTarget;){if(de.getAttribute?.("data-dependency-line")==="true"||de.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}de=de.parentElement;}N||X(null);}},[L]),U=react.useCallback(H=>{me(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ee=r==="day"?60:r==="week"?20:8,Ee=re*ee*n,we=H=>{let de=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=de.getUTCDay()||7;de.setUTCDate(de.getUTCDate()+4-N);let Y=new Date(Date.UTC(de.getUTCFullYear(),0,1));return Math.ceil(((de.getTime()-Y.getTime())/864e5+1)/7)},Be=H=>{let de=H.getDay();return de===0||de===6},ze=react.useCallback(H=>{let de=Math.round(H/(ee*n)),N=new Date(o);return N.setDate(N.getDate()+de),N},[o,ee,n]),Qe=react.useCallback((H,de)=>{if(de.startDate&&de.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let Y=N.createSVGPoint();Y.x=H.clientX,Y.y=H.clientY;let ie=Y.matrixTransform(N.getScreenCTM()?.inverse()),ke=ze(ie.x),V=new Date(ke);V.setDate(V.getDate()+1),he(null),b?.(de,ke,V);},[ze,b]),te=react.useCallback((H,de,N)=>{let Y=H.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=H.clientX,ie.y=H.clientY;let ke=ie.matrixTransform(Y.getScreenCTM()?.inverse()),V=ze(ke.x),Ve=Math.round(ke.x/(ee*n))*ee*n;he({taskId:de.id,x:Ve,y:N*a+a/2,date:V});},[ze,ee,n,a]),tt=react.useCallback(()=>{he(null);},[]),pe=react.useMemo(()=>{let H=ie=>ie.map(ke=>{if(ke.subtasks&&ke.subtasks.length>0){let V=H(ke.subtasks),ae=V.filter(Ve=>Ve.startDate&&Ve.endDate);if(ae.length>0){let Ve=ae.map(Ke=>Ke.startDate.getTime()),De=ae.map(Ke=>Ke.endDate.getTime()),Ue=new Date(Math.min(...Ve)),Ne=new Date(Math.max(...De));return {...ke,subtasks:V,startDate:Ue,endDate:Ne}}return {...ke,subtasks:V}}return ke}),de=(ie,ke=[])=>{let V=[...ie].sort((ae,Ve)=>(ae.position??0)-(Ve.position??0));for(let ae of V)ke.push(ae),ae.subtasks&&ae.subtasks.length>0&&(ae.isExpanded===void 0||ae.isExpanded)&&de(ae.subtasks,ke);return ke},N=H(e);return de(N)},[e]),at=react.useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let de=H.startDate.getTime(),N=H.endDate.getTime(),Y=o.getTime(),ie=(de-Y)/(1e3*60*60*24),ke=(N-de)/(1e3*60*60*24)+1,V=ie*ee*n,ae=Math.max(ee*n,40),Ve=Math.max(ke*ee*n,ae);return {x:V,width:Ve}},[o,ee,n]),pt=react.useMemo(()=>pe.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:de,width:N}=at(H),ie=pe.findIndex(ke=>ke.id===H.id)*a+(a-18)/2;return {id:H.id,x:de,y:ie,width:N,height:18}}),[pe,at]),Et=react.useCallback((H,de,N)=>{if(!N){$([]),_(null);return}if(_({taskId:H,daysDelta:de}),de===0){$([]);return}let Y=Pe.calculateCascadePreview(e,H,de,pe,o,ee*n,a,48);$(Y);},[e,pe,o,ee,n,a,48]),Ce=react.useCallback((H,de)=>{if(!A)return de;let N=ee*n,Y=A.daysDelta*N;if(H===A.taskId)return {x:de.x+Y,width:de.width};let ie=I.find(ke=>ke.taskId===H);return ie?{x:ie.previewX,width:ie.width}:de},[A,I,ee,n]),rt=react.useMemo(()=>{let H=[],de=new Date(o);for(;de<=s;){let ie=(de.getTime()-o.getTime())/864e5*ee*n;if(r==="day")H.push({date:new Date(de),label:de.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ie}),de.setDate(de.getDate()+1);else if(r==="week"){let ke=we(de);H.push({date:new Date(de),label:`${D.labels.week} ${ke}`,x:ie}),de.setDate(de.getDate()+7);}else H.push({date:new Date(de),label:de.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ie}),de.setMonth(de.getMonth()+1);}return H},[o,s,r,ee,n,i,D.labels.week]),it=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ee*n,[o,ee,n]),Ze=Math.max(pe.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),rt.map((H,de)=>jsxRuntime.jsxs("g",{children:[de>0&&jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${de}`)),it>=0&&it<=Ee&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:it,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:it,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${it-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:D.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:T,width:Math.max(Ee,1e3),height:Ze,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:je,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:Ze,fill:t.bgPrimary}),pe.map((H,de)=>jsxRuntime.jsx("rect",{x:0,y:de*a,width:Math.max(Ee,1e3),height:a,fill:de%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),rt.map((H,de)=>de>0?jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${de}`):null),x&&rt.map((H,de)=>{let N=rt[de+1]?.x||Ee;return Be(H.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${de}`):null}),pe.map((H,de)=>{let N=H.startDate&&H.endDate;return jsxRuntime.jsx("g",{children:!N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:de*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>Qe(Y,H),onMouseMove:Y=>te(Y,H,de),onMouseLeave:()=>{tt();}},`clickable-${H.id}`),j&&j.taskId===H.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:j.x,y1:de*a+4,x2:j.x,y2:de*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:j.x,cy:j.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:j.x,cy:j.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${j.x}, ${de*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:j.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!j||j.taskId!==H.id)&&jsxRuntime.jsx("text",{x:it>0?it:100,y:de*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),pe.map((H,de)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:Y}=at(H),ie=de*a+(a-18)/2,ke=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsxRuntime.jsx(bi,{task:H,x:N+Y/2,y:ie+12,theme:t,onClick:d},H.id);if(ke){let V=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ae=8,Ve=ie+(a-18)/2+(18-ae)/2,De=4,Ue=H.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Ke=H.startDate&&Ne>=H.startDate,bt=H.endDate&&(()=>{let gt=new Date(H.endDate);return gt.setHours(0,0,0,0),Ne>gt})(),lt=H.startDate&&Ne<H.startDate,nt=1;if(Ke&&H.startDate&&H.endDate&&!lt){let gt=new Date(H.startDate);gt.setHours(0,0,0,0);let Pt=new Date(H.endDate);Pt.setHours(0,0,0,0);let Ge=Math.max(1,(Pt.getTime()-gt.getTime())/(1e3*60*60*24)),ut=Math.min((Ne.getTime()-gt.getTime())/(1e3*60*60*24),Ge)/Ge*100;nt=ut>0?Ue/ut:1;}let et;Ue>=100?et="#00E5CC":lt?et="#4B5563":bt&&Ue<100?et="#EF4444":nt>=.95?et="#22C55E":nt>=.8?et="#F59E0B":et="#EF4444";let At=Math.max(Ue/100*Y,Ue>0?De*2:0),Mt=Y>100&&Ue>0,mt=H.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(H),onContextMenu:gt=>{gt.preventDefault(),gt.stopPropagation(),g?.(H,gt);},onMouseMove:gt=>{U({task:H,x:N,y:Ve,width:Y,height:ae,showBelow:Ve<100,mouseX:gt.clientX,mouseY:gt.clientY});},onMouseLeave:()=>U(null),style:{cursor:"default",opacity:y?mt?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:N,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:N,y:Ve,width:Y,height:ae,rx:De,fill:V?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ue>0&&jsxRuntime.jsx("rect",{x:N,y:Ve,width:At,height:ae,rx:De,fill:et}),y&&mt&&jsxRuntime.jsx("rect",{x:N,y:Ve,width:Y,height:ae,rx:De,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Mt&&jsxRuntime.jsxs("text",{x:N+At+6,y:Ve+ae/2,dominantBaseline:"central",fill:V?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Ue),"%"]})]},H.id)}return jsxRuntime.jsx(ui,{task:H,x:N,y:ie,width:Y,theme:t,dayWidth:ee*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:b,onDependencyCreate:h,allTaskPositions:pt,onDragMove:Et,onHoverChange:U,showBaseline:f,showTaskBarLabels:p,showCriticalPath:y,readOnly:C?!C(H):false},H.id)}),w&&pe.map((H,de)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let Y=pe.find(et=>et.id===N);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=pe.findIndex(et=>et.id===N),ke=Ce(Y.id,at(Y)),V=Ce(H.id,at(H)),ae=ke.x+ke.width,Ve=ie*a+26,De=V.x,Ue=de*a+26,Ne=`dep-${N}-${H.id}`;if(He.has(Ne))return null;let Ke=y&&H.isCriticalPath&&Y.isCriticalPath;return jsxRuntime.jsx(Qn,{x1:ae,y1:Ve,x2:De,y2:Ue,theme:t,lineStyle:l,colorOverride:y?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.(H.id,N),onHoverChange:et=>{Z.current=et,et&&X({key:Ne,fromId:N,toId:H.id,exitX:ae,exitY:Ve,enterX:De,enterY:Ue});}},Ne)})),I.map(H=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsxRuntime.jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),w&&L&&jsxRuntime.jsx(Qn,{x1:L.exitX,y1:L.exitY,x2:L.enterX,y2:L.enterY,theme:t,lineStyle:l,onDelete:()=>{let H=L.key;X(null),Z.current=false,O(de=>new Set(de).add(H)),v?.(L.toId,L.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Z.current=H,H||X(null);}},`${L.key}-hover-overlay`),it>=0&&it<=Ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:it,y1:0,x2:it,y2:Ze,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:it,y1:0,x2:it,y2:Ze,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsxRuntime.jsx(am,{tooltipData:E,theme:t,locale:i==="es"?"es":"en"})]})}var vv=['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"'],nm=({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"})}),wv=()=>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"})}),kv=()=>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"})}),Cv=()=>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"})}),Tv=()=>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 wi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=react.useState(false),[d,m]=react.useState(false),[g,b]=react.useState([]),[h,v]=react.useState(""),[f,y]=react.useState(false),[w,x]=react.useState(true),[C,k]=react.useState(""),[D,T]=react.useState(-1),[I,$]=react.useState(false),[A,_]=react.useState(0),E=react.useRef(null),me=react.useRef(null),L=react.useRef(null),X=react.useRef(null),{enabled:Z=true,placeholder:He='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:O="bottom-right",onCommand:j,suggestions:he=vv,maxHistory:je=50,persistHistory:U,mentionableUsers:re=[]}=a,ee=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ee=ee?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",we=ee?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Be=ee?"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)",ze=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Qe=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",te=ee?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",tt=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=ee?"rgba(46, 148, 255, 0.9)":"#2E94FF",at=ee?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",pt=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Et=ee?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=ee?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",rt=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",it=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Ze=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=ee?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",de=ee?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=ee?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=ee?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=ee?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",ke="rgba(46, 148, 255, 0.04)",V=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ae=ee?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ve=ee?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",De=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=ee?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=ee?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=ee?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",bt=ee?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",lt="rgba(46, 148, 255, 0.06)",nt=ee?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",At=ee?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Mt=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",mt=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",yt=ee?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gt=ee?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Pt=ee?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ge=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Re=ee?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ut=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",le=ee?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=ee?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",P=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=U?.storageKey||"gantt-ai-history",ce=U?.maxMessages??5,Se=re.filter(B=>{if(!C)return true;let z=C.toLowerCase();return B.name.toLowerCase().includes(z)||B.email&&B.email.toLowerCase().includes(z)}).slice(0,5),Xe=react.useCallback(B=>{if(v(B),re.length===0)return;let z=E.current;if(!z)return;let ne=z.selectionStart||B.length,S=B.slice(0,ne),oe=S.lastIndexOf("@");if(oe>=0&&((oe>0?S[oe-1]:" ")===" "||oe===0)){let We=S.slice(oe+1);if(We.length<=40){k(We),T(oe),$(true),_(0);return}}$(false),k(""),T(-1);},[re.length]),_e=react.useCallback(B=>{let z=h.slice(0,D),ne=h.slice(D+1+C.length),S=`${z}@${B.name} ${ne}`;v(S),$(false),k(""),T(-1),setTimeout(()=>E.current?.focus(),0);},[h,D,C]),Ie=react.useCallback(B=>{if(!I||Se.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),_(z=>z<Se.length-1?z+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),_(z=>z>0?z-1:Se.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let z=Se[A];return z&&_e(z),true}return B.key==="Escape"?($(false),true):false},[I,Se,A,_e]);react.useEffect(()=>{if(U?.enabled)try{let B=localStorage.getItem(q);if(B){let ne=JSON.parse(B).map(S=>({...S,timestamp:new Date(S.timestamp)}));b(ne.slice(-ce));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[U?.enabled,q,ce]),react.useEffect(()=>{if(U?.enabled&&g.length>0)try{let B=g.filter(z=>!z.isLoading).slice(-ce);localStorage.setItem(q,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[g,U?.enabled,q,ce]),react.useEffect(()=>{me.current&&me.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{l&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[l,d]);let M=react.useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[o,s,n,i,c]),J=react.useCallback(async B=>{if(!B.trim()||f)return;let z={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};b(S=>[...S.slice(-(je-1)),z]),v(""),x(false),y(true);let ne={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(S=>[...S,ne]);try{if(j){let S=await j(B,e);b(oe=>{let Te=oe.filter(Tt=>!Tt.isLoading),We={id:`assistant-${Date.now()}`,role:"assistant",content:S.message,timestamp:new Date,command:S};return [...Te,We]}),M(S);}else b(S=>[...S.filter(Te=>!Te.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(S){b(oe=>[...oe.filter(We=>!We.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[f,je,j,e,M]),ye=B=>{B.preventDefault(),J(h);},Le=B=>{v(B),E.current?.focus();};if(react.useEffect(()=>{let B=z=>{(z.metaKey||z.ctrlKey)&&z.key==="k"&&(z.preventDefault(),p(ne=>!ne),l||m(false)),z.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),react.useEffect(()=>{if(!l)return;let B=ne=>{let S=ne.target;L.current&&!L.current.contains(S)&&p(false);},z=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(z),document.removeEventListener("mousedown",B);}},[l]),!Z)return null;let Oe={"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(Ht,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Oe[O]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ee,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${we}`,color:"#2E94FF",cursor:"pointer",boxShadow:Be,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${ze}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(nm,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:pe,background:te,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${tt}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
361
+ </Project>`,p=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Pe.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Pe.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let b=t.find(h=>h.id===g);if(b){o(b);let h=r.get(g)?.ef||0;d=Math.max(d,h);}}let m=d+p;r.set(l.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let p=l.startDate&&l.endDate?Pe.calculateDuration(l.startDate,l.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(l.id)),m=s;if(d.length>0)for(let b of d){i(b);let h=n.get(b.id)?.ls||0;m=Math.min(m,h);}let g=m-p;n.set(l.id,{ls:g,lf:m});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),d=n.get(l.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Pe.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 b=s.get(g);b&&b.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 i=new Map,c=[],l=[];for(let m of r)(n.get(m.id)||0)===0&&l.push(m.id);for(;l.length>0;){let m=l.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let b=Pe.calculateDuration(g.startDate,g.endDate),h=0;if(g.dependencies)for(let f of g.dependencies){let y=i.get(f);y&&(h=Math.max(h,y.ef));}i.set(m,{es:h,ef:h+b});let v=s.get(m)||[];for(let f of v){let y=(n.get(f)||1)-1;n.set(f,y),y===0&&l.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let b=o.get(g);if(!b||!b.startDate||!b.endDate)continue;let h=Pe.calculateDuration(b.startDate,b.endDate),v=s.get(g)||[],f=p;if(v.length>0)for(let y of v){let w=d.get(y);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-h,lf:f});}for(let m of c){let g=i.get(m),b=d.get(m),h=b.ls-g.es,v=s.get(m)||[],f;v.length>0?f=Math.min(...v.map(y=>i.get(y).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:b.ls,lateFinish:b.lf,totalFloat:Math.round(h*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:h<=.01});}return t},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let i=Pe.getLatestEndDate(e);if(!i)return null;let c=Pe.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.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=Pe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Pe.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=Pe.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),b=new Date(g);b.setDate(b.getDate()+1),p<b&&(p=b);}let d=Pe.calculateEndDate(p,l),m=g=>g.map(b=>b.id===c.id?{...b,startDate:p,endDate:d}:b.subtasks?{...b,subtasks:m(b.subtasks)}:b);i=m(i),i=Pe.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),p=1e3*60*60*24,d=Pe.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,b,h=new Set)=>{if(h.has(g))return;h.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let y=r.findIndex(P=>P.id===f.id);if(y===-1)continue;let w=f.startDate.getTime(),N=(f.endDate.getTime()-w)/p,S=(w-l)/p*s,C=S+b*s,I=Math.max(N*s,s),$=i+y*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:S,previewX:C,width:I,y:$,rowIndex:y,daysDelta:b,color:f.color}),m(f.id,b,h);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Pe.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 i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=p=>p.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function vi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:b,onDependencyCreate:h,onDependencyDelete:v,showBaseline:f,showCriticalPath:y=true,showDependencies:w=true,highlightWeekends:x=true,canEditTask:N}){let S=Mr(),C=react.useRef(null),[I,$]=react.useState([]),[P,te]=react.useState(null),[O,H]=react.useState(null),[F,J]=react.useState(null),ee=react.useRef(false),[Re,B]=react.useState(new Set),[Y,ye]=react.useState(null),Ge=react.useCallback(z=>{if(F&&!ee.current){let ne=z.target,D=false;for(;ne&&ne!==z.currentTarget;){if(ne.getAttribute?.("data-dependency-line")==="true"||ne.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}ne=ne.parentElement;}D||J(null);}},[F]),U=react.useCallback(z=>{H(z);},[]),oe=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Z=r==="day"?60:r==="week"?20:8,Se=oe*Z*n,ke=z=>{let ne=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),D=ne.getUTCDay()||7;ne.setUTCDate(ne.getUTCDate()+4-D);let q=new Date(Date.UTC(ne.getUTCFullYear(),0,1));return Math.ceil(((ne.getTime()-q.getTime())/864e5+1)/7)},Ie=z=>{let ne=z.getDay();return ne===0||ne===6},He=react.useCallback(z=>{let ne=Math.round(z/(Z*n)),D=new Date(o);return D.setDate(D.getDate()+ne),D},[o,Z,n]),et=react.useCallback((z,ne)=>{if(ne.startDate&&ne.endDate)return;let D=z.currentTarget.ownerSVGElement;if(!D)return;let q=D.createSVGPoint();q.x=z.clientX,q.y=z.clientY;let ce=q.matrixTransform(D.getScreenCTM()?.inverse()),Te=He(ce.x),W=new Date(Te);W.setDate(W.getDate()+1),ye(null),b?.(ne,Te,W);},[He,b]),ae=react.useCallback((z,ne,D)=>{let q=z.currentTarget.ownerSVGElement;if(!q)return;let ce=q.createSVGPoint();ce.x=z.clientX,ce.y=z.clientY;let Te=ce.matrixTransform(q.getScreenCTM()?.inverse()),W=He(Te.x),Ue=Math.round(Te.x/(Z*n))*Z*n;ye({taskId:ne.id,x:Ue,y:D*a+a/2,date:W});},[He,Z,n,a]),Xe=react.useCallback(()=>{ye(null);},[]),pe=react.useMemo(()=>{let z=ce=>ce.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let W=z(Te.subtasks),re=W.filter(Ue=>Ue.startDate&&Ue.endDate);if(re.length>0){let Ue=re.map(Ke=>Ke.startDate.getTime()),Ne=re.map(Ke=>Ke.endDate.getTime()),ze=new Date(Math.min(...Ue)),Fe=new Date(Math.max(...Ne));return {...Te,subtasks:W,startDate:ze,endDate:Fe}}return {...Te,subtasks:W}}return Te}),ne=(ce,Te=[])=>{let W=[...ce].sort((re,Ue)=>(re.position??0)-(Ue.position??0));for(let re of W)Te.push(re),re.subtasks&&re.subtasks.length>0&&(re.isExpanded===void 0||re.isExpanded)&&ne(re.subtasks,Te);return Te},D=z(e);return ne(D)},[e]),at=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let ne=z.startDate.getTime(),D=z.endDate.getTime(),q=o.getTime(),ce=(ne-q)/(1e3*60*60*24),Te=(D-ne)/(1e3*60*60*24)+1,W=ce*Z*n,re=Math.max(Z*n,40),Ue=Math.max(Te*Z*n,re);return {x:W,width:Ue}},[o,Z,n]),mt=react.useMemo(()=>pe.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:ne,width:D}=at(z),ce=pe.findIndex(Te=>Te.id===z.id)*a+(a-18)/2;return {id:z.id,x:ne,y:ce,width:D,height:18}}),[pe,at]),Pt=react.useCallback((z,ne,D)=>{if(!D){$([]),te(null);return}if(te({taskId:z,daysDelta:ne}),ne===0){$([]);return}let q=Pe.calculateCascadePreview(e,z,ne,pe,o,Z*n,a,48);$(q);},[e,pe,o,Z,n,a,48]),Ce=react.useCallback((z,ne)=>{if(!P)return ne;let D=Z*n,q=P.daysDelta*D;if(z===P.taskId)return {x:ne.x+q,width:ne.width};let ce=I.find(Te=>Te.taskId===z);return ce?{x:ce.previewX,width:ce.width}:ne},[P,I,Z,n]),yt=react.useMemo(()=>{let z=[],ne=new Date(o);for(;ne<=s;){let ce=(ne.getTime()-o.getTime())/864e5*Z*n;if(r==="day")z.push({date:new Date(ne),label:ne.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ce}),ne.setDate(ne.getDate()+1);else if(r==="week"){let Te=ke(ne);z.push({date:new Date(ne),label:`${S.labels.week} ${Te}`,x:ce}),ne.setDate(ne.getDate()+7);}else z.push({date:new Date(ne),label:ne.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ce}),ne.setMonth(ne.getMonth()+1);}return z},[o,s,r,Z,n,i,S.labels.week]),nt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Z*n,[o,Z,n]),Je=Math.max(pe.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(Se,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Se,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),yt.map((z,ne)=>jsxRuntime.jsxs("g",{children:[ne>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${ne}`)),nt>=0&&nt<=Se&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:nt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:nt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${nt-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:S.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:C,width:Math.max(Se,1e3),height:Je,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ge,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(Se,1e3),height:Je,fill:t.bgPrimary}),pe.map((z,ne)=>jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Math.max(Se,1e3),height:a,fill:ne%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${z.id}`)),yt.map((z,ne)=>ne>0?jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ne}`):null),x&&yt.map((z,ne)=>{let D=yt[ne+1]?.x||Se;return Ie(z.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:z.x,y:0,width:D-z.x,height:pe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:z.x,y:0,width:D-z.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ne}`):null}),pe.map((z,ne)=>{let D=z.startDate&&z.endDate;return jsxRuntime.jsx("g",{children:!D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Se,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>et(q,z),onMouseMove:q=>ae(q,z,ne),onMouseLeave:()=>{Xe();}},`clickable-${z.id}`),Y&&Y.taskId===z.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:Y.x,y1:ne*a+4,x2:Y.x,y2:ne*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${Y.x}, ${ne*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:Y.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Y||Y.taskId!==z.id)&&jsxRuntime.jsx("text",{x:nt>0?nt:100,y:ne*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:S.labels.clickToSetDates},`placeholder-${z.id}`)]})},`row-group-${z.id}`)}),pe.map((z,ne)=>{if(!z.startDate||!z.endDate)return null;let{x:D,width:q}=at(z),ce=ne*a+(a-18)/2,Te=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;if(z.isMilestone)return jsxRuntime.jsx(yi,{task:z,x:D+q/2,y:ce+12,theme:t,onClick:d},z.id);if(Te){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),re=8,Ue=ce+(a-18)/2+(18-re)/2,Ne=4,ze=z.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ke=z.startDate&&Fe>=z.startDate,lt=z.endDate&&(()=>{let rt=new Date(z.endDate);return rt.setHours(0,0,0,0),Fe>rt})(),ut=z.startDate&&Fe<z.startDate,st=1;if(Ke&&z.startDate&&z.endDate&&!ut){let rt=new Date(z.startDate);rt.setHours(0,0,0,0);let Lt=new Date(z.endDate);Lt.setHours(0,0,0,0);let We=Math.max(1,(Lt.getTime()-rt.getTime())/(1e3*60*60*24)),pt=Math.min((Fe.getTime()-rt.getTime())/(1e3*60*60*24),We)/We*100;st=pt>0?ze/pt:1;}let Ze;ze>=100?Ze="#00E5CC":ut?Ze="#4B5563":lt&&ze<100?Ze="#EF4444":st>=.95?Ze="#22C55E":st>=.8?Ze="#F59E0B":Ze="#EF4444";let zt=Math.max(ze/100*q,ze>0?Ne*2:0),Ct=q>100&&ze>0,ht=z.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(z),onContextMenu:rt=>{rt.preventDefault(),rt.stopPropagation(),g?.(z,rt);},onMouseMove:rt=>{U({task:z,x:D,y:Ue,width:q,height:re,showBelow:Ue<100,mouseX:rt.clientX,mouseY:rt.clientY});},onMouseLeave:()=>U(null),style:{cursor:"default",opacity:y?ht?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:D,y:ce,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:D,y:Ue,width:q,height:re,rx:Ne,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),ze>0&&jsxRuntime.jsx("rect",{x:D,y:Ue,width:zt,height:re,rx:Ne,fill:Ze}),y&&ht&&jsxRuntime.jsx("rect",{x:D,y:Ue,width:q,height:re,rx:Ne,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ct&&jsxRuntime.jsxs("text",{x:D+zt+6,y:Ue+re/2,dominantBaseline:"central",fill:W?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(ze),"%"]})]},z.id)}return jsxRuntime.jsx(mi,{task:z,x:D,y:ce,width:q,theme:t,dayWidth:Z*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:b,onDependencyCreate:h,allTaskPositions:mt,onDragMove:Pt,onHoverChange:U,showBaseline:f,showTaskBarLabels:p,showCriticalPath:y,readOnly:N?!N(z):false},z.id)}),w&&pe.map((z,ne)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(D=>{let q=pe.find(Ze=>Ze.id===D);if(!q||!q.startDate||!q.endDate)return null;let ce=pe.findIndex(Ze=>Ze.id===D),Te=Ce(q.id,at(q)),W=Ce(z.id,at(z)),re=Te.x+Te.width,Ue=ce*a+26,Ne=W.x,ze=ne*a+26,Fe=`dep-${D}-${z.id}`;if(Re.has(Fe))return null;let Ke=y&&z.isCriticalPath&&q.isCriticalPath;return jsxRuntime.jsx(Zn,{x1:re,y1:Ue,x2:Ne,y2:ze,theme:t,lineStyle:l,colorOverride:y?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.(z.id,D),onHoverChange:Ze=>{ee.current=Ze,Ze&&J({key:Fe,fromId:D,toId:z.id,exitX:re,exitY:Ue,enterX:Ne,enterY:ze});}},Fe)})),I.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:18,rx:6,fill:z.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),w&&F&&jsxRuntime.jsx(Zn,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:l,onDelete:()=>{let z=F.key;J(null),ee.current=false,B(ne=>new Set(ne).add(z)),v?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:z=>{ee.current=z,z||J(null);}},`${F.key}-hover-overlay`),nt>=0&&nt<=Se&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:nt,y1:0,x2:nt,y2:Je,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:nt,y1:0,x2:nt,y2:Je,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsxRuntime.jsx(rm,{tooltipData:O,theme:t,locale:i==="es"?"es":"en"})]})}var wv=['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"'],sm=({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"})}),kv=()=>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"})}),Cv=()=>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"})}),Tv=()=>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"})}),Nv=()=>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 Ci({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=react.useState(false),[d,m]=react.useState(false),[g,b]=react.useState([]),[h,v]=react.useState(""),[f,y]=react.useState(false),[w,x]=react.useState(true),[N,k]=react.useState(""),[S,C]=react.useState(-1),[I,$]=react.useState(false),[P,te]=react.useState(0),O=react.useRef(null),H=react.useRef(null),F=react.useRef(null),J=react.useRef(null),{enabled:ee=true,placeholder:Re='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:Y,suggestions:ye=wv,maxHistory:Ge=50,persistHistory:U,mentionableUsers:oe=[]}=a,Z=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Se=Z?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ke=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ie=Z?"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)",He=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",et=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=Z?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Xe=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=Z?"rgba(46, 148, 255, 0.9)":"#2E94FF",at=Z?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Pt=Z?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=Z?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",yt=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",nt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Je=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",z=Z?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ne=Z?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=Z?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",q=Z?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ce=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",W=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",re=Z?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=Z?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ne=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",ze=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Fe=Z?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=Z?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=Z?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ut="rgba(46, 148, 255, 0.06)",st=Z?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ze=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",zt=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ct=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",ht=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",wt=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",rt=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Lt=Z?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",We=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Be=Z?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",pt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ie=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",be=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",A=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",X=U?.storageKey||"gantt-ai-history",me=U?.maxMessages??5,Ee=oe.filter(L=>{if(!N)return true;let G=N.toLowerCase();return L.name.toLowerCase().includes(G)||L.email&&L.email.toLowerCase().includes(G)}).slice(0,5),Ye=react.useCallback(L=>{if(v(L),oe.length===0)return;let G=O.current;if(!G)return;let de=G.selectionStart||L.length,T=L.slice(0,de),j=T.lastIndexOf("@");if(j>=0&&((j>0?T[j-1]:" ")===" "||j===0)){let Le=T.slice(j+1);if(Le.length<=40){k(Le),C(j),$(true),te(0);return}}$(false),k(""),C(-1);},[oe.length]),Ve=react.useCallback(L=>{let G=h.slice(0,S),de=h.slice(S+1+N.length),T=`${G}@${L.name} ${de}`;v(T),$(false),k(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[h,S,N]),Oe=react.useCallback(L=>{if(!I||Ee.length===0)return false;if(L.key==="ArrowDown")return L.preventDefault(),te(G=>G<Ee.length-1?G+1:0),true;if(L.key==="ArrowUp")return L.preventDefault(),te(G=>G>0?G-1:Ee.length-1),true;if(L.key==="Enter"||L.key==="Tab"){L.preventDefault();let G=Ee[P];return G&&Ve(G),true}return L.key==="Escape"?($(false),true):false},[I,Ee,P,Ve]);react.useEffect(()=>{if(U?.enabled)try{let L=localStorage.getItem(X);if(L){let de=JSON.parse(L).map(T=>({...T,timestamp:new Date(T.timestamp)}));b(de.slice(-me));}}catch(L){console.warn("[GanttAIAssistant] Failed to load persisted history:",L);}},[U?.enabled,X,me]),react.useEffect(()=>{if(U?.enabled&&g.length>0)try{let L=g.filter(G=>!G.isLoading).slice(-me);localStorage.setItem(X,JSON.stringify(L));}catch(L){console.warn("[GanttAIAssistant] Failed to persist history:",L);}},[g,U?.enabled,X,me]),react.useEffect(()=>{H.current&&H.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{l&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,d]);let bt=react.useCallback(L=>{if(L.success)switch(L.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":L.taskId&&L.updates&&o?.(L.taskId,L.updates);break;case "create_task":L.newTask&&s?.(L.newTask);break;case "delete_task":L.taskId&&n?.(L.taskId);break;case "link_tasks":L.dependencyFrom&&L.dependencyTo&&i?.(L.dependencyFrom,L.dependencyTo);break;case "unlink_tasks":L.taskId&&L.dependencyFrom&&c?.(L.taskId,L.dependencyFrom);break}},[o,s,n,i,c]),gt=react.useCallback(async L=>{if(!L.trim()||f)return;let G={id:`user-${Date.now()}`,role:"user",content:L,timestamp:new Date};b(T=>[...T.slice(-(Ge-1)),G]),v(""),x(false),y(true);let de={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(T=>[...T,de]);try{if(Y){let T=await Y(L,e);b(j=>{let xe=j.filter(Qe=>!Qe.isLoading),Le={id:`assistant-${Date.now()}`,role:"assistant",content:T.message,timestamp:new Date,command:T};return [...xe,Le]}),bt(T);}else b(T=>[...T.filter(xe=>!xe.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){b(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{y(false);}},[f,Ge,Y,e,bt]),M=L=>{L.preventDefault(),gt(h);},le=L=>{v(L),O.current?.focus();};if(react.useEffect(()=>{let L=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),p(de=>!de),l||m(false)),G.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[l]),react.useEffect(()=>{if(!l)return;let L=de=>{let T=de.target;F.current&&!F.current.contains(T)&&p(false);},G=setTimeout(()=>{document.addEventListener("mousedown",L);},100);return ()=>{clearTimeout(G),document.removeEventListener("mousedown",L);}},[l]),!ee)return null;let fe={"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(Wt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${fe[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Se,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ke}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ie,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${et}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(sm,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:pe,background:ae,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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Oe[O]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${pt}`,boxShadow:Et},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${rt}`},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:it,border:`1px solid ${Ze}`,color:"#2E94FF"},children:jsxRuntime.jsx(nm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:B=>{B.currentTarget.style.background=Y,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=de;},children:jsxRuntime.jsx(Cv,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:B=>{B.currentTarget.style.background=Y,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=de;},children:jsxRuntime.jsx(kv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((B,z)=>jsxRuntime.jsx("button",{onClick:()=>Le(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:ke,color:ae,border:`1px solid ${V}`},onMouseEnter:ne=>{ne.currentTarget.style.borderColor=Ve,ne.currentTarget.style.color="#2E94FF";},onMouseLeave:ne=>{ne.currentTarget.style.borderColor=V,ne.currentTarget.style.color=ae;},children:B.length>30?B.slice(0,30)+"...":B},z))})]}),g.map(B=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?De:Ne,color:B.role==="user"?"#2E94FF":bt,border:B.role==="user"?`1px solid ${Ue}`:`1px solid ${Ke}`},children:[B.isLoading?jsxRuntime.jsx(Tv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsxRuntime.jsx("div",{ref:me})]}),jsxRuntime.jsxs("form",{onSubmit:B=>{if(I&&Se.length>0){B.preventDefault();return}ye(B);},className:"p-3 relative",style:{borderTop:`1px solid ${lt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&Se.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:X,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:Pt,border:`1px solid ${Ge}`,boxShadow:Re,backdropFilter:"blur(12px)"},children:Se.map((B,z)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>_e(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:z===A?ut:"transparent",color:le},onMouseEnter:()=>_(z),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:P,border:`1px solid ${K}`,color:"#2E94FF"},children:B.name.split(" ").map(ne=>ne[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:fe},children:B.email})]})]},B.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${et}`},children:[jsxRuntime.jsx("input",{ref:E,type:"text",value:h,onChange:B=>Xe(B.target.value),onKeyDown:B=>{Ie(B);},placeholder:He,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:At,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!h.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:h.trim()?Mt:"transparent",color:h.trim()?"#2E94FF":yt,border:h.trim()?`1px solid ${mt}`:"1px solid transparent"},children:jsxRuntime.jsx(wv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function sm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,p=true)=>{r(d=>{let m=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function im({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ev={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.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=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function lm(e){return {...Ev,...e}}var Rv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},um=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:b,persistFilter:h,clearFiltersKey:v,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:x=false,createTaskLabel:C,onCreateTask:k,taskFilter:D,onTaskFilterChange:T,toolbarRightContent:I,showBaseline:$,viewMode:A,onViewModeChange:_,projectForecast:E,onThemeChange:me,onTaskClick:L,onTaskDblClick:X,onTaskContextMenu:Z,onTaskUpdate:He,onDependentTasksScheduled:O,onProgressChange:j,onTaskEdit:he,onTaskAddSubtask:je,onTaskMarkIncomplete:U,onTaskSetInProgress:re,onDependencyCreate:ee,onDependencyDelete:Ee,onBeforeTaskAdd:we,onAfterTaskAdd:Be,onBeforeTaskUpdate:ze,onAfterTaskUpdate:Qe,onBeforeTaskDelete:te,onAfterTaskDelete:tt,permissions:pe,onCopySnapshotLink:at}=a,Et=react.useContext(Zs)?.theme,[Ce,rt]=react.useState(Et||s||"dark"),[it,Ze]=react.useState(n),[H,de]=react.useState(i),[N,Y]=react.useState(1),[ie,ke]=react.useState("all"),[V,ae]=react.useState(A||"execution"),Ve=A??V,De=react.useCallback(F=>{ae(F),_?.(F);},[_]),Ue=$??Ve==="oracle",[Ne,Ke]=react.useState(a.showCriticalPath!==false),[bt,lt]=react.useState(a.showDependencies!==false),[nt,et]=react.useState(a.highlightWeekends!==false),At=react.useCallback(F=>{Ke(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Mt=react.useCallback(F=>{lt(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),mt=react.useCallback(F=>{et(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(it);},[it]),react.useEffect(()=>{a.onZoomChange?.(N);},[N]);let yt=react.useRef(a.onDateRangeChange);yt.current=a.onDateRangeChange;let gt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Pt,Ge]=react.useState(()=>{if(!h)return "all";try{let F=typeof h=="string"?h:"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"}),Re=D??Pt,ut=T??Ge,[le,fe]=react.useState(()=>{if(!h)return false;try{let F=typeof h=="string"?h:"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=gt();if(F)try{let R={taskFilter:Re,hideCompleted:le};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Re,le,gt]);let P=react.useRef(v);react.useEffect(()=>{if(P.current!==v&&v!==void 0){Ge("all"),fe(false);let F=gt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}P.current=v;},[v,gt]);let[K,q]=react.useState(0),[ce,Se]=react.useState(false),[Xe,_e]=react.useState(null),[Ie,M]=react.useState({isOpen:false,x:0,y:0,task:null}),[J,ye]=react.useState(null),[Le,Oe]=react.useState(null);react.useEffect(()=>{Et&&Et!==Ce&&rt(Et);},[Et]),react.useEffect(()=>{s&&s!==Ce&&rt(s);},[s]);let B=react.useCallback(F=>{rt(F),me?.(F);},[me]),{state:z,setState:ne,undo:S,redo:oe,canUndo:Te,canRedo:We,clearHistory:Tt}=sm(t,50),Nt=react.useMemo(()=>{let F=(R,G=0)=>{let Q=G;for(let xe of R)xe.subtasks?.length&&(Q=Math.max(Q,F(xe.subtasks,G+1)));return Q};return F(z)+1},[z]),la=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),aa=react.useRef(new Map),ya=react.useRef(false);if(!ya.current&&b){ya.current=true;let F=typeof b=="string"?b:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let G=JSON.parse(R);Array.isArray(G)&&(aa.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ut=react.useCallback(()=>{let F=la();if(F)try{let R=Array.from(aa.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[la]),ua=react.useRef(0),Mn=react.useRef(z);react.useEffect(()=>{Mn.current=z;},[z]);let Ko=react.useRef(false),Fc=react.useCallback(F=>{ke(F),ua.current+=1,ne(R=>{let G=(xe,Me=0)=>xe.map(xt=>{let ot=F==="all"||Me<F-1;return xt.subtasks?.length&&aa.current.set(xt.id,ot),{...xt,isExpanded:ot,subtasks:xt.subtasks?G(xt.subtasks,Me+1):void 0}}),Q=G(R);return Ut(),Q});},[ne,Ut]);react.useEffect(()=>{if(ua.current>0){ua.current-=1;return}let F=G=>{let Q=new Map;for(let xe of G){let Me=xe.id;Q.get(Me)||Q.set(Me,xe);}return Array.from(Q.values())},R=G=>G.map(Q=>{let xe=aa.current.get(Q.id),Me=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Me.subtasks?.length){let xt=F(Me.subtasks);return {...Me,subtasks:R(xt)}}return Me});if(aa.current.size>0)ne(yr(R(t)));else {let G=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:F(G(xe.subtasks))}:xe);ne(yr(G(t)));}},[t,ne]);let ys=react.useRef(t),Mc=react.useRef(true);react.useEffect(()=>{if(Mc.current){Mc.current=false,ys.current=z;return}if(Ko.current){Ko.current=false,ys.current=z;return}if(!r)return;let F=JSON.stringify(ys.current),R=JSON.stringify(z);F!==R&&(ys.current=z,r(z));},[z,r]);let ja=react.useMemo(()=>id(y,w),[y,w]),V0=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}],[]),[Yo,Xi]=react.useState(()=>V0(ja));react.useEffect(()=>{Xi(F=>F.map(R=>({...R,label:ja.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ja]);let xs=react.useMemo(()=>Yo.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[Yo]),Pc=react.useRef(Yo.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Yo.filter(Q=>Q.visible),R=F.map(Q=>Q.id).join(","),G=Pc.current;if(R!==G){let Q=F.some(Me=>Me.id!=="name"),xe=G.includes(",");Q?!xe&&Q&&_e(null):_e(null),Pc.current=R;}},[Yo]);let Ac=60,Lc=.6,G0=react.useMemo(()=>{let R=xs+Ac,G=typeof window<"u"?window.innerWidth*Lc:800,Q=Math.max(R,G);return Xe!==null?Math.max(200,Math.min(Xe,Q)):Math.max(200,R)},[Xe,xs]),ro=react.useRef(null),vs=react.useRef(null),Br=react.useRef(null),Pn=react.useRef(null),ea=react.useMemo(()=>Fp(Ce),[Ce]),_0=react.useMemo(()=>({theme:ea,themeName:Ce}),[ea,Ce]),Ic=react.useMemo(()=>lm(m),[m]),Ji=react.useMemo(()=>{if(!g)return z;let F=Pe.calculateCriticalPathFull(z),R=G=>G.map(Q=>{let xe=F.get(Q.id),Me=Q.subtasks?R(Q.subtasks):void 0,xt=Me?.some(pa=>pa.isCriticalPath||pa.subtasks&&pa.subtasks.some($t=>$t.isCriticalPath))||false,ot=xe?xe.isCritical:xt;return {...Q,isCriticalPath:ot,cpmData:xe||void 0,subtasks:Me}});return R(z)},[z,g]),j0=react.useMemo(()=>Pe.flattenTasks(z).some(R=>R.dependencies&&R.dependencies.length>0),[z]),Bc=react.useMemo(()=>{if(Re==="all"&&!le)return Ji;let F=R=>{let G=[];for(let Q of R){let xe=Q.subtasks?.length?F(Q.subtasks):void 0,Me=false;if(le)Me=Q.progress<100;else switch(Re){case "all":Me=true;break;case "incomplete":Me=Q.progress<100;break;case "in_progress":Me=Q.progress>0&&Q.progress<100;break;case "completed":Me=Q.progress===100;break}(Me||xe&&xe.length>0)&&G.push({...Q,subtasks:xe});}return G};return F(Ji)},[Ji,Re,le]),ws=Rv(H);im({undo:S,redo:oe,canUndo:Te,canRedo:We,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>Pe.findTaskById(z,F),addTask:(F,R)=>{ne(G=>{if(!R)return [...G,{...F,level:0}];let Q=xe=>xe.map(Me=>Me.id===R?{...Me,subtasks:[...Me.subtasks||[],{...F,parentId:R,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(G)});},updateTask:(F,R)=>{ne(G=>{let Q=xe=>xe.map(Me=>Me.id===F?{...Me,...R}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(G)});},deleteTask:F=>{ne(R=>{let G=Q=>Q.filter(xe=>xe.id===F?false:(xe.subtasks&&(xe.subtasks=G(xe.subtasks)),true));return G(R)});},deleteTasks:F=>{ne(R=>gd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Pe.findTaskById(z,F);R&&a.onTaskDuplicate(R);}else ne(R=>Xn(R,[F]).tasks);},splitTask:(F,R,G=3)=>{ne(Q=>Pe.splitTask(Q,F,R,G));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(F,R)=>!Pe.validateDependencies(z,F,R),getAllTasks:()=>Pe.flattenTasks(z),getTasksByStatus:F=>Pe.flattenTasks(z).filter(R=>R.status===F),getTasksByParent:F=>F?Pe.findTaskById(z,F)?.subtasks||[]:z.filter(G=>!G.parentId),getCriticalPath:()=>Pe.flattenTasks(z).filter(F=>F.isCriticalPath),indentTask:F=>{ne(R=>yr(ud(R,[F])));},outdentTask:F=>{ne(R=>yr(pd(R,[F])));},moveTask:(F,R)=>{ne(G=>md(G,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:G}=hd(z,F);if(we){let Q=we({...G,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}ne(yr(R)),Be&&Be({...G,parentId:F});},scrollToTask:F=>{let G=Pe.flattenTasks(z).findIndex(Q=>Q.id===F);if(G!==-1&&ro.current){let Q=G*ws;ro.current.scrollTo({top:Q,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{ne(R=>{let G=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe);return G(R)});},collapseTask:F=>{ne(R=>{let G=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe);return G(R)});},expandAll:()=>{ne(F=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{ne(F=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Fc(F);},undo:S,redo:oe,canUndo:()=>Te,canRedo:()=>We,clearHistory:Tt,exportToPNG:async()=>{if(!Pn.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let F=Pn.current,R=ro.current,G=vs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=G?.scrollTop||0,Me=Q.scrollTop,xt=F.style.overflow,ot=F.style.height,pa=R.style.overflow;try{let $t=G?.querySelector(".gantt-taskgrid-content"),Jt=Q.querySelector("svg"),_a=$t?.scrollHeight||G?.scrollHeight||600,lr=Jt?.getBoundingClientRect().height||Q.scrollHeight,So=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(_a,lr)+20;G&&(G.scrollTop=0),Q.scrollTop=0,F.style.overflow="visible",F.style.height=`${So}px`,R.style.overflow="visible",await new Promise(Zo=>setTimeout(Zo,100));let Rr=await htmlToImage.toPng(F,{backgroundColor:ea.bgPrimary,pixelRatio:2,filter:Zo=>{if(!(Zo instanceof Element))return !0;let ks=window.getComputedStyle(Zo),Ln=parseInt(ks.zIndex,10);return (isNaN(Ln)||Ln<50)&&ks.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{F.style.overflow=xt,F.style.height=ot,R.style.overflow=pa,G&&(G.scrollTop=xe),Q.scrollTop=Me;}},exportToPDF:async F=>{await Pe.exportToPDF(z,F);},exportToExcel:async F=>{await Pe.exportToExcel(z,F);},exportToJSON:()=>Pe.exportToJSON(z),exportToCSV:()=>Pe.exportToCSV(z),importFromJSON:F=>{let R=Pe.importFromJSON(F);ne(R);},getTasks:()=>z,refresh:()=>{ne(F=>[...F]);},clearAll:()=>{ne([]);}}),[z,S,oe,Te,We,Tt,ea,ws]);let K0=react.useCallback(F=>{Xi(R=>R.map(G=>G.id===F?{...G,visible:!G.visible}:G));},[]),Y0=react.useCallback((F,R)=>{Xi(G=>G.map(Q=>{if(Q.id!==F)return Q;let xe=Q.minWidth??100,Me=Q.maxWidth??800,xt=Math.max(xe,Math.min(Me,R));return {...Q,width:xt}}));},[]),q0=react.useCallback(F=>{ne(R=>{let G=bd(R,F),Q=xe=>{for(let Me of xe){if(Me.id===F){aa.current.set(F,Me.isExpanded??true);return}Me.subtasks?.length&&Q(Me.subtasks);}};return Q(G),Ut(),G}),a.onTaskToggleExpand?.(F);},[a,Ut]),qo=react.useCallback((F,R)=>{if(ze&&ze(F,R)===false)return;let Q=Pe.findTaskById(z,F)?.progress,xe=xt=>xt.map(ot=>ot.id===F?{...ot,...R}:ot.subtasks?{...ot,subtasks:xe(ot.subtasks)}:ot);ne(xe(z));let Me=Pe.findTaskById(xe(z),F);Me&&(He?.(Me),Qe?.(Me),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&j?.(F,Q,R.progress));},[z,He,ze,Qe,j]),X0=react.useCallback(F=>{F.length!==0&&(ua.current+=1,Ko.current=true,ne(R=>yr(ud(R,F))),a.onTaskIndent?.(F[0]));},[a]),J0=react.useCallback(F=>{F.length!==0&&(ua.current+=1,Ko.current=true,ne(R=>yr(pd(R,F))),a.onTaskOutdent?.(F[0]));},[a]),Q0=react.useCallback((F,R,G)=>{ua.current+=1,Ko.current=true,ne(Q=>yr(Kp(Q,F,R,G))),a.onTaskReparent?.(F,R,G);},[a]),Z0=react.useCallback((F,R)=>{F.length!==0&&(ua.current+=1,Ko.current=true,ne(G=>md(G,F,R)),a.onTaskMove?.(F[0],R));},[a]),Qi=react.useCallback(async F=>{let R=[];for(let G of F)te&&await Promise.resolve(te(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ne(G=>yr(gd(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),tt&&R.forEach(G=>tt(G)));},[a,te,tt]),ef=react.useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let G=Pe.findTaskById(z,R);G&&a.onTaskDuplicate(G);}):ne(R=>Xn(R,F).tasks);},[a,z]),tf=react.useCallback((F,R)=>{ne(G=>{let{tasks:Q,newTask:xe}=jp(G,F,R);return we&&we(xe)===false?G:(a.onTaskCreate?.(xe.parentId,xe.position||0),Be?.(xe),Q)});},[a,we,Be]),af=react.useCallback((F,R)=>{ne(G=>fd(G,F,R)),a.onTaskRename?.(F,R);},[a]),Zi=react.useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let G=si(z,F);if(G){R(G);return}}ne(G=>{let{tasks:Q}=hd(G,F);return a.onTaskCreate?.(F,0),Q});},[a,z]),rf=react.useCallback((F,R,G)=>{let Q=!F.startDate&&!F.endDate,xe=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Me=$t=>$t.map(Jt=>Jt.id===F.id?{...Jt,startDate:R,endDate:G,...F.segments&&{segments:F.segments}}:Jt.subtasks?{...Jt,subtasks:Me(Jt.subtasks)}:Jt),xt=Me(z),ot=xt;xt=Pe.autoScheduleDependents(xt,F.id,xe),xt=yr(xt),ne(xt);let pa={...F,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,G):He?.(pa),O&&xe!==0){let $t=Pe.flattenTasks(ot),Jt=Pe.flattenTasks(xt),_a=[];for(let lr of Jt){if(lr.id===F.id)continue;let oo=$t.find(Rr=>Rr.id===lr.id);if(!oo)continue;let Qo=lr.startDate?.getTime()!==oo.startDate?.getTime(),So=lr.endDate?.getTime()!==oo.endDate?.getTime();(Qo||So)&&_a.push(lr);}_a.length>0&&O(_a);}},[z,He,O,a]),of=react.useCallback((F,R)=>{Z?.(F,R),M({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[Z]),nf=react.useCallback((F,R)=>{let G=Pe.splitTask(z,F.id,R);ne(G),M({isOpen:false,x:0,y:0,task:null});},[z]),Rc=react.useCallback(F=>{let R=Pe.findTaskById(z,F.id)||F;X?.(R),he||ye(R);},[z,X,he]),Oc=react.useCallback((F,R,G)=>{let Q=new Map,xe=$t=>{$t.forEach(Jt=>{Jt.dependencies&&Q.set(Jt.id,Jt.dependencies),Jt.subtasks&&xe(Jt.subtasks);});};xe(G);let Me=Q.get(R)||[];Q.set(R,[...Me,F]);let xt=new Set,ot=new Set,pa=$t=>{if(!xt.has($t)){xt.add($t),ot.add($t);let Jt=Q.get($t)||[];for(let _a of Jt){if(!xt.has(_a)&&pa(_a))return true;if(ot.has(_a))return true}}return ot.delete($t),false};return pa(R)},[]),$c=react.useCallback((F,R)=>{if(Oc(F.id,R,Mn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
366
+ `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${fe[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${yt}`},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:nt,border:`1px solid ${Je}`,color:"#2E94FF"},children:jsxRuntime.jsx(sm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:z},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(L=>!L),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:L=>{L.currentTarget.style.background=q,L.currentTarget.style.color=D;},onMouseLeave:L=>{L.currentTarget.style.background="transparent",L.currentTarget.style.color=ne;},children:jsxRuntime.jsx(Tv,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:L=>{L.currentTarget.style.background=q,L.currentTarget.style.color=D;},onMouseLeave:L=>{L.currentTarget.style.background="transparent",L.currentTarget.style.color=ne;},children:jsxRuntime.jsx(Cv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((L,G)=>jsxRuntime.jsx("button",{onClick:()=>le(L),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:re,border:`1px solid ${W}`},onMouseEnter:de=>{de.currentTarget.style.borderColor=Ue,de.currentTarget.style.color="#2E94FF";},onMouseLeave:de=>{de.currentTarget.style.borderColor=W,de.currentTarget.style.color=re;},children:L.length>30?L.slice(0,30)+"...":L},G))})]}),g.map(L=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${L.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${L.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:L.role==="user"?Ne:Fe,color:L.role==="user"?"#2E94FF":lt,border:L.role==="user"?`1px solid ${ze}`:`1px solid ${Ke}`},children:[L.isLoading?jsxRuntime.jsx(Nv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content}),L.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:L.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:L.command.success?"#10B981":"#EF4444",border:`1px solid ${L.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[L.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:L.command.type.replace(/_/g," ")})]})]})},L.id)),jsxRuntime.jsx("div",{ref:H})]}),jsxRuntime.jsxs("form",{onSubmit:L=>{if(I&&Ee.length>0){L.preventDefault();return}M(L);},className:"p-3 relative",style:{borderTop:`1px solid ${ut}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&Ee.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,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:Lt,border:`1px solid ${We}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:Ee.map((L,G)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ve(L),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:G===P?pt:"transparent",color:ie},onMouseEnter:()=>te(G),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:A,border:`1px solid ${K}`,color:"#2E94FF"},children:L.name.split(" ").map(de=>de[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:L.name}),L.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:be},children:L.email})]})]},L.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${Ze}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:h,onChange:L=>Ye(L.target.value),onKeyDown:L=>{Oe(L);},placeholder:Re,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:zt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!h.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:h.trim()?Ct:"transparent",color:h.trim()?"#2E94FF":wt,border:h.trim()?`1px solid ${ht}`:"1px solid transparent"},children:jsxRuntime.jsx(kv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:rt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function im(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,p=true)=>{r(d=>{let m=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function lm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Fv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.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=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dm(e){return {...Fv,...e}}var Ov=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},pm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:b,persistFilter:h,clearFiltersKey:v,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:x=false,createTaskLabel:N,onCreateTask:k,taskFilter:S,onTaskFilterChange:C,toolbarRightContent:I,showBaseline:$,viewMode:P,onViewModeChange:te,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:J,onTaskContextMenu:ee,onTaskUpdate:Re,onDependentTasksScheduled:B,onProgressChange:Y,onTaskEdit:ye,onTaskAddSubtask:Ge,onTaskMarkIncomplete:U,onTaskSetInProgress:oe,onDependencyCreate:Z,onDependencyDelete:Se,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:He,onAfterTaskUpdate:et,onBeforeTaskDelete:ae,onAfterTaskDelete:Xe,permissions:pe,onCopySnapshotLink:at}=a,Pt=react.useContext(ti)?.theme,[Ce,yt]=react.useState(Pt||s||"dark"),[nt,Je]=react.useState(n),[z,ne]=react.useState(i),[D,q]=react.useState(1),[ce,Te]=react.useState("all"),[W,re]=react.useState(P||"execution"),Ue=P??W,Ne=react.useCallback(E=>{re(E),te?.(E);},[te]),ze=$??Ue==="oracle",[Fe,Ke]=react.useState(a.showCriticalPath!==false),[lt,ut]=react.useState(a.showDependencies!==false),[st,Ze]=react.useState(a.highlightWeekends!==false),zt=react.useCallback(E=>{Ke(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),Ct=react.useCallback(E=>{ut(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),ht=react.useCallback(E=>{Ze(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(nt);},[nt]),react.useEffect(()=>{a.onZoomChange?.(D);},[D]);let wt=react.useRef(a.onDateRangeChange);wt.current=a.onDateRangeChange;let rt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Lt,We]=react.useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(E);if(R){let _=JSON.parse(R);if(_.taskFilter)return _.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Be=S??Lt,pt=C??We,[ie,be]=react.useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(E);if(R){let _=JSON.parse(R);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=rt();if(E)try{let R={taskFilter:Be,hideCompleted:ie};localStorage.setItem(E,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Be,ie,rt]);let A=react.useRef(v);react.useEffect(()=>{if(A.current!==v&&v!==void 0){We("all"),be(false);let E=rt();if(E)try{localStorage.removeItem(E);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}A.current=v;},[v,rt]);let[K,X]=react.useState(0),[me,Ee]=react.useState(false),[Ye,Ve]=react.useState(null),[Oe,bt]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,M]=react.useState(null),[le,fe]=react.useState(null);react.useEffect(()=>{Pt&&Pt!==Ce&&yt(Pt);},[Pt]),react.useEffect(()=>{s&&s!==Ce&&yt(s);},[s]);let L=react.useCallback(E=>{yt(E),H?.(E);},[H]),{state:G,setState:de,undo:T,redo:j,canUndo:xe,canRedo:Le,clearHistory:Qe}=im(t,50),tt=react.useMemo(()=>{let E=(R,_=0)=>{let Q=_;for(let ve of R)ve.subtasks?.length&&(Q=Math.max(Q,E(ve.subtasks,_+1)));return Q};return E(G)+1},[G]),xt=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),Rt=react.useRef(new Map),na=react.useRef(false);if(!na.current&&b){na.current=true;let E=typeof b=="string"?b:"gantt-expanded-tasks";try{let R=localStorage.getItem(E);if(R){let _=JSON.parse(R);Array.isArray(_)&&(Rt.current=new Map(_));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ot=react.useCallback(()=>{let E=xt();if(E)try{let R=Array.from(Rt.current.entries());localStorage.setItem(E,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[xt]),_a=react.useRef(0),cr=react.useRef(G);react.useEffect(()=>{cr.current=G;},[G]);let Ka=react.useRef(false),Pn=react.useCallback(E=>{Te(E),_a.current+=1,de(R=>{let _=(ve,Me=0)=>ve.map(kt=>{let ot=E==="all"||Me<E-1;return kt.subtasks?.length&&Rt.current.set(kt.id,ot),{...kt,isExpanded:ot,subtasks:kt.subtasks?_(kt.subtasks,Me+1):void 0}}),Q=_(R);return Ot(),Q});},[de,Ot]);react.useEffect(()=>{if(_a.current>0){_a.current-=1;return}let E=_=>{let Q=new Map;for(let ve of _){let Me=ve.id;Q.get(Me)||Q.set(Me,ve);}return Array.from(Q.values())},R=_=>_.map(Q=>{let ve=Rt.current.get(Q.id),Me=ve!==void 0?{...Q,isExpanded:ve}:Q;if(Me.subtasks?.length){let kt=E(Me.subtasks);return {...Me,subtasks:R(kt)}}return Me});if(Rt.current.size>0)de(vr(R(t)));else {let _=Q=>Q.map(ve=>ve.subtasks?.length?{...ve,subtasks:E(_(ve.subtasks))}:ve);de(vr(_(t)));}},[t,de]);let vs=react.useRef(t),Pc=react.useRef(true);react.useEffect(()=>{if(Pc.current){Pc.current=false,vs.current=G;return}if(Ka.current){Ka.current=false,vs.current=G;return}if(!r)return;let E=JSON.stringify(vs.current),R=JSON.stringify(G);E!==R&&(vs.current=G,r(G));},[G,r]);let Ya=react.useMemo(()=>dd(y,w),[y,w]),G0=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[qo,Qi]=react.useState(()=>G0(Ya));react.useEffect(()=>{Qi(E=>E.map(R=>({...R,label:Ya.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ya]);let ws=react.useMemo(()=>qo.filter(R=>R.visible).reduce((R,_)=>R+_.width,0),[qo]),Ac=react.useRef(qo.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=qo.filter(Q=>Q.visible),R=E.map(Q=>Q.id).join(","),_=Ac.current;if(R!==_){let Q=E.some(Me=>Me.id!=="name"),ve=_.includes(",");Q?!ve&&Q&&Ve(null):Ve(null),Ac.current=R;}},[qo]);let Lc=60,Ic=.6,_0=react.useMemo(()=>{let R=ws+Lc,_=typeof window<"u"?window.innerWidth*Ic:800,Q=Math.max(R,_);return Ye!==null?Math.max(200,Math.min(Ye,Q)):Math.max(200,R)},[Ye,ws]),no=react.useRef(null),ks=react.useRef(null),Or=react.useRef(null),An=react.useRef(null),ra=react.useMemo(()=>Mp(Ce),[Ce]),j0=react.useMemo(()=>({theme:ra,themeName:Ce}),[ra,Ce]),Bc=react.useMemo(()=>dm(m),[m]),Zi=react.useMemo(()=>{if(!g)return G;let E=Pe.calculateCriticalPathFull(G),R=_=>_.map(Q=>{let ve=E.get(Q.id),Me=Q.subtasks?R(Q.subtasks):void 0,kt=Me?.some(ma=>ma.isCriticalPath||ma.subtasks&&ma.subtasks.some(Ut=>Ut.isCriticalPath))||false,ot=ve?ve.isCritical:kt;return {...Q,isCriticalPath:ot,cpmData:ve||void 0,subtasks:Me}});return R(G)},[G,g]),K0=react.useMemo(()=>Pe.flattenTasks(G).some(R=>R.dependencies&&R.dependencies.length>0),[G]),Rc=react.useMemo(()=>{if(Be==="all"&&!ie)return Zi;let E=R=>{let _=[];for(let Q of R){let ve=Q.subtasks?.length?E(Q.subtasks):void 0,Me=false;if(ie)Me=Q.progress<100;else switch(Be){case "all":Me=true;break;case "incomplete":Me=Q.progress<100;break;case "in_progress":Me=Q.progress>0&&Q.progress<100;break;case "completed":Me=Q.progress===100;break}(Me||ve&&ve.length>0)&&_.push({...Q,subtasks:ve});}return _};return E(Zi)},[Zi,Be,ie]),Cs=Ov(z);lm({undo:T,redo:j,canUndo:xe,canRedo:Le,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>Pe.findTaskById(G,E),addTask:(E,R)=>{de(_=>{if(!R)return [..._,{...E,level:0}];let Q=ve=>ve.map(Me=>Me.id===R?{...Me,subtasks:[...Me.subtasks||[],{...E,parentId:R,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(_)});},updateTask:(E,R)=>{de(_=>{let Q=ve=>ve.map(Me=>Me.id===E?{...Me,...R}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(_)});},deleteTask:E=>{de(R=>{let _=Q=>Q.filter(ve=>ve.id===E?false:(ve.subtasks&&(ve.subtasks=_(ve.subtasks)),true));return _(R)});},deleteTasks:E=>{de(R=>bd(R,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let R=Pe.findTaskById(G,E);R&&a.onTaskDuplicate(R);}else de(R=>Jn(R,[E]).tasks);},splitTask:(E,R,_=3)=>{de(Q=>Pe.splitTask(Q,E,R,_));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(E,R)=>!Pe.validateDependencies(G,E,R),getAllTasks:()=>Pe.flattenTasks(G),getTasksByStatus:E=>Pe.flattenTasks(G).filter(R=>R.status===E),getTasksByParent:E=>E?Pe.findTaskById(G,E)?.subtasks||[]:G.filter(_=>!_.parentId),getCriticalPath:()=>Pe.flattenTasks(G).filter(E=>E.isCriticalPath),indentTask:E=>{de(R=>vr(md(R,[E])));},outdentTask:E=>{de(R=>vr(gd(R,[E])));},moveTask:(E,R)=>{de(_=>fd(_,[E],R));},createSubtask:async E=>{let{tasks:R,newTask:_}=xd(G,E);if(ke){let Q=ke({..._,parentId:E});if((Q instanceof Promise?await Q:Q)===false)return}de(vr(R)),Ie&&Ie({..._,parentId:E});},scrollToTask:E=>{let _=Pe.flattenTasks(G).findIndex(Q=>Q.id===E);if(_!==-1&&no.current){let Q=_*Cs;no.current.scrollTo({top:Q,behavior:"smooth"}),Or.current&&Or.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(E,R=2e3)=>{},expandTask:E=>{de(R=>{let _=Q=>Q.map(ve=>ve.id===E?{...ve,isExpanded:true}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},collapseTask:E=>{de(R=>{let _=Q=>Q.map(ve=>ve.id===E?{...ve,isExpanded:false}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},expandAll:()=>{de(E=>{let R=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(E)});},collapseAll:()=>{de(E=>{let R=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(E)});},collapseToLevel:E=>{Pn(E);},undo:T,redo:j,canUndo:()=>xe,canRedo:()=>Le,clearHistory:Qe,exportToPNG:async()=>{if(!An.current||!no.current||!Or.current)throw new Error("Gantt container not found");let E=An.current,R=no.current,_=ks.current||R.querySelector(".gantt-grid-scroll"),Q=Or.current,ve=_?.scrollTop||0,Me=Q.scrollTop,kt=E.style.overflow,ot=E.style.height,ma=R.style.overflow;try{let Ut=_?.querySelector(".gantt-taskgrid-content"),ea=Q.querySelector("svg"),ja=Ut?.scrollHeight||_?.scrollHeight||600,ur=ea?.getBoundingClientRect().height||Q.scrollHeight,Fo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ja,ur)+20;_&&(_.scrollTop=0),Q.scrollTop=0,E.style.overflow="visible",E.style.height=`${Fo}px`,R.style.overflow="visible",await new Promise(en=>setTimeout(en,100));let $r=await htmlToImage.toPng(E,{backgroundColor:ra.bgPrimary,pixelRatio:2,filter:en=>{if(!(en instanceof Element))return !0;let Ts=window.getComputedStyle(en),In=parseInt(Ts.zIndex,10);return (isNaN(In)||In<50)&&Ts.position!=="fixed"}});return await(await fetch($r)).blob()}finally{E.style.overflow=kt,E.style.height=ot,R.style.overflow=ma,_&&(_.scrollTop=ve),Q.scrollTop=Me;}},exportToPDF:async E=>{await Pe.exportToPDF(G,E);},exportToExcel:async E=>{await Pe.exportToExcel(G,E);},exportToJSON:()=>Pe.exportToJSON(G),exportToCSV:()=>Pe.exportToCSV(G),importFromJSON:E=>{let R=Pe.importFromJSON(E);de(R);},getTasks:()=>G,refresh:()=>{de(E=>[...E]);},clearAll:()=>{de([]);}}),[G,T,j,xe,Le,Qe,ra,Cs]);let Y0=react.useCallback(E=>{Qi(R=>R.map(_=>_.id===E?{..._,visible:!_.visible}:_));},[]),q0=react.useCallback((E,R)=>{Qi(_=>_.map(Q=>{if(Q.id!==E)return Q;let ve=Q.minWidth??100,Me=Q.maxWidth??800,kt=Math.max(ve,Math.min(Me,R));return {...Q,width:kt}}));},[]),X0=react.useCallback(E=>{de(R=>{let _=yd(R,E),Q=ve=>{for(let Me of ve){if(Me.id===E){Rt.current.set(E,Me.isExpanded??true);return}Me.subtasks?.length&&Q(Me.subtasks);}};return Q(_),Ot(),_}),a.onTaskToggleExpand?.(E);},[a,Ot]),Xo=react.useCallback((E,R)=>{if(He&&He(E,R)===false)return;let Q=Pe.findTaskById(G,E)?.progress,ve=kt=>kt.map(ot=>ot.id===E?{...ot,...R}:ot.subtasks?{...ot,subtasks:ve(ot.subtasks)}:ot);de(ve(G));let Me=Pe.findTaskById(ve(G),E);Me&&(Re?.(Me),et?.(Me),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&Y?.(E,Q,R.progress));},[G,Re,He,et,Y]),J0=react.useCallback(E=>{E.length!==0&&(_a.current+=1,Ka.current=true,de(R=>vr(md(R,E))),a.onTaskIndent?.(E[0]));},[a]),Q0=react.useCallback(E=>{E.length!==0&&(_a.current+=1,Ka.current=true,de(R=>vr(gd(R,E))),a.onTaskOutdent?.(E[0]));},[a]),Z0=react.useCallback((E,R,_)=>{_a.current+=1,Ka.current=true,de(Q=>vr(Yp(Q,E,R,_))),a.onTaskReparent?.(E,R,_);},[a]),ef=react.useCallback((E,R)=>{E.length!==0&&(_a.current+=1,Ka.current=true,de(_=>fd(_,E,R)),a.onTaskMove?.(E[0],R));},[a]),el=react.useCallback(async E=>{let R=[];for(let _ of E)ae&&await Promise.resolve(ae(_))===false||R.push(_);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(de(_=>vr(bd(_,R))),R.forEach(_=>a.onTaskDelete?.(_))),Xe&&R.forEach(_=>Xe(_)));},[a,ae,Xe]),tf=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(R=>{let _=Pe.findTaskById(G,R);_&&a.onTaskDuplicate(_);}):de(R=>Jn(R,E).tasks);},[a,G]),af=react.useCallback((E,R)=>{de(_=>{let{tasks:Q,newTask:ve}=Kp(_,E,R);return ke&&ke(ve)===false?_:(a.onTaskCreate?.(ve.parentId,ve.position||0),Ie?.(ve),Q)});},[a,ke,Ie]),rf=react.useCallback((E,R)=>{de(_=>hd(_,E,R)),a.onTaskRename?.(E,R);},[a]),tl=react.useCallback(E=>{let{onTaskAddSubtask:R}=a;if(R){let _=li(G,E);if(_){R(_);return}}de(_=>{let{tasks:Q}=xd(_,E);return a.onTaskCreate?.(E,0),Q});},[a,G]),of=react.useCallback((E,R,_)=>{let Q=!E.startDate&&!E.endDate,ve=E.startDate?Math.round((R.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,Me=Ut=>Ut.map(ea=>ea.id===E.id?{...ea,startDate:R,endDate:_,...E.segments&&{segments:E.segments}}:ea.subtasks?{...ea,subtasks:Me(ea.subtasks)}:ea),kt=Me(G),ot=kt;kt=Pe.autoScheduleDependents(kt,E.id,ve),kt=vr(kt),de(kt);let ma={...E,startDate:R,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(E,R,_):Re?.(ma),B&&ve!==0){let Ut=Pe.flattenTasks(ot),ea=Pe.flattenTasks(kt),ja=[];for(let ur of ea){if(ur.id===E.id)continue;let so=Ut.find($r=>$r.id===ur.id);if(!so)continue;let Zo=ur.startDate?.getTime()!==so.startDate?.getTime(),Fo=ur.endDate?.getTime()!==so.endDate?.getTime();(Zo||Fo)&&ja.push(ur);}ja.length>0&&B(ja);}},[G,Re,B,a]),nf=react.useCallback((E,R)=>{ee?.(E,R),bt({isOpen:true,x:R.clientX,y:R.clientY,task:E});},[ee]),sf=react.useCallback((E,R)=>{let _=Pe.splitTask(G,E.id,R);de(_),bt({isOpen:false,x:0,y:0,task:null});},[G]),Oc=react.useCallback(E=>{let R=Pe.findTaskById(G,E.id)||E;J?.(R),ye||M(R);},[G,J,ye]),$c=react.useCallback((E,R,_)=>{let Q=new Map,ve=Ut=>{Ut.forEach(ea=>{ea.dependencies&&Q.set(ea.id,ea.dependencies),ea.subtasks&&ve(ea.subtasks);});};ve(_);let Me=Q.get(R)||[];Q.set(R,[...Me,E]);let kt=new Set,ot=new Set,ma=Ut=>{if(!kt.has(Ut)){kt.add(Ut),ot.add(Ut);let ea=Q.get(Ut)||[];for(let ja of ea){if(!kt.has(ja)&&ma(ja))return true;if(ot.has(ja))return true}}return ot.delete(Ut),false};return ma(R)},[]),Hc=react.useCallback((E,R)=>{if($c(E.id,R,cr.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(xe=>{if(xe.id===R){let Me=xe.dependencies||[];if(!Me.includes(F.id))return {...xe,dependencies:[...Me,F.id]}}return xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe});ua.current+=1,ne(Q=>G(Q)),ee?.(F.id,R);},[ee,Oc]),Hc=react.useCallback((F,R)=>{let G=Q=>Q.map(xe=>{if(xe.id===F&&xe.dependencies){let Me=xe.dependencies.filter(xt=>xt!==R);return {...xe,dependencies:Me}}return xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe});ua.current+=1,ne(Q=>G(Q)),Ee?.(F,R);},[Ee]),{startDate:Xo,endDate:el}=react.useMemo(()=>{let F=z.filter(Me=>Me.startDate&&Me.endDate);if(F.length===0){let Me=new Date,xt=new Date(Me);xt.setDate(xt.getDate()-30);let ot=new Date(Me);return ot.setDate(ot.getDate()+60),{startDate:xt,endDate:ot}}let R=F.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),G=new Date(Math.min(...R.map(Me=>Me.getTime()))),Q=new Date(Math.max(...R.map(Me=>Me.getTime()))),xe=it==="day"?7:it==="week"?14:30;return G.setDate(G.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:G,endDate:Q}},[z,it]);react.useEffect(()=>{yt.current?.(Xo,el);},[Xo,el]);let sf=react.useCallback(async()=>{if(!Pn.current||!ro.current||!Br.current)return;await new Promise(So=>setTimeout(So,200));let F=Pn.current,R=ro.current,G=vs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=G?.scrollTop||0,Me=G?.scrollLeft||0,xt=Q.scrollTop,ot=Q.scrollLeft,pa=F.style.overflow,$t=F.style.height,Jt=G?.style.overflow||"",_a=Q.style.overflow,lr=R.style.overflow,oo=F.style.width,Qo=Q.style.width;try{let So=G?.querySelector(".gantt-taskgrid-content"),Rr=Q.querySelector("svg"),al=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Zo=So?.scrollHeight||G?.scrollHeight||600,ks=Math.max(al,Q.scrollHeight),Ln=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Q.scrollWidth,ff=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,rl=Math.max(Zo,ks,al),Wc=ff+rl+50,Vc=(G?.offsetWidth||R.offsetWidth||300)+Ln+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,F.style.overflow="visible",F.style.height=`${Wc}px`,F.style.width=`${Vc}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${rl+50}px`),Q.style.overflow="visible",Q.style.height=`${rl+50}px`,Q.style.width=`${Ln+10}px`,await new Promise(Cs=>setTimeout(Cs,150));let bf=await htmlToImage.toPng(F,{backgroundColor:ea.bgPrimary,pixelRatio:2,width:Vc,height:Wc,skipFonts:!1,filter:Cs=>{if(!(Cs instanceof Element))return !0;let Gc=window.getComputedStyle(Cs),_c=parseInt(Gc.zIndex,10);return !(!isNaN(_c)&&_c>=50||Gc.position==="fixed")}}),ol=document.createElement("a");ol.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ol.href=bf,ol.click();}finally{F.style.overflow=pa,F.style.height=$t,F.style.width=oo,R.style.overflow=lr,G&&(G.style.overflow=Jt,G.style.height="",G.scrollTop=xe,G.scrollLeft=Me),Q.style.overflow=_a,Q.style.height="",Q.style.width=Qo,Q.scrollTop=xt,Q.scrollLeft=ot;}},[ea]),lf=react.useCallback(async()=>{await Pe.exportToPDF(z);},[z]),df=react.useCallback(async()=>{let F=new Date,R=xe=>String(xe).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 Pe.exportToExcel(z,`${Q}_${G}.xlsx`);},[z,p]),cf=react.useCallback(()=>{let F=Pe.exportToCSV(z),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);},[z]),uf=react.useCallback(()=>{let F=Pe.exportToJSON(z),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);},[z]),pf=react.useCallback(()=>{Pe.exportToMSProject(z,"Gantt Project","project.xml");},[z]),mf=F=>{F.preventDefault(),Se(true);},Jo=react.useRef(false),[tl,zc]=react.useState(false),An=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let F=Br.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let G=()=>{if(Jo.current)return;Jo.current=true;let ot=F.scrollTop;q(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Jo.current=false;});},Q=()=>{if(Jo.current)return;Jo.current=true;let ot=R.scrollTop;q(ot),F.scrollTop=ot,requestAnimationFrame(()=>{Jo.current=false;});},xe=ot=>{if(ce&&R){let $t=R.parentElement?.getBoundingClientRect()?.left||0,Jt=ot.clientX-$t,_a=200,lr=xs+Ac,oo=window.innerWidth*Lc,Qo=Math.max(lr,oo);Jt>=_a&&Jt<=Qo&&_e(Jt);}if(tl&&F){let pa=ot.clientX-An.current.x,$t=ot.clientY-An.current.y;F.scrollLeft=An.current.scrollLeft-pa,F.scrollTop=An.current.scrollTop-$t;}},Me=()=>{Se(false),zc(false);},xt=ot=>{if(ot.button!==0)return;let pa=ot.target;pa.closest("[data-task-bar]")||pa.closest("[data-dependency-line]")||pa.closest("button")||pa.closest('[role="button"]')||pa.tagName==="rect"&&pa.getAttribute("data-clickable")==="true"||(zc(true),An.current={x:ot.clientX,y:ot.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},ot.preventDefault());};return F.addEventListener("scroll",G),R.addEventListener("scroll",Q),F.addEventListener("mousedown",xt),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Me),()=>{F.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Me);}},[ce,tl,xs]);let Uc=react.useRef(false),gf=react.useRef(null);return react.useLayoutEffect(()=>{if(Uc.current||z.length===0||!Br.current)return;Uc.current=true,gf.current=Xo;let F=Br.current,R=new Date,G=it==="day"?60:it==="week"?20:8,Q=(R.getTime()-Xo.getTime())/(1e3*60*60*24),xe=F.clientWidth,xt=Q*G*N-xe/2;Q>=0&&xe>0&&(F.scrollLeft=Math.max(0,xt));},[z.length,Xo,it,N]),jsxRuntime.jsx(mn.Provider,{value:ja,children:jsxRuntime.jsx(dl.Provider,{value:_0,children:jsxRuntime.jsxs("div",{ref:Pn,className:"flex flex-col h-full w-full",style:{backgroundColor:ea.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ea.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ea.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(oi,{theme:ea,timeScale:it,onTimeScaleChange:Ze,zoom:N,onZoomChange:Y,currentTheme:Ce,onThemeChange:B,rowDensity:H,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:x&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:C,onCreateTask:k,taskFilter:Re,onTaskFilterChange:ut,hideCompleted:le,onHideCompletedChange:fe,toolbarRightContent:I,wbsLevel:ie,onWbsLevelChange:Fc,maxWbsDepth:Nt,viewMode:Ve,onViewModeChange:De,projectForecast:E,onExportPNG:l?sf:void 0,onExportPDF:l?lf:void 0,onExportExcel:l?df:void 0,onExportCSV:l?cf:void 0,onExportJSON:l?uf:void 0,onExportMSProject:l?pf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:At,showDependencies:bt,onShowDependenciesChange:Mt,highlightWeekends:nt,onHighlightWeekendsChange:mt,showBaseline:Ue,onShowBaselineChange:F=>{F&&Ve!=="oracle"&&De("oracle"),!F&&Ve==="oracle"&&De("execution");},onCopySnapshotLink:at,hasDependencies:j0})}),jsxRuntime.jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:vs,className:"gantt-grid-scroll flex-shrink-0",style:{width:G0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(li,{tasks:Bc,theme:ea,rowHeight:ws,availableUsers:d,templates:Ic,showCriticalPath:Ne,onTaskClick:L,onTaskDblClick:Rc,onTaskContextMenu:Z,onTaskToggle:q0,scrollTop:K,columns:Yo,onToggleColumn:K0,onColumnResize:Y0,onTaskUpdate:qo,onTaskIndent:X0,onTaskOutdent:J0,onTaskMove:Z0,onMultiTaskDelete:Qi,onTaskDuplicate:ef,onTaskCreate:tf,onTaskRename:af,onCreateSubtask:Zi,onOpenTaskModal:L?F=>L(F):void 0,onDeleteRequest:(F,R)=>Oe({taskId:F,taskName:R}),onTaskReparent:Q0,scrollContainerRef:vs})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ea.border,zIndex:15},onMouseDown:mf}),jsxRuntime.jsx("div",{ref:Br,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:tl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(yi,{tasks:Bc,theme:ea,rowHeight:ws,timeScale:it,startDate:Xo,endDate:el,zoom:N,locale:y,templates:Ic,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:L,onTaskDblClick:Rc,onTaskContextMenu:of,onTaskDateChange:rf,onDependencyCreate:$c,onDependencyDelete:Hc,showBaseline:Ue,showCriticalPath:Ne,showDependencies:bt,highlightWeekends:nt,canEditTask:pe?.canEditTask})})]}),Ie.task&&jsxRuntime.jsx(bn,{isOpen:Ie.isOpen,x:Ie.x,y:Ie.y,theme:ea,onClose:()=>M({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Ie.task;if(!F)return [];let R=Pe.findTaskById(z,F.id)||F,G=R.subtasks&&R.subtasks.length>0,Q=pe?.canCreateTask!==false,xe=pe?.canDeleteTask!==false;if(G){let $t=[],Jt=pe?.canDuplicateTask!==false;return Q&&$t.push({id:"addSubtask",label:ja.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{je?je(R):Zi(R.id);}}),Jt&&$t.push({id:"duplicate",label:ja.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ne(_a=>Xn(_a,[R.id]).tasks),M({isOpen:false,x:0,y:0,task:null});}}),xe&&($t.length>0&&$t.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),$t.push({id:"delete",label:ja.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{Oe({taskId:R.id,taskName:R.name});}})),$t}let Me=pe?.canUpdateTask!==false,xt=pe?.canDuplicateTask!==false,ot=[];return Me&&ot.push({id:"edit",label:ja.contextMenu?.editTask||"Edit Task",icon:qt.Pencil,onClick:()=>{he?he(R):ye(R);}}),Q&&ot.push({id:"addSubtask",label:ja.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{je?je(R):Zi(R.id);}}),ot.length>0&&Me&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(ot.push({id:"markIncomplete",label:ja.contextMenu?.markIncomplete||"Mark Incomplete",icon:qt.MarkIncomplete,onClick:()=>{U?U(R):qo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:ja.contextMenu?.setInProgress||"Set In Progress",icon:qt.SetInProgress,onClick:()=>{re?re(R):qo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:ja.contextMenu?.markComplete||"Mark Complete",icon:qt.MarkComplete,onClick:()=>{qo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(xt||Me&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),xt&&ot.push({id:"duplicate",label:ja.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ne($t=>Xn($t,[R.id]).tasks),M({isOpen:false,x:0,y:0,task:null});}}),Me&&R.startDate&&R.endDate&&ot.push({id:"split",label:ja.contextMenu?.splitTask||"Split Task",icon:qt.Split,onClick:()=>{let $t=R.startDate.getTime(),Jt=R.endDate.getTime(),_a=$t+(Jt-$t)/2,lr=new Date(_a);nf(R,lr);}}),xe&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:ja.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{Oe({taskId:R.id,taskName:R.name});}})),ot})()}),jsxRuntime.jsx(qr,{task:J,isOpen:!!J,onClose:()=>ye(null),onTaskUpdate:F=>{J&&(qo(J.id,F),ye(null));},theme:Ce==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&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:()=>Oe(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:ea.bgSecondary,border:`1px solid ${ea.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ea.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:ea.textPrimary,fontFamily:"Inter, sans-serif"},children:[ja.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:ea.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ea.textPrimary},children:['"',Le.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ea.bgPrimary,borderTop:`1px solid ${ea.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Oe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=ea.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Qi([Le.taskId]),Oe(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(wi,{tasks:z,theme:ea,config:f,onTasksUpdate:ne,onTaskUpdate:qo,onTaskCreate:F=>{ne(R=>[...R,F]);},onTaskDelete:F=>{Qi([F]);},onDependencyCreate:(F,R)=>{let G=Pe.findTaskById(z,F);G&&$c(G,R);},onDependencyDelete:Hc})]})})})});function Kv(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 Yv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let 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 vd=[{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 fm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:b,defaultStatus:h}){let v=[...vd,...l.filter(N=>!vd.some(Y=>Y.id===N.id))],f=dt[c]||dt.dark,[y,w]=react.useState(false),[x,C]=react.useState(false),[k,D]=react.useState(false),[T,I]=react.useState(false),[$,A]=react.useState({top:0,left:0}),[_,E]=react.useState(null),[me,L]=react.useState(new Date),[X,Z]=react.useState({top:0,left:0}),[He,O]=react.useState(false),[j,he]=react.useState([]),[je,U]=react.useState(false),[re,ee]=react.useState(""),Ee=react.useRef(null),we=react.useRef(null),Be=react.useRef(null),ze=react.useRef(null),Qe=react.useRef(null),[te,tt]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,at]=react.useState({});react.useEffect(()=>{a?(tt({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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&O(true)):(tt({name:"",description:"",progress:0,status:h||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),O(false),he([]));},[a,e,h]),react.useEffect(()=>{let N=Y=>{Ee.current&&!Ee.current.contains(Y.target)&&w(false),we.current&&!we.current.contains(Y.target)&&C(false),Be.current&&!Be.current.contains(Y.target)&&D(false),ze.current&&!ze.current.contains(Y.target)&&I(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let pt=()=>{let N={};return te.name.trim()||(N.name="El nombre es requerido"),te.startDate&&te.endDate&&te.startDate>te.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),at(N),Object.keys(N).length===0},Et=async N=>{if(N.preventDefault(),!!pt())try{let Y=i==="create"&&j.length>0?{...te,pendingFiles:j}:te;await s(Y),he([]),t();}catch(Y){console.error("Error submitting task:",Y);}},Ce=(N,Y)=>{tt(ie=>{let ke={...ie,[N]:Y};if(N==="status"){let V=Y;V==="todo"?ke.progress=0:V==="in-progress"?(ie.progress===0||ie.progress===100)&&(ke.progress=50):V==="completed"||V==="closed"?ke.progress=100:(V==="in-review"||V==="review")&&(ke.progress=75);}if(N==="progress"){let V=typeof Y=="number"?Y:parseInt(Y,10);V===100&&ie.status!=="completed"?ke.status="completed":V>0&&V<100&&ie.status==="todo"?ke.status="in-progress":V===0&&ie.status!=="todo"&&(ke.status="todo");}return ke}),pe[N]&&at(ie=>{let ke={...ie};return delete ke[N],ke});},rt=v.find(N=>N.id===te.status)??vd[0],it=wd.find(N=>N.id===te.priority)??wd[1],Ze=Lo.find(N=>N.value===te.color)??Lo[0],H=c==="dark",de={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Et,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:te.name,onChange:N=>Ce("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:te.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:te.description||"",onChange:N=>Ce("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Ee,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsxRuntime.jsx("span",{style:{color:rt.color},children:rt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",N.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,te.status===N.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxRuntime.jsxs("div",{ref:we,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&C(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:it.color}}),jsxRuntime.jsx("span",{children:it.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:wd.map(N=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",N.id),C(false);},children:[jsxRuntime.jsx("span",{children:N.icon}),N.label,te.priority===N.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[te.assignees&&te.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:te.assignees.slice(0,3).map((N,Y)=>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:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},Y))}),te.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",te.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(N=>{let Y=te.assignees?.some(ie=>ie.name===N.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(te.assignees||[]).filter(ke=>ke.name!==N.name):[...te.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(ke=>ke[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ie);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:N.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxRuntime.jsxs("div",{ref:ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)I(false);else {if(ze.current){let N=ze.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;A({top:V,left:N.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:te.color}}),jsxRuntime.jsx("span",{children:Ze.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(Ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Lo.slice(0,18).map(N=>{let Y=te.color===N.value;return jsxRuntime.jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),Ce("color",N.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:Y?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(lo,{selectedTags:te.tags||[],availableTags:p,onChange:N=>Ce("tags",N),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:Qe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(_==="start")E(null);else {if(Qe.current){let N=Qe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;Z({top:V,left:N.left});}E("start"),L(te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.startDate?te.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(_==="end")E(null);else {if(Qe.current){let N=Qe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;Z({top:V,left:N.left});}E("end"),L(te.endDate||te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.endDate?te.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(Ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let N=new Date,Y=new Date(N);Y.setDate(N.getDate()+1);let ie=new Date(N);ie.setDate(N.getDate()+7);let ke=new Date(N);return ke.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:ke}].map((ae,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:De=>De.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{_==="start"?(Ce("startDate",ae.date),(!te.endDate||ae.date>te.endDate)&&Ce("endDate",ae.date),E("end")):(Ce("endDate",ae.date),(!te.startDate||ae.date<te.startDate)&&Ce("startDate",ae.date),E(null));},children:ae.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),E(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(me.getFullYear(),me.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:me.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(me.getFullYear(),me.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((N,Y)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},Y))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=me.getFullYear(),Y=me.getMonth(),ie=new Date(N,Y,1).getDay(),ke=new Date(N,Y+1,0).getDate(),V=new Date,ae=[];for(let De=ie-1;De>=0;De--)ae.push({day:new Date(N,Y,-De).getDate(),date:new Date(N,Y-1,new Date(N,Y,-De).getDate()),isCurrentMonth:false});for(let De=1;De<=ke;De++)ae.push({day:De,date:new Date(N,Y,De),isCurrentMonth:true});let Ve=42-ae.length;for(let De=1;De<=Ve;De++)ae.push({day:De,date:new Date(N,Y+1,De),isCurrentMonth:false});return ae.map((De,Ue)=>{let Ne=De.date.toDateString()===V.toDateString(),Ke=te.startDate?.toDateString()===De.date.toDateString(),bt=te.endDate?.toDateString()===De.date.toDateString(),lt=te.startDate&&te.endDate&&De.date>=te.startDate&&De.date<=te.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:De.isCurrentMonth?Ke||bt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:bt?"#7C3AED":lt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ke&&!bt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{_==="start"?(Ce("startDate",De.date),te.endDate&&De.date>te.endDate&&Ce("endDate",De.date),E("end")):(Ce("endDate",De.date),te.startDate&&De.date<te.startDate&&Ce("startDate",De.date),E(null));},children:De.day},Ue)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:te.progress,onChange:N=>Ce("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"}20`,color:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[te.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>O(!He),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${He?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:He&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:te.effortMinutes?Kv(te.effortMinutes):"",onChange:N=>{let Y=Yv(N.target.value);Ce("effortMinutes",Y);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?j.length>0&&`(${j.length})`:m.length>0&&`(${m.length})`]})]}),i==="create"?jsxRuntime.jsx(Ur,{cardId:"pending",attachments:j.map((N,Y)=>({id:`pending-${Y}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>he(Y=>[...Y,...N]),onDelete:N=>{let Y=parseInt(N.replace("pending-",""),10);he(ie=>ie.filter((ke,V)=>V!==Y));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Ur,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),i==="create"&&j.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[j.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:te.isMilestone,onChange:N=>Ce("isMilestone",N.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),te.dependencies&&te.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:te.dependencies.map(N=>{let Y=r.find(ie=>ie.id===N);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[Y?.name||N.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ie=(te.dependencies||[]).filter(ke=>ke!==N);Ce("dependencies",ie);},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"})})]},N)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!je),ee("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),ee("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:re,onChange:N=>ee(N.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(N=>N.id!==a?.id).filter(N=>re===""||N.name.toLowerCase().includes(re.toLowerCase())).map(N=>{let Y=te.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ie=te.dependencies||[],ke;Y?ke=ie.filter(V=>V!==N.id):ke=[...ie,N.id],Ce("dependencies",ke);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:N.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(N.currentTarget.style.opacity="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:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var bm=`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 _=Q=>Q.map(ve=>{if(ve.id===R){let Me=ve.dependencies||[];if(!Me.includes(E.id))return {...ve,dependencies:[...Me,E.id]}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,de(Q=>_(Q)),Z?.(E.id,R);},[Z,$c]),zc=react.useCallback((E,R)=>{let _=Q=>Q.map(ve=>{if(ve.id===E&&ve.dependencies){let Me=ve.dependencies.filter(kt=>kt!==R);return {...ve,dependencies:Me}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,de(Q=>_(Q)),Se?.(E,R);},[Se]),{startDate:Jo,endDate:al}=react.useMemo(()=>{let E=G.filter(Me=>Me.startDate&&Me.endDate);if(E.length===0){let Me=new Date,kt=new Date(Me);kt.setDate(kt.getDate()-30);let ot=new Date(Me);return ot.setDate(ot.getDate()+60),{startDate:kt,endDate:ot}}let R=E.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),_=new Date(Math.min(...R.map(Me=>Me.getTime()))),Q=new Date(Math.max(...R.map(Me=>Me.getTime()))),ve=nt==="day"?7:nt==="week"?14:30;return _.setDate(_.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:_,endDate:Q}},[G,nt]);react.useEffect(()=>{wt.current?.(Jo,al);},[Jo,al]);let lf=react.useCallback(async()=>{if(!An.current||!no.current||!Or.current)return;await new Promise(Fo=>setTimeout(Fo,200));let E=An.current,R=no.current,_=ks.current||R.querySelector(".gantt-grid-scroll"),Q=Or.current,ve=_?.scrollTop||0,Me=_?.scrollLeft||0,kt=Q.scrollTop,ot=Q.scrollLeft,ma=E.style.overflow,Ut=E.style.height,ea=_?.style.overflow||"",ja=Q.style.overflow,ur=R.style.overflow,so=E.style.width,Zo=Q.style.width;try{let Fo=_?.querySelector(".gantt-taskgrid-content"),$r=Q.querySelector("svg"),ol=$r?.getAttribute("height")?parseInt($r.getAttribute("height"),10):$r?.getBoundingClientRect().height||0,en=Fo?.scrollHeight||_?.scrollHeight||600,Ts=Math.max(ol,Q.scrollHeight),In=$r?.getAttribute("width")?parseInt($r.getAttribute("width"),10):$r?.getBoundingClientRect().width||Q.scrollWidth,bf=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,nl=Math.max(en,Ts,ol),Vc=bf+nl+50,Gc=(_?.offsetWidth||R.offsetWidth||300)+In+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Vc}px`,E.style.width=`${Gc}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${nl+50}px`),Q.style.overflow="visible",Q.style.height=`${nl+50}px`,Q.style.width=`${In+10}px`,await new Promise(Ns=>setTimeout(Ns,150));let hf=await htmlToImage.toPng(E,{backgroundColor:ra.bgPrimary,pixelRatio:2,width:Gc,height:Vc,skipFonts:!1,filter:Ns=>{if(!(Ns instanceof Element))return !0;let _c=window.getComputedStyle(Ns),jc=parseInt(_c.zIndex,10);return !(!isNaN(jc)&&jc>=50||_c.position==="fixed")}}),sl=document.createElement("a");sl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,sl.href=hf,sl.click();}finally{E.style.overflow=ma,E.style.height=Ut,E.style.width=so,R.style.overflow=ur,_&&(_.style.overflow=ea,_.style.height="",_.scrollTop=ve,_.scrollLeft=Me),Q.style.overflow=ja,Q.style.height="",Q.style.width=Zo,Q.scrollTop=kt,Q.scrollLeft=ot;}},[ra]),df=react.useCallback(async()=>{await Pe.exportToPDF(G);},[G]),cf=react.useCallback(async()=>{let E=new Date,R=ve=>String(ve).padStart(2,"0"),_=`${E.getFullYear()}-${R(E.getMonth()+1)}-${R(E.getDate())}_${R(E.getHours())}${R(E.getMinutes())}`,Q=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(G,`${Q}_${_}.xlsx`);},[G,p]),uf=react.useCallback(()=>{let E=Pe.exportToCSV(G),R=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[G]),pf=react.useCallback(()=>{let E=Pe.exportToJSON(G),R=new Blob([E],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[G]),mf=react.useCallback(()=>{Pe.exportToMSProject(G,"Gantt Project","project.xml");},[G]),gf=E=>{E.preventDefault(),Ee(true);},Qo=react.useRef(false),[rl,Uc]=react.useState(false),Ln=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Or.current,R=no.current?.querySelector(".gantt-grid-scroll");if(!E||!R)return;let _=()=>{if(Qo.current)return;Qo.current=true;let ot=E.scrollTop;X(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Qo.current=false;});},Q=()=>{if(Qo.current)return;Qo.current=true;let ot=R.scrollTop;X(ot),E.scrollTop=ot,requestAnimationFrame(()=>{Qo.current=false;});},ve=ot=>{if(me&&R){let Ut=R.parentElement?.getBoundingClientRect()?.left||0,ea=ot.clientX-Ut,ja=200,ur=ws+Lc,so=window.innerWidth*Ic,Zo=Math.max(ur,so);ea>=ja&&ea<=Zo&&Ve(ea);}if(rl&&E){let ma=ot.clientX-Ln.current.x,Ut=ot.clientY-Ln.current.y;E.scrollLeft=Ln.current.scrollLeft-ma,E.scrollTop=Ln.current.scrollTop-Ut;}},Me=()=>{Ee(false),Uc(false);},kt=ot=>{if(ot.button!==0)return;let ma=ot.target;ma.closest("[data-task-bar]")||ma.closest("[data-dependency-line]")||ma.closest("button")||ma.closest('[role="button"]')||ma.tagName==="rect"&&ma.getAttribute("data-clickable")==="true"||(Uc(true),Ln.current={x:ot.clientX,y:ot.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ot.preventDefault());};return E.addEventListener("scroll",_),R.addEventListener("scroll",Q),E.addEventListener("mousedown",kt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Me),()=>{E.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),E.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Me);}},[me,rl,ws]);let Wc=react.useRef(false),ff=react.useRef(null);return react.useLayoutEffect(()=>{if(Wc.current||G.length===0||!Or.current)return;Wc.current=true,ff.current=Jo;let E=Or.current,R=new Date,_=nt==="day"?60:nt==="week"?20:8,Q=(R.getTime()-Jo.getTime())/(1e3*60*60*24),ve=E.clientWidth,kt=Q*_*D-ve/2;Q>=0&&ve>0&&(E.scrollLeft=Math.max(0,kt));},[G.length,Jo,nt,D]),jsxRuntime.jsx(gn.Provider,{value:Ya,children:jsxRuntime.jsx(ul.Provider,{value:j0,children:jsxRuntime.jsxs("div",{ref:An,className:"flex flex-col h-full w-full",style:{backgroundColor:ra.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ra.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ra.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(si,{theme:ra,timeScale:nt,onTimeScaleChange:Je,zoom:D,onZoomChange:q,currentTheme:Ce,onThemeChange:L,rowDensity:z,onRowDensityChange:ne,showThemeSelector:c,showCreateTaskButton:x&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:k,taskFilter:Be,onTaskFilterChange:pt,hideCompleted:ie,onHideCompletedChange:be,toolbarRightContent:I,wbsLevel:ce,onWbsLevelChange:Pn,maxWbsDepth:tt,viewMode:Ue,onViewModeChange:Ne,projectForecast:O,onExportPNG:l?lf:void 0,onExportPDF:l?df:void 0,onExportExcel:l?cf:void 0,onExportCSV:l?uf:void 0,onExportJSON:l?pf:void 0,onExportMSProject:l?mf:void 0,showCriticalPath:Fe,onShowCriticalPathChange:zt,showDependencies:lt,onShowDependenciesChange:Ct,highlightWeekends:st,onHighlightWeekendsChange:ht,showBaseline:ze,onShowBaselineChange:E=>{E&&Ue!=="oracle"&&Ne("oracle"),!E&&Ue==="oracle"&&Ne("execution");},onCopySnapshotLink:at,hasDependencies:K0})}),jsxRuntime.jsxs("div",{ref:no,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ks,className:"gantt-grid-scroll flex-shrink-0",style:{width:_0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ci,{tasks:Rc,theme:ra,rowHeight:Cs,availableUsers:d,templates:Bc,showCriticalPath:Fe,onTaskClick:F,onTaskDblClick:Oc,onTaskContextMenu:ee,onTaskToggle:X0,scrollTop:K,columns:qo,onToggleColumn:Y0,onColumnResize:q0,onTaskUpdate:Xo,onTaskIndent:J0,onTaskOutdent:Q0,onTaskMove:ef,onMultiTaskDelete:el,onTaskDuplicate:tf,onTaskCreate:af,onTaskRename:rf,onCreateSubtask:tl,onOpenTaskModal:F?E=>F(E):void 0,onDeleteRequest:(E,R)=>fe({taskId:E,taskName:R}),onTaskReparent:Z0,scrollContainerRef:ks})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ra.border,zIndex:15},onMouseDown:gf}),jsxRuntime.jsx("div",{ref:Or,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:rl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(vi,{tasks:Rc,theme:ra,rowHeight:Cs,timeScale:nt,startDate:Jo,endDate:al,zoom:D,locale:y,templates:Bc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Oc,onTaskContextMenu:nf,onTaskDateChange:of,onDependencyCreate:Hc,onDependencyDelete:zc,showBaseline:ze,showCriticalPath:Fe,showDependencies:lt,highlightWeekends:st,canEditTask:pe?.canEditTask})})]}),Oe.task&&jsxRuntime.jsx(hn,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:ra,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Oe.task;if(!E)return [];let R=Pe.findTaskById(G,E.id)||E,_=R.subtasks&&R.subtasks.length>0,Q=pe?.canCreateTask!==false,ve=pe?.canDeleteTask!==false;if(_){let Ut=[],ea=pe?.canDuplicateTask!==false;return Q&&Ut.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ea&&Ut.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):de(ja=>Jn(ja,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),ve&&(Ut.length>0&&Ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ut.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),Ut}let Me=pe?.canUpdateTask!==false,kt=pe?.canDuplicateTask!==false,ot=[];return Me&&ot.push({id:"edit",label:Ya.contextMenu?.editTask||"Edit Task",icon:Qt.Pencil,onClick:()=>{ye?ye(R):M(R);}}),Q&&ot.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ot.length>0&&Me&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(ot.push({id:"markIncomplete",label:Ya.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qt.MarkIncomplete,onClick:()=>{U?U(R):Xo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:Ya.contextMenu?.setInProgress||"Set In Progress",icon:Qt.SetInProgress,onClick:()=>{oe?oe(R):Xo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:Ya.contextMenu?.markComplete||"Mark Complete",icon:Qt.MarkComplete,onClick:()=>{Xo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Me&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&ot.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):de(Ut=>Jn(Ut,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Me&&R.startDate&&R.endDate&&ot.push({id:"split",label:Ya.contextMenu?.splitTask||"Split Task",icon:Qt.Split,onClick:()=>{let Ut=R.startDate.getTime(),ea=R.endDate.getTime(),ja=Ut+(ea-Ut)/2,ur=new Date(ja);sf(R,ur);}}),ve&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),ot})()}),jsxRuntime.jsx(Jr,{task:gt,isOpen:!!gt,onClose:()=>M(null),onTaskUpdate:E=>{gt&&(Xo(gt.id,E),M(null));},theme:Ce==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&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:()=>fe(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ra.bgSecondary,border:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ra.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:ra.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ya.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ra.textPrimary},children:['"',le.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ra.bgPrimary,borderTop:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>fe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=ra.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{el([le.taskId]),fe(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Ci,{tasks:G,theme:ra,config:f,onTasksUpdate:de,onTaskUpdate:Xo,onTaskCreate:E=>{de(R=>[...R,E]);},onTaskDelete:E=>{el([E]);},onDependencyCreate:(E,R)=>{let _=Pe.findTaskById(G,E);_&&Hc(_,R);},onDependencyDelete:zc})]})})})});function Yv(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 qv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let 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 kd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Cd=[{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 bm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:b,defaultStatus:h}){let v=[...kd,...l.filter(D=>!kd.some(q=>q.id===D.id))],f=dt[c]||dt.dark,[y,w]=react.useState(false),[x,N]=react.useState(false),[k,S]=react.useState(false),[C,I]=react.useState(false),[$,P]=react.useState({top:0,left:0}),[te,O]=react.useState(null),[H,F]=react.useState(new Date),[J,ee]=react.useState({top:0,left:0}),[Re,B]=react.useState(false),[Y,ye]=react.useState([]),[Ge,U]=react.useState(false),[oe,Z]=react.useState(""),Se=react.useRef(null),ke=react.useRef(null),Ie=react.useRef(null),He=react.useRef(null),et=react.useRef(null),[ae,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,at]=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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:h||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),B(false),ye([]));},[a,e,h]),react.useEffect(()=>{let D=q=>{Se.current&&!Se.current.contains(q.target)&&w(false),ke.current&&!ke.current.contains(q.target)&&N(false),Ie.current&&!Ie.current.contains(q.target)&&S(false),He.current&&!He.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let mt=()=>{let D={};return ae.name.trim()||(D.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),at(D),Object.keys(D).length===0},Pt=async D=>{if(D.preventDefault(),!!mt())try{let q=i==="create"&&Y.length>0?{...ae,pendingFiles:Y}:ae;await s(q),ye([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(D,q)=>{Xe(ce=>{let Te={...ce,[D]:q};if(D==="status"){let W=q;W==="todo"?Te.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Te.progress=50):W==="completed"||W==="closed"?Te.progress=100:(W==="in-review"||W==="review")&&(Te.progress=75);}if(D==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ce.status!=="completed"?Te.status="completed":W>0&&W<100&&ce.status==="todo"?Te.status="in-progress":W===0&&ce.status!=="todo"&&(Te.status="todo");}return Te}),pe[D]&&at(ce=>{let Te={...ce};return delete Te[D],Te});},yt=v.find(D=>D.id===ae.status)??kd[0],nt=Cd.find(D=>D.id===ae.priority)??Cd[1],Je=Bo.find(D=>D.value===ae.color)??Bo[0],z=c==="dark",ne={backgroundColor:z?"#141414":f.bgSecondary,border:`1px solid ${z?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:z?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,WebkitBackdropFilter:z?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:yt.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=f.hoverBg,D.currentTarget.style.color=f.textPrimary;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ae.name,onChange:D=>Ce("name",D.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ae.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:D=>Ce("description",D.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,borderColor:yt.color,backgroundColor:`${yt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsxRuntime.jsx("span",{style:{color:yt.color},children:yt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:yt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",D.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ae.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:nt.color}}),jsxRuntime.jsx("span",{children:nt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Cd.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",D.id),N(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,ae.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((D,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},q))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let q=ae.assignees?.some(ce=>ce.name===D.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=q?(ae.assignees||[]).filter(Te=>Te.name!==D.name):[...ae.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children: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:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)I(false);else {if(He.current){let D=He.current.getBoundingClientRect(),q=window.innerHeight,ce=120,W=q-D.bottom<ce?D.top-ce-8:D.bottom+8;P({top:W,left:D.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Je.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"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:Bo.slice(0,18).map(D=>{let q=ae.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),Ce("color",D.value),I(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:q?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(uo,{selectedTags:ae.tags||[],availableTags:p,onChange:D=>Ce("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:et,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="start")O(null);else {if(et.current){let D=et.current.getBoundingClientRect(),q=window.innerHeight,ce=320,W=q-D.bottom<ce?D.top-ce-8:D.bottom+8;ee({top:W,left:D.left});}O("start"),F(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="end")O(null);else {if(et.current){let D=et.current.getBoundingClientRect(),q=window.innerHeight,ce=320,W=q-D.bottom<ce?D.top-ce-8:D.bottom+8;ee({top:W,left:D.left});}O("end"),F(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"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 ${z?"#262626":f.border}`},children:[(()=>{let D=new Date,q=new Date(D);q.setDate(D.getDate()+1);let ce=new Date(D);ce.setDate(D.getDate()+7);let Te=new Date(D);return Te.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Te}].map((re,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{te==="start"?(Ce("startDate",re.date),(!ae.endDate||re.date>ae.endDate)&&Ce("endDate",re.date),O("end")):(Ce("endDate",re.date),(!ae.startDate||re.date<ae.startDate)&&Ce("startDate",re.date),O(null));},children:re.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=H.getFullYear(),q=H.getMonth(),ce=new Date(D,q,1).getDay(),Te=new Date(D,q+1,0).getDate(),W=new Date,re=[];for(let Ne=ce-1;Ne>=0;Ne--)re.push({day:new Date(D,q,-Ne).getDate(),date:new Date(D,q-1,new Date(D,q,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)re.push({day:Ne,date:new Date(D,q,Ne),isCurrentMonth:true});let Ue=42-re.length;for(let Ne=1;Ne<=Ue;Ne++)re.push({day:Ne,date:new Date(D,q+1,Ne),isCurrentMonth:false});return re.map((Ne,ze)=>{let Fe=Ne.date.toDateString()===W.toDateString(),Ke=ae.startDate?.toDateString()===Ne.date.toDateString(),lt=ae.endDate?.toDateString()===Ne.date.toDateString(),ut=ae.startDate&&ae.endDate&&Ne.date>=ae.startDate&&Ne.date<=ae.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?Ke||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:lt?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ke&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{te==="start"?(Ce("startDate",Ne.date),ae.endDate&&Ne.date>ae.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ae.startDate&&Ne.date<ae.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},ze)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:D=>Ce("progress",parseInt(D.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ae.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?Yv(ae.effortMinutes):"",onChange:D=>{let q=qv(D.target.value);Ce("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?Y.length>0&&`(${Y.length})`:m.length>0&&`(${m.length})`]})]}),i==="create"?jsxRuntime.jsx(Vr,{cardId:"pending",attachments:Y.map((D,q)=>({id:`pending-${q}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>ye(q=>[...q,...D]),onDelete:D=>{let q=parseInt(D.replace("pending-",""),10);ye(ce=>ce.filter((Te,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Vr,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),i==="create"&&Y.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[Y.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:D=>Ce("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(D=>{let q=r.find(ce=>ce.id===D);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=(ae.dependencies||[]).filter(Te=>Te!==D);Ce("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},D)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!Ge),Z("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),Z("");}}),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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:D=>Z(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>oe===""||D.name.toLowerCase().includes(oe.toLowerCase())).map(D=>{let q=ae.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ce=ae.dependencies||[],Te;q?Te=ce.filter(W=>W!==D.id):Te=[...ce,D.id],Ce("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{q||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:D=>!n&&(D.currentTarget.style.opacity="0.9"),onMouseLeave:D=>!n&&(D.currentTarget.style.opacity="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:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var hm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -406,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
406
406
 
407
407
  Always try to match task names case-insensitively and handle partial matches.
408
408
  If you can't find a task by name, search through the provided task list.
409
- If ambiguous, ask for clarification in the message field.`;function hm(e){return `CURRENT TASKS:
410
- ${ym(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
409
+ If ambiguous, ask for clarification in the message field.`;function ym(e){return `CURRENT TASKS:
410
+ ${xm(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 ym(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function to(e,t){let a=ym(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function kd(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 b=new Date(r),h=b.getDay(),v=g-h;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}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(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+m):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+m),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let m=parseInt(i[1],10),g=parseInt(i[2],10)-1,b=parseInt(i[3],10);return new Date(b,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=parseInt(l[1],10),g=c[l[2].toLowerCase()],b=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=p[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(b,m,g)}return null}function Cd(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 Td(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 xm(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 vm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),p=r[2].trim(),d=to(t,l),m=kd(p);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(m);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:b},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),d=to(t,l),m=Cd(p);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),d=to(t,l),m=Td(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,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 l=n[1].trim(),p=n[2].trim(),d=to(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),d=to(t,l),m=to(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=to(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function wm(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 qv(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 Xv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ti(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ti(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:qv(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:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function km(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:Xv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ti(r,e,t))}var Nd={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"}},Dd={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"}},Ni={en:Nd,es:Dd};function Sd(e){return Ni[e]||Ni.en}function Di(e,t){let a=Sd(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 Ed=[{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 Tm(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 Nm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Tm(e),l=Ed[0],p=Ed.find(g=>g.value===c)??l,d=p.icon,m=g=>{switch(Tm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ed.map(g=>{let b=g.icon;return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Fd=[{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 Sm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=Fd.find(p=>p.value===e)??Fd[4],l=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Fd.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[l]})]},p.value))})]})}function as(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Md(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 Pm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=react.useState(false),[c,l]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let h=v=>{p.current&&!p.current.contains(v.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=h=>e.some(v=>v.name===h),b=h=>{if(a){if(g(h.name))a(e.filter(v=>v.name!==h.name));else {let v={name:h.name,initials:as(h.name),color:h.color||Md(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,v]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,v)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)},`${h.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,v)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)},`${h.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:h=>l(h.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.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((h,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==h.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${h.name}-${v}`))}),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(h=>{let v=g(h.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),b(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):as(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},h.id)})})]})]})}function Im({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,p]=react.useState(false),[d,m]=react.useState(o),[g,b]=react.useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),h=react.useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=T=>{h.current&&!h.current.contains(T.target)&&p(false);};return l&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),react.useEffect(()=>{l&&m(r?o:"start");},[l,r,o]);let y=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),I=new Date(D,T,1),A=new Date(D,T+1,0).getDate(),_=I.getDay(),E=[],L=new Date(D,T,0).getDate();for(let Z=_-1;Z>=0;Z--)E.push({date:new Date(D,T-1,L-Z),isCurrentMonth:false});for(let Z=1;Z<=A;Z++)E.push({date:new Date(D,T,Z),isCurrentMonth:true});let X=42-E.length;for(let Z=1;Z<=X;Z++)E.push({date:new Date(D,T+1,Z),isCurrentMonth:false});return E},[g]),x=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),p(false);else if(d==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),p(false);}},C=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let I=new Date(D);I.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let A=new Date(D);A.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let _=new Date(D);_.setDate(D.getDate()+14);let E=new Date(D);return E.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let D=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(D)})]})}let k=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:D=>{D.stopPropagation(),p(!l);let T=o==="start"?v:f;T&&b(new Date(T.getFullYear(),T.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(k)})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,T)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),p(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>b(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let I=D.date.toDateString()===new Date().toDateString(),$=v?.toDateString()===D.date.toDateString(),A=f?.toDateString()===D.date.toDateString(),_=$||A,E=!r&&v&&f&&D.date>=v&&D.date<=f;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(D.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",A&&!$&&"bg-[#7C3AED] text-white",E&&!_&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!_&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function Fi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Im,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Cn(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 Mi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,m=e,g=m-d,b=r/o;c(true);for(let h=1;h<=o;h++){let v=setTimeout(()=>{let f=h/o,y=1-Math.pow(1-f,3),w=Math.round(d+g*y);n(w),h===o&&(c(false),n(m));},b*h);p.current.push(v);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function Bm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let b=Date.now();l.current=setInterval(()=>{let h=Date.now()-b,v=Math.min(h/a*100,100);i(v);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Om({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=react.useState(false),[c,l]=react.useState(""),p=react.useRef(null),{isFlashing:d,triggerFlash:m}=Cn(),{displayValue:g,isAnimating:b}=Mi(e,{enabled:o,duration:300,steps:6}),h=x=>{if(r||!t)return;x.stopPropagation();let C=x.currentTarget.getBoundingClientRect(),k=x.clientX-C.left,D=Math.round(k/C.width*100),T=Math.max(0,Math.min(100,D));T!==e&&(t(T),s&&m());},v=react.useCallback(x=>{r||!t||(x.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=react.useCallback(()=>{i(false);let x=parseInt(c,10);if(!isNaN(x)&&t){let C=Math.max(0,Math.min(100,x));C!==e&&(t(C),s&&m());}},[c,t,e,s,m]),y=react.useCallback(x=>{x.key==="Enter"&&f(),x.key==="Escape"&&i(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:h,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",b&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:p,value:c,onChange:x=>l(x.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:y,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:v,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",b&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Vm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:b,triggerFlash:h}=Cn(),{displayValue:v,isAnimating:f}=Mi(e,{enabled:i&&!l});react.useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let y=()=>{let x=parseFloat(d);if(!isNaN(x)){let C=x;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&h());}p(false);},w=x=>{x.key==="Enter"?y():x.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):l?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:x=>m(x.target.value),onBlur:y,onKeyDown:w,onClick:x=>x.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),p(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),b&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Gm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let l=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function jm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:p}=Bm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?p():l(!e):t(!e));},m=i?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&m&&"ring-green-500/50",i&&!m&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function qm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function I2(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 B2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let 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 mr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[p,d]=react.useState(false),[m,g]=react.useState(""),b=react.useRef(null),{isFlashing:h,triggerFlash:v}=Cn(),f=c==="financial"&&l>0,y=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:I2(e,r);react.useEffect(()=>{p&&b.current&&(b.current.focus(),b.current.select());},[p]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?g(`${k}h ${D}m`):k>0?g(`${k}h`):g(`${D}m`);}else g("");},[e,p]);let w=()=>{let k=B2(m);k!==e&&(t?.(k),n&&v()),d(false);},x=k=>{k.key==="Enter"?w():k.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let C=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:y})]}):p?jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:k=>g(k.target.value),onBlur:w,onKeyDown:x,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left 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",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:y})]})}function Zm({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function tg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,d=Z=>p?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[m,g]=react.useState(false),[b,h]=react.useState(false),[v,f]=react.useState(null),y=react.useRef(null),w=e.timeLoggedMinutes||0,x=e.effortMinutes||0,C=e.soldEffortMinutes||0,k=Math.round(w/60*10)/10,D=Math.round(x/60*10)/10,T=x>0?w/x*100:0,I=T>100?Math.round((w-x)/60*10)/10:0,$=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!b&&!v)return;let Z=He=>{y.current&&!y.current.contains(He.target)&&(h(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[b,v]);let A=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){h(He=>!He),f(null);return}n&&n(e);},_=Z=>{h(false),f(Z);},E=async(Z,He)=>{v==="log"&&r&&Z?r(e,Z,He):v==="estimate"&&o?o(e,Z):v==="quoted"&&s&&s(e,Z),f(null);},me=r||o||s||n,L=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),X=v==="estimate"?x:v==="quoted"?C:void 0;return x===0&&w===0&&C===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&me&&jsxRuntime.jsx("button",{onClick:A,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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(Z=>jsxRuntime.jsxs("button",{onClick:He=>{He.stopPropagation(),_(Z.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:He=>{He.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:He=>{He.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(k)}),x>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),I>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(I)," Over"]})]}),x>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),me&&jsxRuntime.jsx("button",{onClick:A,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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(Z=>jsxRuntime.jsxs("button",{onClick:He=>{He.stopPropagation(),_(Z.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:He=>{He.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:He=>{He.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]})}function W2(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 V2(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 ag({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function rg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=W2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,b)=>jsxRuntime.jsx(ag,{assignee:g,size:24,isDark:t},g.name+b))}),m>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?V2(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ag,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var G2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function ng({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",G2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function l1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function d1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function dg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let b=react.useRef(null),h=r==="es"?ig.es:ig.en;if(react.useEffect(()=>{let x=k=>{b.current&&!b.current.contains(k.target)&&t();},C=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",x),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let x=[];return o&&x.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),x.push({id:"sep1",label:"",icon:null,separator:true}),i&&(x.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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),x.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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&x.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.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:C.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],T=k.some(I=>I.name===C.name)?k.filter(I=>I.name!==C.name):[...k,{name:C.name,initials:l1(C.name),color:C.color||d1(C.name),avatar:C.avatarUrl}];i({...e.task,assignees:T}),t();}}))})),d&&x.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&x.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&x.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),x.push({id:"sep2",label:"",icon:null,separator:true}),s&&x.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&x.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),x},f=()=>{if(!e.columnId)return [];let x=[];return l&&(x.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),x.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(x.push({id:"sep-hide",label:"",icon:null,separator:true}),x.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),x},y=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:y.map(x=>x.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},x.id):x.submenu?jsxRuntime.jsx(c1,{item:x,isDark:a},x.id):jsxRuntime.jsxs("button",{onClick:x.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",x.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(x.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:x.icon}),x.label]},x.id))})}function c1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxRuntime.jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var ig={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",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",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 yg={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"})},D1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function vg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=react.useState(""),[p,d]=react.useState(null),m=react.useRef(null),g=i==="es"?xg.es:xg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let x=()=>{if(!m.current)return;let C=m.current.getBoundingClientRect(),D=window.innerHeight-C.top-20;d(Math.max(300,D));};return requestAnimationFrame(x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[e]),react.useEffect(()=>{if(!e)return;let x=setTimeout(()=>{let C=D=>{m.current&&!m.current.contains(D.target)&&t();},k=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",k),m._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(x),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let b=x=>g.columns[x]||x,h=x=>{if(x==="name")return;let C=a.map(k=>k.id===x?{...k,visible:!k.visible}:k);o(C);},v=(x,C)=>{let k=a.find(T=>T.type===x&&(!C||T.customFieldId===C));if(k){h(k.id);return}let D={id:C||x,type:x,label:C?r.find(T=>T.id===C)?.name||x:b(x),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,D]);},f=D1.filter(x=>b(x).toLowerCase().includes(c.toLowerCase())),y=r.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...p?{maxHeight:`${p}px`}:{},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)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 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:g.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:x=>{x.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",x.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:x=>l(x.target.value),placeholder:g.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:x=>{x&&x.style.setProperty("--focus-border",w);},onFocus:x=>{x.currentTarget.style.borderColor=w,x.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:x=>{x.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",x.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:x=>x.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:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(x=>{let C=a.find(T=>T.type===x&&!T.customFieldId),k=C?.visible??false,D=x==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(C?h(C.id):v(x));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.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:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&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:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:yg[x]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?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:b(x)})]},x)})})]}),y.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:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:y.map(x=>{let k=a.find(D=>D.customFieldId===x.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(x.type,x.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.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:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&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:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:yg[x.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?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:x.name})]},x.id)})})]})]})]})}var xg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",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",assignees:"Asignados",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 B1=[{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 Cg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[i,c]=react.useState("text"),[l,p]=react.useState([""]),d=o==="es"?kg.es:kg.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:i};i==="dropdown"&&(v.options=l.filter(f=>f.trim())),a(v),t();},g=()=>{p([...l,""]);},b=(v,f)=>{let y=[...l];y[v]=f,p(y);},h=v=>{l.length>1&&p(l.filter((f,y)=>y!==v));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:B1.map(v=>jsxRuntime.jsxs("button",{onClick:()=>c(v.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===v.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:i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:u("text-xs",i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((v,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:v,onChange:y=>b(f,y.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>h(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var kg={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 Dg={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 Sg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),p=s==="es"?Dg.es:Dg.en;react.useEffect(()=>{if(!n)return;let g=h=>{Date.now()-l.current<100||c.current&&!c.current.contains(h.target)&&i(false);},b=h=>{h.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(b=>!b);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,h=()=>g.value==="all"?b?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),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(b?g.color:"text-gray-400","flex-shrink-0"),children:h()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Eg(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 Fg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxRuntime.jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,i=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,l=c?"#FF2D20":i>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",c?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Eg(s)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Eg(n)})]}),n>0&&jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${i}%`,backgroundColor:l}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,i=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:i?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",i&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!i&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let i=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:i}})})]},`${s.name}-${n}`)})})]})]})}var J1=[{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 Bg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Bg(r.subtasks,t+1));return a}function Q1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function Z1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Sn(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=Sn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Dn(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 ew({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:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Rg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:w=false,onCreateTask:x,persistFilter:C=false,financialBlur:k,healthSidebar:D,lens:T="hours",hourlyRate:I=0,aggregateParentHours:$=false,showProjectTotals:A=false}=t,_=Di(d,m),E=p==="dark",me=react.useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(C);if(M){let J=JSON.parse(M);return {statusFilter:J.statusFilter||"all",hideCompleted:J.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[C]),L=react.useMemo(()=>{function M(J){let ye=0,Le=0,Oe=0;for(let B of J)if(B.subtasks&&B.subtasks.length>0){let z=M(B.subtasks);ye+=z.spent,Le+=z.allocated,Oe+=z.quoted;}else ye+=B.timeLoggedMinutes??0,Le+=B.effortMinutes??0,Oe+=B.soldEffortMinutes??0;return {spent:ye,allocated:Le,quoted:Oe}}return M(e)},[e]),X=react.useMemo(()=>{let M=new Map;function J(ye){let Le=0;for(let Oe of ye)if(Oe.subtasks&&Oe.subtasks.length>0){let B=J(Oe.subtasks);M.set(Oe.id,B),Le+=B;}else Le+=Oe.weight||0;return Le}return J(e),M},[e]),Z=react.useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:L.spent,totalHoursAllocatedMinutes:L.allocated}},[D,L]),[He,O]=react.useState(true),[j,he]=react.useState("position"),[je,U]=react.useState("asc"),[re,ee]=react.useState(""),[Ee,we]=react.useState(()=>me().statusFilter),[Be,ze]=react.useState(()=>me().hideCompleted),[Qe,te]=react.useState(h||J1),[tt,pe]=react.useState(false),[at,pt]=react.useState(false),[Et,Ce]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[rt,it]=react.useState("all"),[Ze,H]=react.useState(false),de=react.useRef(null),N=react.useRef(null),Y=react.useMemo(()=>{let M=0;function J(ye,Le){for(let Oe of ye)Le>M&&(M=Le),Oe.subtasks?.length&&J(Oe.subtasks,Le+1);}return J(e,1),M},[e]);react.useEffect(()=>{if(!Ze)return;let M=J=>{de.current?.contains(J.target)||N.current?.contains(J.target)||H(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[Ze]),react.useEffect(()=>{if(rt==="all"){let ye=function(Le){for(let Oe of Le)Oe.subtasks?.length&&(Oe.isExpanded===false&&a.onTaskToggleExpand?.(Oe.id),ye(Oe.subtasks));};ye(e);}else {let ye=function(Le,Oe){for(let B of Le)if(B.subtasks?.length){let z=Oe<rt,ne=B.isExpanded!==false;z!==ne&&a.onTaskToggleExpand?.(B.id),ye(B.subtasks,Oe+1);}};ye(e,1);}},[rt]);let[ie,ke]=react.useState(null),[V,ae]=react.useState(0),[Ve,De]=react.useState(0),Ue=react.useRef(null),[Ne,Ke]=react.useState(null),[bt,lt]=react.useState(null);react.useEffect(()=>{h&&te(h);},[h]),react.useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:Ee,hideCompleted:Be}));}catch(M){console.error("Error persisting filter state:",M);}},[C,Ee,Be]);let nt=react.useMemo(()=>{let M=new Set;function J(ye){for(let Le of ye)Le.subtasks?.length&&(Le.isExpanded!==false&&M.add(Le.id),J(Le.subtasks));}return J(e),M},[e]),et=react.useMemo(()=>Qe.filter(M=>M.visible),[Qe]),At=react.useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Mt=react.useCallback(M=>{j===M?U(J=>J==="asc"?"desc":"asc"):(he(M),U("asc")),a.onSortChange?.({column:M,direction:je==="asc"?"desc":"asc"});},[j,je,a]),mt=react.useCallback(M=>{te(M),a.onColumnsChange?.(M);},[a]),yt=react.useCallback(M=>{let J=Qe.map(ye=>ye.id===M?{...ye,visible:false}:ye);mt(J);},[Qe,mt]),gt=react.useCallback((M,J)=>{he(M),U(J);},[]),Pt=react.useCallback((M,J,ye)=>{y&&(M.preventDefault(),Ce({isOpen:true,x:M.clientX,y:M.clientY,type:J?"task":"header",task:J,columnId:ye}));},[y]),Ge=react.useCallback(()=>{Ce(M=>({...M,isOpen:false}));},[]),Re=react.useCallback((M,J)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let ye=Qe.find(Le=>Le.id===J);ye&&(ke(J),ae(M.clientX),De(ye.width));},[Qe,f]);react.useEffect(()=>{if(!ie)return;let M=ye=>{let Le=ye.clientX-V,Oe=Math.max(50,Ve+Le),B=Qe.map(z=>z.id===ie?{...z,width:Oe}:z);te(B);},J=()=>{ie&&a.onColumnsChange?.(Qe),ke(null);};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",J),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",J);}},[ie,V,Ve,Qe,a]);let ut=react.useCallback((M,J)=>{if(J==="name"){M.preventDefault();return}Ke(J),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",J),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),le=react.useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Ke(null),lt(null);},[]),fe=react.useCallback((M,J)=>{M.preventDefault(),J!=="name"&&(M.dataTransfer.dropEffect="move",lt(J));},[]),P=react.useCallback(()=>{lt(null);},[]),K=react.useCallback((M,J)=>{if(M.preventDefault(),!Ne||Ne===J||J==="name")return;let ye=[...Qe],Le=ye.findIndex(z=>z.id===Ne),Oe=ye.findIndex(z=>z.id===J);if(Le===-1||Oe===-1)return;let B=ye.splice(Le,1);B[0]&&(ye.splice(Oe,0,B[0]),mt(ye),Ke(null),lt(null));},[Ne,Qe,mt]),q=react.useCallback(async M=>{if(a.onCreateCustomField){let J={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(J);}pt(false);},[a]),ce=react.useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Se=react.useMemo(()=>{let M=Bg(e);if(re.trim()){let J=re.toLowerCase();M=M.filter(ye=>ye.name.toLowerCase().includes(J));}return Ee!=="all"&&(M=M.filter(J=>ce(J)===Ee)),Be&&(M=M.filter(J=>ce(J)!=="completed")),M.sort((J,ye)=>{let Le,Oe;switch(j){case "name":Le=J.name.toLowerCase(),Oe=ye.name.toLowerCase();break;case "startDate":Le=J.startDate?.getTime()||0,Oe=ye.startDate?.getTime()||0;break;case "endDate":Le=J.endDate?.getTime()||0,Oe=ye.endDate?.getTime()||0;break;case "progress":Le=J.progress||0,Oe=ye.progress||0;break;case "status":Le=J.status||"todo",Oe=ye.status||"todo";break;case "priority":let B={urgent:0,high:1,medium:2,low:3,none:4};Le=B[J.priority]??4,Oe=B[ye.priority]??4;break;case "position":return 0;default:return 0}return Le<Oe?je==="asc"?-1:1:Le>Oe?je==="asc"?1:-1:0}),M},[e,re,Ee,Be,j,je,ce]),Xe=react.useCallback((M,J)=>{let ye=B=>{a.onTaskUpdate?.({...M,...B});},Le=B=>B?M.customFields?.find(ne=>ne.fieldId===B)?.value:void 0,Oe=(B,z)=>{if(!B)return;let S=[...M.customFields||[]],oe=S.findIndex(Te=>Te.fieldId===B);oe>=0?S[oe]={fieldId:B,value:z}:S.push({fieldId:B,value:z}),ye({customFields:S});};switch(J.type){case "name":return null;case "status":return jsxRuntime.jsx(Nm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:z=>{ye({status:z,progress:z==="completed"?100:z==="in-progress"?50:0});},isDark:E,locale:d,translations:_.status});case "priority":return jsxRuntime.jsx(Sm,{value:M.priority,onChange:z=>ye({priority:z}),isDark:E,locale:d});case "assignees":{let z=M.hasChildren,ne=M.assignees||[];if(z&&M.subtasks?.length){let S=new Map;(M.assignees||[]).forEach(Te=>S.set(Te.name,Te));let oe=Te=>{(Te||[]).forEach(We=>{(We.assignees||[]).forEach(Tt=>{S.has(Tt.name)||S.set(Tt.name,Tt);}),We.subtasks?.length&&oe(We.subtasks);});};oe(M.subtasks),ne=Array.from(S.values());}return jsxRuntime.jsx(Pm,{value:ne,availableUsers:i,onChange:S=>ye({assignees:S}),isDark:E,locale:d,disabled:z})}case "startDate":return jsxRuntime.jsx(Fi,{value:M.startDate,onChange:z=>ye({startDate:z}),isDark:E,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsxRuntime.jsx(Fi,{value:M.endDate,onChange:z=>ye({endDate:z}),isDark:E,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":return jsxRuntime.jsx(Om,{value:M.progress||0,onChange:z=>{let ne=z===100?"completed":z>0?"in-progress":"todo";ye({progress:z,status:ne});},isDark:E});case "tags":return jsxRuntime.jsx(qm,{value:M.tags||[],isDark:E});case "text":return jsxRuntime.jsx(zm,{value:Le(J.customFieldId)||"",onChange:z=>Oe(J.customFieldId,z),isDark:E});case "number":return jsxRuntime.jsx(Vm,{value:Le(J.customFieldId)||0,onChange:z=>Oe(J.customFieldId,z),isDark:E});case "date":let B=Le(J.customFieldId);return jsxRuntime.jsx(Fi,{value:B?new Date(B):void 0,onChange:z=>Oe(J.customFieldId,z),isDark:E,locale:d});case "dropdown":return jsxRuntime.jsx(Gm,{value:Le(J.customFieldId)||"",options:J.options||[],onChange:z=>Oe(J.customFieldId,z),isDark:E});case "checkbox":return jsxRuntime.jsx(jm,{value:Le(J.customFieldId)||false,onChange:z=>Oe(J.customFieldId,z),isDark:E});case "estimatedTime":{let z=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(mr,{value:M.estimatedTime,onChange:ne=>ye({estimatedTime:ne}),isDark:E,locale:d,disabled:z,lens:T,hourlyRate:I})}case "quotedTime":{let z=M.status==="completed"||M.progress===100,ne=k?.enabled&&(!k.columns||k.columns.includes("quotedTime"));return jsxRuntime.jsx(mr,{value:M.quotedTime,onChange:S=>ye({quotedTime:S}),isDark:E,locale:d,disabled:z,isBlurred:ne,lens:T,hourlyRate:I})}case "elapsedTime":{let z=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(mr,{value:M.elapsedTime,onChange:ne=>ye({elapsedTime:ne}),isDark:E,locale:d,disabled:z,lens:T,hourlyRate:I})}case "effortMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{allocated:ne}=Sn(M);return jsxRuntime.jsx(mr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I})}let z=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(mr,{value:M.effortMinutes,onChange:ne=>ye({effortMinutes:ne}),isDark:E,locale:d,disabled:z,lens:T,hourlyRate:I})}case "timeLoggedMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{spent:ne}=Sn(M);return jsxRuntime.jsx(mr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I})}let z=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(mr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?ne=>{a.onLogTime?.(M,ne);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:z,lens:T,hourlyRate:I})}case "soldEffortMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{quoted:S}=Sn(M),oe=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(mr,{value:S>0?S:void 0,isDark:E,locale:d,disabled:true,isBlurred:oe,lens:T,hourlyRate:I})}let z=M.status==="completed"||M.progress===100,ne=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(mr,{value:M.soldEffortMinutes,onChange:S=>ye({soldEffortMinutes:S}),isDark:E,locale:d,disabled:z,isBlurred:ne,lens:T,hourlyRate:I})}case "scheduleVariance":{let z=M.effortMinutes||0,ne=M.soldEffortMinutes||0,S=M.timeLoggedMinutes||0,oe=z>0||ne>0||S>0;return jsxRuntime.jsx(Zm,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:E,locale:d,hasTimeAllocated:oe})}case "hoursBar":{if($&&M.hasChildren){let{spent:z,allocated:ne,quoted:S}=Sn(M),oe=z>ne&&ne>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",oe?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Dn(z)}),ne>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:E?"text-white/60":"text-gray-600",children:Dn(ne)})]}),S>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Dn(S)})]})]})}return jsxRuntime.jsx(tg,{task:M,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:I})}case "teamLoad":return jsxRuntime.jsx(rg,{task:M,isDark:E,locale:d});case "blockers":return jsxRuntime.jsx(ng,{blockers:M.blockers,isDark:E,locale:d});case "weight":{let z=X.get(M.id);if(z!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",z>0?E?"text-white/50":"text-gray-400":E?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:z>0?`${Number(z.toFixed(2))}%`:"\u2014"});let ne=M.weight||0;return jsxRuntime.jsx(ew,{value:ne,onChange:S=>ye({weight:S}),isDark:E})}default:return jsxRuntime.jsx("span",{className:u("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,i,_,$,X]),_e=react.useCallback(M=>{let ye={name:_.columns.name,status:_.columns.status,priority:_.columns.priority,assignees:_.columns.assignees,startDate:_.columns.startDate,endDate:_.columns.endDate,progress:_.columns.progress,tags:_.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:_.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:_.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:_.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:_.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:_.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:_.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:_.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:_.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:_.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:_.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:_.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof ye=="string"?ye:String(ye||M.type)},[_,d]),Ie=react.useMemo(()=>{let ye=et.reduce((Oe,B)=>Oe+B.width,0)+(v?48:0),Le={};for(let Oe of et)Le[Oe.id]=`${Oe.width/ye*100}%`;return Le},[et,v]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:[_.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:_.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:_.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Ue,className:u(E?"bg-[#0D0D0D]":"bg-white",ie&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:[Se.length," ",_.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:re,onChange:M=>ee(M.target.value),placeholder:_.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"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"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),b&&Y>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:de,onClick:()=>H(!Ze),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",E?Ze?"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]":Ze?"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"}),rt==="all"?d==="es"?"Todos":"All":`L${rt}`]}),Ze&&jsxRuntime.jsx("div",{ref:N,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",E?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Y,5)},(M,J)=>({value:J+1,label:`L${J+1}`}))].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{it(M.value),H(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",E?rt===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":rt===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:M.label}),rt===M.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsxRuntime.jsx(Sg,{value:Ee,hideCompleted:Be,onChange:we,onHideCompletedChange:ze,isDark:E,locale:d}),Z?.enabled&&Z.data&&!He&&jsxRuntime.jsx("button",{onClick:()=>O(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),w&&x&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,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:_.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[et.map(M=>{let J=M.id!=="name",ye=bt===M.id&&Ne!==M.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",J&&"cursor-grab",Ne===M.id&&"opacity-50",ye&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Ie[M.id],minWidth:M.minWidth},draggable:J,onDragStart:J?Le=>ut(Le,M.id):void 0,onDragEnd:J?le:void 0,onDragOver:J?Le=>fe(Le,M.id):void 0,onDragLeave:J?P:void 0,onDrop:J?Le=>K(Le,M.id):void 0,onContextMenu:Le=>Pt(Le,void 0,M.id),children:[J&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>Mt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[_e(M),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",j===M.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:_e(M)}),f&&M.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ie===M.id&&"bg-[#007BFF]"),onMouseDown:Le=>Re(Le,M.id)})]},M.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),pe(J=>!J);},className:u("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",tt&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(vg,{isOpen:tt,onClose:()=>pe(false),columns:Qe,customFields:c,onColumnsChange:mt,onCreateCustomField:()=>{pe(false),pt(true);},isDark:E,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Se.map((M,J)=>{let ye=nt.has(M.id),Le=Math.min(J*.01,.2),Oe=M.hasChildren&&M.level===0,B=M.subtasks?.length||0;if(Oe){let{spent:z,allocated:ne,quoted:S}=Sn(M),oe=Q1(M),Te=Z1(M);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Le},className:u("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:et.map(We=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:Ie[We.id],minWidth:We.minWidth},children:We.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Tt=>{Tt.stopPropagation(),At(M.id);},className:u("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",E?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Tt=>{Tt.stopPropagation(),At(M.id);},className:"flex-shrink-0 cursor-pointer",children:ye?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxRuntime.jsx("span",{title:M.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:M.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",B," ",d==="es"?B===1?"Tarea":"Tareas":B===1?"Item":"Items",")"]}),oe!==null&&jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",oe>=1?"text-[#32D74B]":oe>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",oe.toFixed(2)]}),Te>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Te]})]}):We.type==="timeLoggedMinutes"?jsxRuntime.jsx(mr,{value:z>0?z:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I}):We.type==="soldEffortMinutes"?jsxRuntime.jsx(mr,{value:S>0?S:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I}):We.type==="effortMinutes"?jsxRuntime.jsx(mr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I}):Xe(M,We)},We.id))},M.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Le},className:u("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:z=>Pt(z,M),children:[et.map(z=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:Ie[z.id],minWidth:z.minWidth},children:z.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&M.level>0&&jsxRuntime.jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),b&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),At(M.id);},className:u("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",E?"text-white/60":"text-gray-400")})}),b&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate font-bold text-[13px]",M.progress===100?E?"line-through text-white/50":"line-through text-gray-400":E?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Xe(M,z)},z.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),A&&Se.length>0&&(()=>{let{spent:M,allocated:J,quoted:ye}=L,Le=J-M,Oe=Le<0,B=Oe?`+${Dn(Math.abs(Le))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Dn(Le)} ${d==="es"?"AHORRADO":"SAVED"}`,z=T==="financial"&&I>0,ne=Te=>z?`$${(Te/60*I).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Dn(Te),S=z?Math.abs(Le/60*I):0,oe=z?`${Oe?"+":"-"}$${S.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Oe?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:B;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[et.map(Te=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:Ie[Te.id],minWidth:Te.minWidth},children:Te.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Te.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(M)}),jsxRuntime.jsx("span",{className:u("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(J)}),J>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold ml-1",Oe?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:z?oe:B})]}):Te.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?ne(ye):"\u2013"}):Te.type==="effortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:J>0?ne(J):"\u2013"}):Te.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?ne(M):"\u2013"}):Te.type==="progress"?(()=>{let We=e||[],Tt=0,Nt=0,la=0,aa=0;for(let Ut of We){let ua=Ut.weight||X.get(Ut.id)||0,Mn=Ut.progress||0;ua>0&&(Tt+=Mn*ua,Nt+=ua),la+=Mn,aa++;}let ya=Nt>0?Math.round(Tt/Nt*10)/10:aa>0?Math.round(la/aa):0;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",E?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[ya,"%"]})})():Te.type==="weight"?(()=>{let We=e||[],Tt=[],Nt=Ut=>{for(let ua of Ut)Tt.push(ua),ua.subtasks?.length&&Nt(ua.subtasks);};Nt(We);let aa=Tt.filter(Ut=>!Ut.subtasks?.length||Ut.subtasks.length===0).reduce((Ut,ua)=>Ut+(ua.weight||0),0),ya=Math.abs(aa-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",ya?E?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(aa.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},Te.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Se.length===0&&re&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(E?"text-white/60":"text-gray-600"),children:_.empty.noResults})]})})]})}),Z?.enabled&&Z.data&&He&&jsxRuntime.jsx(Fg,{data:Z.data,isDark:E,locale:d,onClose:()=>O(false)})]}),jsxRuntime.jsx(dg,{state:Et,onClose:Ge,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:yt,onColumnSort:gt,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(Cg,{isOpen:at,onClose:()=>pt(false),onSave:q,isDark:E,locale:d})]})}var Og=[{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:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,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}],$g=[{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"}],Hg=[{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 _d={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"},jd={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"},Kd={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"},Oi={dark:_d,light:jd,neutral:Kd};function zg(e){return Oi[e]||Oi.dark}var Yd={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"}},qd={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"}},$i={en:Yd,es:qd};function is(e){return $i[e]||$i.en}function Hi(e,t){let a=is(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 Ug(e){let t=is(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 Wg(e,t=0,a=true){let r=is(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 ds(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 Jd(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 _g({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Yg=26,lw=22,dw=10;function jg(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 Qd(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 qg(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 Kg(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 cw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",b=c.isCriticalPath,h=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",v=m?Qd(c.effortMinutes,n,i):null,f=m?qg(c,n,i):null,y=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",h,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":b?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*Yg}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${lw}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)"}:b?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?b?"#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:[b&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),y&&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,": ",y.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Xg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,timerState:x,onLogTime:C,onUpdateEstimate:k,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:I,onDiscardTimer:$,blurFinancials:A=false,suppressDetailModal:_=false,lens:E="hours",hourlyRate:me=0}){let{theme:L="dark",locale:X="en",customTranslations:Z,showBacklog:He=true}=t,O=Hi(X,Z),j=L==="dark"||L==="neutral",[he,je]=react.useState(r||new Date),[U,re]=react.useState(null),[ee,Ee]=react.useState(null),[we,Be]=react.useState(null),[ze,Qe]=react.useState({}),te=3,tt=3,pe=react.useCallback(V=>{Ee(V.id),_||re(V),v?.(V.id);},[_,v]),[at,pt]=react.useState(null),Et=react.useCallback(()=>{je(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),Ce=react.useCallback(()=>{je(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),rt=react.useCallback(()=>{je(new Date);},[]),it=react.useMemo(()=>{let V=he.getFullYear(),ae=he.getMonth(),Ve=new Date(V,ae,1),De=new Date(V,ae+1,0),Ue=Ve.getDay(),Ne=De.getDate(),Ke=ds(e),bt=new Date;bt.setHours(0,0,0,0);let lt=[],nt=Ue,et=new Date(V,ae,0).getDate();for(let Mt=nt-1;Mt>=0;Mt--){let mt=new Date(V,ae-1,et-Mt);lt.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ke.filter(yt=>Jd(mt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}for(let Mt=1;Mt<=Ne;Mt++){let mt=new Date(V,ae,Mt),yt=mt.getTime()===bt.getTime();lt.push({date:mt,isCurrentMonth:true,isToday:yt,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ke.filter(gt=>Jd(mt,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}let At=42-lt.length;for(let Mt=1;Mt<=At;Mt++){let mt=new Date(V,ae+1,Mt);lt.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ke.filter(yt=>Jd(mt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}return lt},[he,e]),Ze=react.useMemo(()=>ds(e).filter(V=>!V.startDate||!V.endDate),[e]),H=react.useMemo(()=>{let V=ds(e),ae=0,Ve=0,De=0,Ue=0,Ne=0;V.forEach(et=>{et.effortMinutes&&(ae+=et.effortMinutes),et.soldEffortMinutes&&(Ve+=et.soldEffortMinutes),et.scheduleVariance!=null&&(De+=et.scheduleVariance,Ue++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let Ke=Ve>0?Math.min(100,Math.round(ae/Ve*100)):0,bt=Ue>0?Math.round(De/Ue):0,nt=`${Ne<0?"-":"+"}${Kg(Ne,E,me)}`;return {budgetUtil:Ke,avgVariance:bt,costDisplay:nt,hasCostData:Ve>0}},[e,E,me]),de=react.useMemo(()=>{let V=[0,0,0,0,0,0];return it.forEach((ae,Ve)=>{let De=Math.floor(Ve/7);ae.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Ne=new Date(Ue.task.startDate),Ke=ae.date;Ne.getFullYear()===Ke.getFullYear()&&Ne.getMonth()===Ke.getMonth()&&Ne.getDate()===Ke.getDate()&&De<V.length&&(V[De]-=Ue.task.soldEffortMinutes);}});}),V},[it]),N=react.useMemo(()=>{let V=ds(e),ae=new Map,Ve=new Set,De=[0,0,0,0,0,0];if(it.length===0)return {segmentsByCell:ae,multiDayTaskIds:Ve,maxLanesPerRow:De};let Ue=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=Ue(it[0].date),Ke=Ue(it[it.length-1].date),bt=[];for(let nt of V){if(!nt.startDate||!nt.endDate)continue;let et=Ue(nt.startDate),At=Ue(nt.endDate);if(et.getTime()===At.getTime()||At<Ne||et>Ke)continue;let Mt=et<Ne?Ne:et,mt=At>Ke?Ke:At,yt=jg(Mt,Ne),gt=jg(mt,Ne);yt<0||yt>41||gt<0||gt>41||yt!==gt&&(Ve.add(nt.id),bt.push({task:nt,startIdx:yt,endIdx:gt}));}bt.sort((nt,et)=>nt.startIdx!==et.startIdx?nt.startIdx-et.startIdx:et.endIdx-et.startIdx-(nt.endIdx-nt.startIdx));let lt=[[],[],[],[],[],[]];for(let{task:nt,startIdx:et,endIdx:At}of bt){let Mt=Math.floor(et/7),mt=Math.floor(At/7),yt=Ue(nt.startDate),gt=Ue(nt.endDate),Pt=false;for(let Ge=Mt;Ge<=mt;Ge++){let Re=Ge===Mt?et%7:0,ut=Ge===mt?At%7:6,le=ut-Re+1,fe=0,P=lt[Ge]??[];for(lt[Ge]||(lt[Ge]=P);fe<P.length&&(P[fe]??-1)>=Re;)fe++;if(fe>=dw){Pt=true;break}fe>=P.length?P.push(ut):P[fe]=ut,De[Ge]=Math.max(De[Ge]??0,fe+1);let K=Ge===Mt&&yt>=Ne,q=Ge===mt&&gt<=Ke,ce=Ge*7+Re,Se={taskId:nt.id,task:nt,rowIndex:Ge,startCol:Re,endCol:ut,spanCols:le,lane:fe,isStart:K,isEnd:q};ae.has(ce)||ae.set(ce,[]),ae.get(ce).push(Se);}Pt&&(Ve.delete(nt.id),ae.forEach((Ge,Re)=>{let ut=Ge.filter(le=>le.taskId!==nt.id);ut.length===0?ae.delete(Re):ae.set(Re,ut);}));}return {segmentsByCell:ae,multiDayTaskIds:Ve,maxLanesPerRow:De}},[it,e]),Y=X==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=he.toLocaleDateString(X==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ke=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",j?"text-white/30":"text-gray-600"),children:[O.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",j?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",j?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",j?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",j?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:O.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",j?"text-white/30":"text-gray-600"),children:O.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",j?"bg-[#050505]":"bg-white",n),style:i,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",j?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",j?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",j?"text-white":"text-gray-900"),children:X==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Et,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",j?"text-white":"text-gray-900"),children:ke}),jsxRuntime.jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:rt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",j?"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:O.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(V=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",j?"text-white/60 font-mono":"text-gray-500"),children:V},V))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",j?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:it.map((V,ae)=>{let Ve=ae%7===6,De=ae>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ve&&(j?"border-r border-[#222]":"border-r border-gray-200"),!De&&(j?"border-b border-[#222]":"border-b border-gray-200"),j?V.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":V.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",V.isToday&&j&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",V.isToday&&!j&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",V.isToday?j?"text-[#007FFF] font-bold":"text-blue-600 font-bold":V.isCurrentMonth?j?"text-white/60":"text-gray-900":j?"text-white/20":"text-gray-400"),children:String(V.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(ae/7),Ne=(N.maxLanesPerRow[Ue]??0)*Yg,Ke=N.segmentsByCell.get(ae);return Ne===0&&!Ke?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ke?.map(bt=>jsxRuntime.jsx(cw,{segment:bt,isDark:j,blurFinancials:A,isSelected:ee===bt.taskId,t:O,lens:E,hourlyRate:me,onClick:()=>{pe(bt.task),a.onEventClick?.({id:bt.task.id,title:bt.task.name,start:bt.task.startDate,end:bt.task.endDate,task:bt.task});}},bt.taskId))})})(),(()=>{let Ue=V.events.filter(Ne=>Ne.task.isMilestone&&!N.multiDayTaskIds.has(Ne.id));return Ue.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Ne=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:Ke=>{Ke.stopPropagation(),pe(Ne.task);}},Ne.id)),Ue.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",j?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];V.events.forEach(Ke=>{Ke.task.blockers?.forEach(bt=>{(bt.severity==="warning"||bt.severity==="critical")&&Ue.push({taskId:Ke.id,type:bt.type,severity:bt.severity,variance:Ke.task.scheduleVariance});});});let Ne=Ue[0];return Ne?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.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:[O.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${O.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=V.events.filter(lt=>!N.multiDayTaskIds.has(lt.id)),Ne=ze[ae]||te,Ke=Ue.slice(0,Ne),bt=Ue.length-Ne;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(lt=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{pe(lt.task),a.onEventClick?.(lt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",lt.task.progress===100||lt.task.status==="completed"?j?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":j?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:j?lt.task.progress===100||lt.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)"}:lt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",lt.task.isMilestone?j?"text-amber-400":"text-amber-600":lt.task.isCriticalPath?"text-red-400":j?"text-[#1264FF]":"text-gray-400"),children:lt.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:lt.title})]},lt.id)),bt>0&&jsxRuntime.jsxs("button",{onClick:lt=>{lt.stopPropagation(),Qe(nt=>({...nt,[ae]:Ne+tt}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",bt," ",X==="es"?"m\xE1s":"more"]}),Ne>te&&Ue.length>te&&jsxRuntime.jsx("button",{onClick:lt=>{lt.stopPropagation(),Qe(nt=>({...nt,[ae]:te}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X==="es"?"menos":"less"})]})})(),V.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=ae>=28,Ne=ae%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ke=>{Ke.stopPropagation(),pt(at===ae?null:ae);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===ae?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",at===ae&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at===ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",j?"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(Io,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||V.date,endDate:Ke.endDate||V.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),pt(null);},onCancel:()=>pt(null),availableUsers:t.availableUsers,isDark:j,locale:X==="es"?"es":"en",defaultDate:V.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),ae%7===6&&(()=>{let Ue=Math.floor(ae/7),Ne=de[Ue];if(!Ne||Ne===0)return null;let Ke=Kg(Ne,E,me);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:[O.labels.cashOut,": ",Ne<0?"-":"+",Ke]})})()]},ae)})})})]}),He&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",j?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",j?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:O.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",j?"text-white/20":"text-gray-400"),children:Ze.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ze.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",j?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",j?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",j?"text-white/20":"text-gray-400"),children:X==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ze.map(V=>jsxRuntime.jsxs("button",{onClick:()=>{pe(V);},className:u("w-full text-left rounded-md p-3 transition-all group/card",j?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",j?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",j?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:V.name})]}),V.tags&&V.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[V.tags.slice(0,3).map(ae=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ae.color}15`,color:ae.color,border:`1px solid ${ae.color}30`},children:ae.name},ae.id)),V.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",j?"text-white/20":"text-gray-400"),children:["+",V.tags.length-3]})]}),(V.effortMinutes||V.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",j?"text-white/25":"text-gray-400",A&&"blur-sm select-none"),children:[Qd(V.effortMinutes,E,me)&&jsxRuntime.jsxs("span",{children:[O.labels.estimate,": ",Qd(V.effortMinutes,E,me)]}),(()=>{let ae=qg(V,E,me);return ae?jsxRuntime.jsx("span",{className:ae.isNegative?"text-red-400":"text-emerald-400",children:ae.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[V.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",V.priority==="urgent"||V.priority==="high"?"text-red-400":V.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(_g,{task:V,isDark:j})]}),V.assignees&&V.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,2).map((ae,Ve)=>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:ae.color||"#007FFF"},title:ae.name,children:ae.initials||ae.name?.slice(0,2).toUpperCase()},Ve))})]})]},V.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:O.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",j?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:V=>{V.key==="Enter"&&V.target.value.trim()&&(a.onTaskCreate?.({name:V.target.value.trim()}),V.target.value="");}})}),H.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:["\u25C8 ",O.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",j?"text-white/40":"text-gray-500"),children:O.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",j?"text-white/60":"text-gray-700",A&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",j?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:O.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":j?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",O.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:O.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!_&&jsxRuntime.jsx(qr,{task:U,isOpen:!!U,onClose:()=>re(null),onTaskUpdate:V=>{a.onTaskUpdate?.(V),re(V);},theme:L==="dark"?"dark":"light",locale:X,availableUsers:t.availableUsers?.map(V=>({id:V.id,name:V.name,avatar:V.avatar,initials:V.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:U?p?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ds(e).filter(V=>V.id!==U?.id),comments:d?.filter(V=>V.taskId===U?.id).map(V=>({...V,createdAt:V.createdAt instanceof Date?V.createdAt:new Date(V.createdAt),updatedAt:V.updatedAt instanceof Date?V.updatedAt:V.updatedAt?new Date(V.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:k,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:I,onTimerDiscard:$,blurFinancials:A}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Be(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",j?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",j?"text-white/90":"text-gray-900"),children:we.date.toLocaleDateString(X==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Be(null),className:u("p-1 rounded",j?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:we.events.map(V=>jsxRuntime.jsxs("button",{onClick:()=>{Be(null),pe(V.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(_g,{task:V.task,isDark:j}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",j?"text-white/80":"text-gray-900"),children:V.title}),(V.task.priority==="high"||V.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},V.id))})]})]})})]})}var Zd={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)"},ec={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)"},tc={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)"},Wi={dark:Zd,light:ec,neutral:tc};function Jg(e){return Wi[e]||Wi.dark}function pw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,b=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,h=p.map(f=>f.priority).filter(Boolean),v=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:h,labels:v}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.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 Zg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function us(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 ps(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 e0(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 t0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=react.useMemo(()=>({...Zg,...n}),[n]),[l,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(w=>{let x=w.timestamp.toISOString().split("T")[0],C=y.get(x);C?C.push(w):y.set(x,[w]);}),Array.from(y.entries()).sort((w,x)=>x[0].localeCompare(w[0])).map(([w,x])=>({date:new Date(w),events:x.sort((C,k)=>k.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=react.useMemo(()=>{let y=new Set,w=new Set;return e.forEach(x=>{y.add(x.userId),w.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(w)}},[e]),h=y=>{p(w=>{let x=new Set(w);return x.has(y)?x.delete(y):x.add(y),x});},v=y=>{let x=new Date().getTime()-y.getTime(),C=Math.floor(x/6e4),k=Math.floor(x/36e5),D=Math.floor(x/864e5);return C<1?"just now":C<60?`${C}m ago`:k<24?`${k}h ago`:D<7?`${D}d ago`:y.toLocaleDateString()},f=react.useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return react.useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",i),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(y=>jsxRuntime.jsxs("option",{value:y,children:[ps(y)," ",y.replace("_"," ")]},y))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((w,x)=>{let C=l.has(w.id),k=s===w.id,D=e0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",C&&"expanded",k&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ps(w.type)})}),x<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:us(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),h(w.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},T)),w.metadata&&Object.keys(w.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(w.metadata).map(([T,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},T))]})]})]})]},w.id)})})]},y.date?.toISOString()||"all"))})]})}function r0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&ps(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&us(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(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,b)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>i(b),title:us(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ac(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 rc(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 o0(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 n0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function yw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*l,p.vy+=(m-p.y)*o.centerForce*l,n.forEach(g=>{if(p.id===g.id)return;let b=p.x-g.x,h=p.y-g.y,v=Math.sqrt(b*b+h*h)||1,f=o.chargeStrength*l/(v*v);p.vx+=b/v*f,p.vy+=h/v*f;});}),t.forEach(p=>{let d=i.get(typeof p.source=="string"?p.source:p.source.id),m=i.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,b=m.y-d.y,h=Math.sqrt(g*g+b*b)||1,v=(h-o.linkDistance)/h*o.forceStrength*l;d.vx+=g*v,d.vy+=b*v,m.vx-=g*v,m.vy-=b*v;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function s0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(1),[x,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let E=yw(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let k=react.useCallback((E,me)=>{a.enableDragging&&(me.stopPropagation(),g(E));},[a.enableDragging]),D=react.useCallback(E=>{if(!m||!l.current)return;let L=l.current.getBoundingClientRect(),X=(E.clientX-L.left-x.x)/y,Z=(E.clientY-L.top-x.y)/y;d(He=>He.map(O=>O.id===m?{...O,x:X,y:Z,fx:X,fy:Z}:O));},[m,y,x]),T=react.useCallback(()=>{g(null);},[]),I=react.useCallback((E,me)=>{me.stopPropagation(),i?.({type:"node-click",node:E,position:{x:me.clientX,y:me.clientY}});},[i]),$=react.useCallback((E,me)=>{me.stopPropagation(),i?.({type:"edge-click",edge:E,position:{x:me.clientX,y:me.clientY}});},[i]),A=react.useCallback(E=>{let me=p.find(L=>L.id===E);return me?{x:me.x,y:me.y}:{x:0,y:0}},[p]),_=react.useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let me=E.card.priority;return me==="URGENT"?"#ef4444":me==="HIGH"?"#f59e0b":me==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:u("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.min(E+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:ac(E)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[o0(E)," ",rc(E)]})]},E))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let me=A(typeof E.source=="string"?E.source:E.source.id),L=A(typeof E.target=="string"?E.target:E.target.id),X=n0(E.type),Z=v===E.id,He=E.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",He&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:O=>$(E,O),children:[jsxRuntime.jsx("line",{x1:me.x,y1:me.y,x2:L.x,y2:L.y,stroke:ac(E.type),strokeWidth:He?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsxRuntime.jsx("text",{x:(me.x+L.x)/2,y:(me.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:rc(E.type)})]},E.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(E=>{let me=b===E.id,L=E.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",me&&"hovered",L&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:X=>k(E.id,X),onMouseEnter:()=>h(E.id),onMouseLeave:()=>h(null),onClick:X=>I(E,X),children:[jsxRuntime.jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:_(E),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:me?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function d0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[i,c]=react.useState(false),[l,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),b=i||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&!b&&h();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,b]);let h=()=>{b||(n(""),p(null),m(null),t());},v=async()=>{if(!(!s.trim()||b)){c(true),p(null),m(null);try{let y=await r(s.trim());m(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),h());};return e?jsxRuntime.jsxs(Ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:h,disabled:b,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:b}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,w)=>jsxRuntime.jsx("button",{onClick:()=>n(y),disabled:b,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&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:h,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!s.trim()||b,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:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var oc={"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 vw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},ww={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 kw(e,t,a){let r=oc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ms(e){return `$${e.toFixed(4)}`}var nc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=kw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),l={},p={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let 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 i=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=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)}},Vo=new nc;function p0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Vo.getStats()),[s,n]=react.useState(Vo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Vo.getStats()),n(Vo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=Vo.getRecentOperations(5);return jsxRuntime.jsxs(Ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ms(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ms(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:i.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ms(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function f0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=react.useState(""),[c,l]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(null),x=react.useRef(null),C=m||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let $=A=>{A.key==="Escape"&&!C&&k();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,C]);let k=()=>{C||(i(""),l(""),d(""),h(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||C)){g(true),h(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){h($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),k());};if(!e)return null;let I=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:$=>$.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:k,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(($,A)=>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:["#",A+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:$.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"})]}),$.start," \u2192 ",$.end]}),jsxRuntime.jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.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:x,value:n,onChange:$=>i($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:$=>l($.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:C})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:$=>d($.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:C})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),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)=>jsxRuntime.jsx("button",{onClick:()=>i($),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},A))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-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:k,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:D,disabled:!n.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function _i({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&Ss(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,y,w)=>{console.warn(`Retry attempt ${y} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(v,f,y)=>{r(w=>{let x=w.cards.find($=>$.id===v);if(!x)return w;let C=x.columnId,k={...x,columnId:f,position:y},D=w.cards.map($=>$.id===v?k:$),T=w.columns.map($=>{if($.id===C)return {...$,cardIds:$.cardIds.filter(A=>A!==v)};if($.id===f){let A=D.filter(_=>_.columnId===f).sort((_,E)=>_.position-E.position);return {...$,cardIds:A.map(_=>_.id)}}return $}),I={...w,cards:D,columns:T};return o(I),I});},[o]),n=react.useCallback(async(v,f)=>{r(y=>{let w=y.cards.map(C=>C.id===v?{...C,...f}:C),x={...y,cards:w};return o(x),x});},[o]),i=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f},x=y.columns.map(k=>k.id===v.columnId?{...k,cardIds:[...k.cardIds,f]}:k),C={...y,cards:[...y.cards,w],columns:x};return o(C),C});},[o]),c=react.useCallback(async v=>{r(f=>{let y=f.cards.find(k=>k.id===v);if(!y)return f;let w=f.cards.filter(k=>k.id!==v),x=f.columns.map(k=>k.id===y.columnId?{...k,cardIds:k.cardIds.filter(D=>D!==v)}:k),C={...f,cards:w,columns:x};return o(C),C});},[o]),l=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f,cardIds:[]},x={...y,columns:[...y.columns,w]};return o(x),x});},[o]),p=react.useCallback(async(v,f)=>{r(y=>{let w=y.columns.map(C=>C.id===v?{...C,...f}:C),x={...y,columns:w};return o(x),x});},[o]),d=react.useCallback(async v=>{r(f=>{let y=f.cards.filter(C=>C.columnId!==v),w=f.columns.filter(C=>C.id!==v),x={...f,cards:y,columns:w};return o(x),x});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),b=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:b}}}function h0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=_i({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var gs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},x0={by:"none",order:"asc"};function v0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...gs,...e}),[s,n]=react.useState({...x0,...t}),i=react.useCallback(h=>{o(v=>({...v,...h}));},[]),c=react.useCallback(h=>{n(v=>({...v,...h}));},[]),l=react.useCallback(()=>{o(gs),n(x0);},[]),p=react.useCallback(()=>{a&&o({...gs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...gs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...gs,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]),b=react.useCallback(h=>{let v=[...h];if(r.search){let f=r.search.toLowerCase();v=v.filter(y=>y.title.toLowerCase().includes(f)||y.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,y=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),x=String(f.getDate()).padStart(2,"0"),C=`${y}-${w}-${x}`;v=v.filter(k=>{if(!k.endDate&&!k.dueDate)return false;let D=k.endDate||k.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let I=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),A=String(D.getUTCDate()).padStart(2,"0");T=`${I}-${$}-${A}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let I=new Date(C+"T00:00:00"),$=new Date(T+"T00:00:00"),A=new Date(I);return A.setDate(A.getDate()+7),$>=I&&$<=A;case "custom":if(r.dateRange){let _=typeof D=="string"?new Date(D):D;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,y)=>{let w=0;switch(s.by){case "created":let x=f.createdAt?new Date(f.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;w=x-C;break;case "priority":let k={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=k[f.priority||"LOW"],T=k[y.priority||"LOW"];w=D-T;break;case "dueDate":let I=f.endDate||f.dueDate,$=y.endDate||y.dueDate;if(!I)return 1;if(!$)return -1;let A=typeof I=="string"?new Date(I).getTime():I.getTime(),_=typeof $=="string"?new Date($).getTime():$.getTime();w=A-_;break;case "title":w=f.title.localeCompare(y.title);break;case "estimate":let E=f.estimatedTime||0,me=y.estimatedTime||0;w=E-me;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:b,hasActiveFilters:g}}var k0,C0;if(typeof window<"u")try{let e=Ts("ai");k0=e.generateObject,C0=e.generateText;}catch{}function T0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(k0&&C0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function ic(){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 N0(e){let{cards:t}=e,[a,r]=ic(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,b=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let h=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(h&&v&&h.columnId===v.columnId){let f=t.filter(T=>T.columnId===h.columnId).sort((T,I)=>T.position-I.position),y=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===d),[x,C]=y<w?[y,w]:[w,y],k=f.slice(x,C+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...k]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var D0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function S0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...D0,...a}),[a]),[s,n]=react.useState([]),i=react.useCallback((h,v,f,y,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:v,columnId:f,strategy:y,color:w,isExpanded:true,position:s.filter(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,x]);},[o.minCardsPerStack,s]),c=react.useCallback(h=>{n(v=>v.filter(f=>f.id!==h));},[]),l=react.useCallback(h=>{n(v=>v.map(f=>f.id===h?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((h,v)=>{n(f=>f.map(y=>y.id===h&&!y.cardIds.includes(v)?{...y,cardIds:[...y.cardIds,v]}:y));},[]),d=react.useCallback((h,v)=>{n(f=>f.map(y=>{if(y.id===h){let w=y.cardIds.filter(x=>x!==v);return w.length<o.minCardsPerStack?null:{...y,cardIds:w}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),m=react.useCallback(h=>s.filter(v=>v.columnId===h).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async h=>{let v=t.filter(C=>C.columnId===h);if(v.length<o.minCardsPerStack*2)return [];let f=[],y=new Map;v.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(k=>{y.has(k)||y.set(k,[]),y.get(k).push(C);});}),y.forEach((C,k)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${k}`,cardIds:C.map(D=>D.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${k}"`,confidence:.85});});let w=new Map;v.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(k=>{w.has(k)||w.set(k,[]),w.get(k).push(C);});}),w.forEach((C,k)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${k.slice(-4)}`,cardIds:C.map(D=>D.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(C=>{C.priority&&(x.has(C.priority)||x.set(C.priority,[]),x.get(C.priority).push(C));}),x.forEach((C,k)=>{if(C.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[k.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${k} Priority`,cardIds:C.map(T=>T.id),columnId:h,strategy:"priority",color:k==="high"||k==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${k} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of v){let D=(await r.findSimilar(C,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[C.id,...D.map($=>$.card.id)],I=D.reduce(($,A)=>$+A.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:I});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,k)=>k.confidence-C.confidence).slice(0,5)},[t,o,r]),b=react.useCallback(h=>{i(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[i]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),y=f[0];f.length>0&&y&&y.confidence>=.9&&b(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:b,config:o}}var E0=react.createContext(null);function F0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Ts("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Ts("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Ts("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(E0.Provider,{value:{store:o},children:e})}function ji(){let e=react.useContext(E0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function bs(){let e=ji(),[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 i=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),l=react.useCallback((y,w)=>{e.updateColumn(y,w);},[e]),p=react.useCallback(y=>{e.deleteColumn(y);},[e]),d=react.useCallback(y=>e.getColumn(y),[e]),m=react.useCallback(y=>{e.addCard(y);},[e]),g=react.useCallback((y,w)=>{e.updateCard(y,w);},[e]),b=react.useCallback(y=>{e.deleteCard(y);},[e]),h=react.useCallback((y,w,x)=>{e.moveCard(y,w,x);},[e]),v=react.useCallback(y=>e.getCard(y),[e]),f=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:b,moveCard:h,getCard:v,getCardsByColumn:f}}function P0(e){let{cards:t}=bs();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 A0(e="position",t="asc"){let{cards:a}=bs();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;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 Ki=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Yc.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 i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{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);}},Hw=new Ki;function I0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(b=>{let h=e[b.index];if(!h)return null;let v=c?c(h,b.index):b.index,f={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsxRuntime.jsx("div",{style:f,"data-index":b.index,children:r(h,b.index)},v)})})})}function B0(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 O0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:i}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:b,children:m.map(h=>{let v=e[h.index];if(!v)return null;let f=c?c(v,h.index):h.index,y={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":h.index,children:o(v,h.index)},f)})})})}function $0(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 H0(e,t=10){return e>t}var uc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},pc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},mc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},gc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},fc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},bc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},hc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},yc={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)"},xc={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)"},vc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},wc={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},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}},Yi={spacing:uc,borderRadius:pc,fontSize:mc,fontWeight:gc,lineHeight:fc,zIndex:bc,duration:hc,easing:yc,shadows:xc,opacity:vc,kanban:wc,gantt:kc};function z0(e,t,a){return e[t]??a}function Cc(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)?Cc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Ww(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Tc(e="asakaa"){let t=Cc(Yi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Ww(o);a.push(` ${s}: ${n};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function xm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ro(e,t){let a=xm(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Td(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 b=new Date(r),h=b.getDay(),v=g-h;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}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(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+m):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+m),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let m=parseInt(i[1],10),g=parseInt(i[2],10)-1,b=parseInt(i[3],10);return new Date(b,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=parseInt(l[1],10),g=c[l[2].toLowerCase()],b=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=p[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(b,m,g)}return null}function Nd(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 Dd(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 vm(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 l=r[1].trim(),p=r[2].trim(),d=ro(t,l),m=Td(p);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(m);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:b},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),d=ro(t,l),m=Nd(p);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),d=ro(t,l),m=Dd(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,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 l=n[1].trim(),p=n[2].trim(),d=ro(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),d=ro(t,l),m=ro(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=ro(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function km(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 Xv(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 Jv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Di(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Di(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:Xv(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:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Cm(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:Jv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Tm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Di(r,e,t))}var Sd={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"}},Ed={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"}},Si={en:Sd,es:Ed};function Fd(e){return Si[e]||Si.en}function Ei(e,t){let a=Fd(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 Md=[{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 Nm(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 Dm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Nm(e),l=Md[0],p=Md.find(g=>g.value===c)??l,d=p.icon,m=g=>{switch(Nm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Md.map(g=>{let b=g.icon;return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Pd=[{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 Em({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=Pd.find(p=>p.value===e)??Pd[4],l=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Pd.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[l]})]},p.value))})]})}function rs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ad(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 Am({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=react.useState(false),[c,l]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let h=v=>{p.current&&!p.current.contains(v.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=h=>e.some(v=>v.name===h),b=h=>{if(a){if(g(h.name))a(e.filter(v=>v.name!==h.name));else {let v={name:h.name,initials:rs(h.name),color:h.color||Ad(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,v]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,v)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Ad(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||rs(h.name)},`${h.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,v)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Ad(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||rs(h.name)},`${h.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:h=>l(h.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.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((h,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||rs(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==h.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${h.name}-${v}`))}),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(h=>{let v=g(h.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),b(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):rs(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},h.id)})})]})]})}function Bm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,p]=react.useState(false),[d,m]=react.useState(o),[g,b]=react.useState(()=>{let S=o==="start"?e:t;if(S){let C=S instanceof Date?S:new Date(S);return new Date(C.getFullYear(),C.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),h=react.useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let S=C=>{h.current&&!h.current.contains(C.target)&&p(false);};return l&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),react.useEffect(()=>{l&&m(r?o:"start");},[l,r,o]);let y=S=>S?S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let S=g.getFullYear(),C=g.getMonth(),I=new Date(S,C,1),P=new Date(S,C+1,0).getDate(),te=I.getDay(),O=[],F=new Date(S,C,0).getDate();for(let ee=te-1;ee>=0;ee--)O.push({date:new Date(S,C-1,F-ee),isCurrentMonth:false});for(let ee=1;ee<=P;ee++)O.push({date:new Date(S,C,ee),isCurrentMonth:true});let J=42-O.length;for(let ee=1;ee<=J;ee++)O.push({date:new Date(S,C+1,ee),isCurrentMonth:false});return O},[g]),x=S=>{if(r)o==="start"?a(S,f||void 0):a(v||void 0,S),p(false);else if(d==="start"){let C=f&&S>f?S:f;a(S,C||void 0),m("end");}else {let C=v&&S<v?S:v;a(C||void 0,S),p(false);}},N=()=>{let S=new Date,C=new Date(S);C.setDate(S.getDate()+1);let I=new Date(S);I.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let $=new Date(S);$.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let P=new Date(S);P.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let te=new Date(S);te.setDate(S.getDate()+14);let O=new Date(S);return O.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:te,display:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let S=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(S)})]})}let k=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:S=>{S.stopPropagation(),p(!l);let C=o==="start"?v:f;C&&b(new Date(C.getFullYear(),C.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(k)})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((S,C)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(S.date),children:[jsxRuntime.jsx("span",{children:S.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:S.display})]},C)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),p(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>b(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((S,C)=>{let I=S.date.toDateString()===new Date().toDateString(),$=v?.toDateString()===S.date.toDateString(),P=f?.toDateString()===S.date.toDateString(),te=$||P,O=!r&&v&&f&&S.date>=v&&S.date<=f;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(S.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),S.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",P&&!$&&"bg-[#7C3AED] text-white",O&&!te&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!te&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:S.date.getDate()},C)})})]})]})]})]})}function Pi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Bm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Tn(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 Ai(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,m=e,g=m-d,b=r/o;c(true);for(let h=1;h<=o;h++){let v=setTimeout(()=>{let f=h/o,y=1-Math.pow(1-f,3),w=Math.round(d+g*y);n(w),h===o&&(c(false),n(m));},b*h);p.current.push(v);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function Rm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let b=Date.now();l.current=setInterval(()=>{let h=Date.now()-b,v=Math.min(h/a*100,100);i(v);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function $m({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=react.useState(false),[c,l]=react.useState(""),p=react.useRef(null),{isFlashing:d,triggerFlash:m}=Tn(),{displayValue:g,isAnimating:b}=Ai(e,{enabled:o,duration:300,steps:6}),h=x=>{if(r||!t)return;x.stopPropagation();let N=x.currentTarget.getBoundingClientRect(),k=x.clientX-N.left,S=Math.round(k/N.width*100),C=Math.max(0,Math.min(100,S));C!==e&&(t(C),s&&m());},v=react.useCallback(x=>{r||!t||(x.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=react.useCallback(()=>{i(false);let x=parseInt(c,10);if(!isNaN(x)&&t){let N=Math.max(0,Math.min(100,x));N!==e&&(t(N),s&&m());}},[c,t,e,s,m]),y=react.useCallback(x=>{x.key==="Enter"&&f(),x.key==="Escape"&&i(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:h,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",b&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:p,value:c,onChange:x=>l(x.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:y,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:v,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",b&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Um({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Gm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:b,triggerFlash:h}=Tn(),{displayValue:v,isAnimating:f}=Ai(e,{enabled:i&&!l});react.useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let y=()=>{let x=parseFloat(d);if(!isNaN(x)){let N=x;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&h());}p(false);},w=x=>{x.key==="Enter"?y():x.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):l?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:x=>m(x.target.value),onBlur:y,onKeyDown:w,onClick:x=>x.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),p(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),b&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function _m({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let l=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function Km({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:p}=Rm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?p():l(!e):t(!e));},m=i?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&m&&"ring-green-500/50",i&&!m&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Xm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function B2(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 R2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let 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 ar({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[p,d]=react.useState(false),[m,g]=react.useState(""),b=react.useRef(null),{isFlashing:h,triggerFlash:v}=Tn(),f=c==="financial"&&l>0,y=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:B2(e,r);react.useEffect(()=>{p&&b.current&&(b.current.focus(),b.current.select());},[p]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),S=e%60;k>0&&S>0?g(`${k}h ${S}m`):k>0?g(`${k}h`):g(`${S}m`);}else g("");},[e,p]);let w=()=>{let k=R2(m);k!==e&&(t?.(k),n&&v()),d(false);},x=k=>{k.key==="Enter"?w():k.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let N=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:y})]}):p?jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:k=>g(k.target.value),onBlur:w,onKeyDown:x,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left 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",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:y})]})}function eg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function ag({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,d=ee=>p?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[m,g]=react.useState(false),[b,h]=react.useState(false),[v,f]=react.useState(null),y=react.useRef(null),w=e.timeLoggedMinutes||0,x=e.effortMinutes||0,N=e.soldEffortMinutes||0,k=Math.round(w/60*10)/10,S=Math.round(x/60*10)/10,C=x>0?w/x*100:0,I=C>100?Math.round((w-x)/60*10)/10:0,$=C>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!b&&!v)return;let ee=Re=>{y.current&&!y.current.contains(Re.target)&&(h(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[b,v]);let P=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){h(Re=>!Re),f(null);return}n&&n(e);},te=ee=>{h(false),f(ee);},O=async(ee,Re)=>{v==="log"&&r&&ee?r(e,ee,Re):v==="estimate"&&o?o(e,ee):v==="quoted"&&s&&s(e,ee),f(null);},H=r||o||s||n,F=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),J=v==="estimate"?x:v==="quoted"?N:void 0;return x===0&&w===0&&N===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&H&&jsxRuntime.jsx("button",{onClick:P,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(ee=>jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsxRuntime.jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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(zr,{mode:v,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(k)}),x>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(S)]}),I>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(I)," Over"]})]}),x>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(C,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsxRuntime.jsx("button",{onClick:P,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(ee=>jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsxRuntime.jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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(zr,{mode:v,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function V2(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 G2(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 rg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function og({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=V2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,b)=>jsxRuntime.jsx(rg,{assignee:g,size:24,isDark:t},g.name+b))}),m>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?G2(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(rg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var _2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function sg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",_2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function d1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function c1(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 cg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let b=react.useRef(null),h=r==="es"?lg.es:lg.en;if(react.useEffect(()=>{let x=k=>{b.current&&!b.current.contains(k.target)&&t();},N=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",x),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",N);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let x=[];return o&&x.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),x.push({id:"sep1",label:"",icon:null,separator:true}),i&&(x.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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),x.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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&x.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(N=>({id:`assign-${N.id}`,label:N.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:N.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],C=k.some(I=>I.name===N.name)?k.filter(I=>I.name!==N.name):[...k,{name:N.name,initials:d1(N.name),color:N.color||c1(N.name),avatar:N.avatarUrl}];i({...e.task,assignees:C}),t();}}))})),d&&x.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&x.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&x.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),x.push({id:"sep2",label:"",icon:null,separator:true}),s&&x.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&x.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),x},f=()=>{if(!e.columnId)return [];let x=[];return l&&(x.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),x.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(x.push({id:"sep-hide",label:"",icon:null,separator:true}),x.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),x},y=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:y.map(x=>x.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},x.id):x.submenu?jsxRuntime.jsx(u1,{item:x,isDark:a},x.id):jsxRuntime.jsxs("button",{onClick:x.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",x.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(x.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:x.icon}),x.label]},x.id))})}function u1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxRuntime.jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var lg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",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",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 xg={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"})},S1=["name","status","priority","assignees","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:i}){let[c,l]=react.useState(""),[p,d]=react.useState(null),m=react.useRef(null),g=i==="es"?vg.es:vg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let x=()=>{if(!m.current)return;let N=m.current.getBoundingClientRect(),S=window.innerHeight-N.top-20;d(Math.max(300,S));};return requestAnimationFrame(x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[e]),react.useEffect(()=>{if(!e)return;let x=setTimeout(()=>{let N=S=>{m.current&&!m.current.contains(S.target)&&t();},k=S=>{S.key==="Escape"&&t();};document.addEventListener("mousedown",N),document.addEventListener("keydown",k),m._cleanup=()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(x),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let b=x=>g.columns[x]||x,h=x=>{if(x==="name")return;let N=a.map(k=>k.id===x?{...k,visible:!k.visible}:k);o(N);},v=(x,N)=>{let k=a.find(C=>C.type===x&&(!N||C.customFieldId===N));if(k){h(k.id);return}let S={id:N||x,type:x,label:N?r.find(C=>C.id===N)?.name||x:b(x),width:120,visible:true,sortable:true,resizable:true,customFieldId:N};o([...a,S]);},f=S1.filter(x=>b(x).toLowerCase().includes(c.toLowerCase())),y=r.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...p?{maxHeight:`${p}px`}:{},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)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 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:g.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:x=>{x.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",x.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:x=>l(x.target.value),placeholder:g.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:x=>{x&&x.style.setProperty("--focus-border",w);},onFocus:x=>{x.currentTarget.style.borderColor=w,x.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:x=>{x.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",x.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:x=>x.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:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(x=>{let N=a.find(C=>C.type===x&&!C.customFieldId),k=N?.visible??false,S=x==="name";return jsxRuntime.jsxs("button",{onClick:()=>{S||(N?h(N.id):v(x));},disabled:S,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:S?.4:1,cursor:S?"not-allowed":"pointer"},onMouseEnter:C=>{S||(C.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:C=>{C.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:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&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:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:xg[x]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?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:b(x)})]},x)})})]}),y.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:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:y.map(x=>{let k=a.find(S=>S.customFieldId===x.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(x.type,x.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:S=>{S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&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:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:xg[x.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?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:x.name})]},x.id)})})]})]})]})}var vg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",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",assignees:"Asignados",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 R1=[{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 Tg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[i,c]=react.useState("text"),[l,p]=react.useState([""]),d=o==="es"?Cg.es:Cg.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:i};i==="dropdown"&&(v.options=l.filter(f=>f.trim())),a(v),t();},g=()=>{p([...l,""]);},b=(v,f)=>{let y=[...l];y[v]=f,p(y);},h=v=>{l.length>1&&p(l.filter((f,y)=>y!==v));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:R1.map(v=>jsxRuntime.jsxs("button",{onClick:()=>c(v.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===v.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:i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:u("text-xs",i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((v,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:v,onChange:y=>b(f,y.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>h(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Cg={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 Sg={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 Eg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),p=s==="es"?Sg.es:Sg.en;react.useEffect(()=>{if(!n)return;let g=h=>{Date.now()-l.current<100||c.current&&!c.current.contains(h.target)&&i(false);},b=h=>{h.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(b=>!b);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,h=()=>g.value==="all"?b?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),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(b?g.color:"text-gray-400","flex-shrink-0"),children:h()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Fg(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 is(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Mg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxRuntime.jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:s?"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"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,p=i-c,d=i>0?Math.round(p/i*100):0,m=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,b=g?"#FF2D20":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:is(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:is(c)})]}),l>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:is(l)})]}),i>0&&jsxRuntime.jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(m,100)}%`,backgroundColor:b}})}),jsxRuntime.jsxs("div",{className:u("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-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[p>=0?`+${is(p)} ${s?"Disp.":"Avail."}`:`${is(Math.abs(p))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,p=i>c&&c>0,d=p?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",p?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Fg(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Fg(c)})]}),c>0&&jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,p=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"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:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var Q1=[{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 Rg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Rg(r.subtasks,t+1));return a}function Z1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function ew(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function En(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=En(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Sn(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 tw({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:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Og({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:w=false,onCreateTask:x,persistFilter:N=false,financialBlur:k,healthSidebar:S,lens:C="hours",hourlyRate:I=0,rateMap:$,aggregateParentHours:P=false,showProjectTotals:te=false}=t,O=Ei(d,m),H=p==="dark",F=M=>{if(!$||!M.assignees||M.assignees.length===0)return I;let le=M.assignees.map(fe=>fe.id?$[fe.id]:void 0).filter(fe=>fe!=null&&fe>0);return le.length===0?I:le.reduce((fe,L)=>fe+L,0)/le.length},J=react.useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let le=JSON.parse(M);return {statusFilter:le.statusFilter||"all",hideCompleted:le.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),ee=react.useMemo(()=>{function M(le){let fe=0,L=0,G=0;for(let de of le)if(de.subtasks&&de.subtasks.length>0){let T=M(de.subtasks);fe+=T.spent,L+=T.allocated,G+=T.quoted;}else fe+=de.timeLoggedMinutes??0,L+=de.effortMinutes??0,G+=de.soldEffortMinutes??0;return {spent:fe,allocated:L,quoted:G}}return M(e)},[e]),Re=react.useMemo(()=>{let M=new Map;function le(fe){let L=0;for(let G of fe)if(G.subtasks&&G.subtasks.length>0){let de=le(G.subtasks);M.set(G.id,de),L+=de;}else L+=G.weight||0;return L}return le(e),M},[e]),B=react.useMemo(()=>!S?.enabled||!S.data?S:{...S,data:{...S.data,totalHoursSpentMinutes:ee.spent,totalHoursAllocatedMinutes:ee.allocated}},[S,ee]),[Y,ye]=react.useState(true),[Ge,U]=react.useState("position"),[oe,Z]=react.useState("asc"),[Se,ke]=react.useState(""),[Ie,He]=react.useState(()=>J().statusFilter),[et,ae]=react.useState(()=>J().hideCompleted),[Xe,pe]=react.useState(h||Q1),[at,mt]=react.useState(false),[Pt,Ce]=react.useState(false),[yt,nt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Je,z]=react.useState("all"),[ne,D]=react.useState(false),q=react.useRef(null),ce=react.useRef(null),Te=react.useMemo(()=>{let M=0;function le(fe,L){for(let G of fe)L>M&&(M=L),G.subtasks?.length&&le(G.subtasks,L+1);}return le(e,1),M},[e]);react.useEffect(()=>{if(!ne)return;let M=le=>{q.current?.contains(le.target)||ce.current?.contains(le.target)||D(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[ne]),react.useEffect(()=>{if(Je==="all"){let fe=function(L){for(let G of L)G.subtasks?.length&&(G.isExpanded===false&&a.onTaskToggleExpand?.(G.id),fe(G.subtasks));};fe(e);}else {let fe=function(L,G){for(let de of L)if(de.subtasks?.length){let T=G<Je,j=de.isExpanded!==false;T!==j&&a.onTaskToggleExpand?.(de.id),fe(de.subtasks,G+1);}};fe(e,1);}},[Je]);let[W,re]=react.useState(null),[Ue,Ne]=react.useState(0),[ze,Fe]=react.useState(0),Ke=react.useRef(null),[lt,ut]=react.useState(null),[st,Ze]=react.useState(null);react.useEffect(()=>{h&&pe(h);},[h]),react.useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Ie,hideCompleted:et}));}catch(M){console.error("Error persisting filter state:",M);}},[N,Ie,et]);let zt=react.useMemo(()=>{let M=new Set;function le(fe){for(let L of fe)L.subtasks?.length&&(L.isExpanded!==false&&M.add(L.id),le(L.subtasks));}return le(e),M},[e]),Ct=react.useMemo(()=>Xe.filter(M=>M.visible),[Xe]),ht=react.useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),wt=react.useCallback(M=>{Ge===M?Z(le=>le==="asc"?"desc":"asc"):(U(M),Z("asc")),a.onSortChange?.({column:M,direction:oe==="asc"?"desc":"asc"});},[Ge,oe,a]),rt=react.useCallback(M=>{pe(M),a.onColumnsChange?.(M);},[a]),Lt=react.useCallback(M=>{let le=Xe.map(fe=>fe.id===M?{...fe,visible:false}:fe);rt(le);},[Xe,rt]),We=react.useCallback((M,le)=>{U(M),Z(le);},[]),Be=react.useCallback((M,le,fe)=>{y&&(M.preventDefault(),nt({isOpen:true,x:M.clientX,y:M.clientY,type:le?"task":"header",task:le,columnId:fe}));},[y]),pt=react.useCallback(()=>{nt(M=>({...M,isOpen:false}));},[]),ie=react.useCallback((M,le)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let fe=Xe.find(L=>L.id===le);fe&&(re(le),Ne(M.clientX),Fe(fe.width));},[Xe,f]);react.useEffect(()=>{if(!W)return;let M=fe=>{let L=fe.clientX-Ue,G=Math.max(50,ze+L),de=Xe.map(T=>T.id===W?{...T,width:G}:T);pe(de);},le=()=>{W&&a.onColumnsChange?.(Xe),re(null);};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",le),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",le);}},[W,Ue,ze,Xe,a]);let be=react.useCallback((M,le)=>{if(le==="name"){M.preventDefault();return}ut(le),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",le),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),A=react.useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),ut(null),Ze(null);},[]),K=react.useCallback((M,le)=>{M.preventDefault(),le!=="name"&&(M.dataTransfer.dropEffect="move",Ze(le));},[]),X=react.useCallback(()=>{Ze(null);},[]),me=react.useCallback((M,le)=>{if(M.preventDefault(),!lt||lt===le||le==="name")return;let fe=[...Xe],L=fe.findIndex(T=>T.id===lt),G=fe.findIndex(T=>T.id===le);if(L===-1||G===-1)return;let de=fe.splice(L,1);de[0]&&(fe.splice(G,0,de[0]),rt(fe),ut(null),Ze(null));},[lt,Xe,rt]),Ee=react.useCallback(async M=>{if(a.onCreateCustomField){let le={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(le);}Ce(false);},[a]),Ye=react.useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Ve=react.useMemo(()=>{let M=Rg(e);if(Se.trim()){let le=Se.toLowerCase();M=M.filter(fe=>fe.name.toLowerCase().includes(le));}return Ie!=="all"&&(M=M.filter(le=>Ye(le)===Ie)),et&&(M=M.filter(le=>Ye(le)!=="completed")),M.sort((le,fe)=>{let L,G;switch(Ge){case "name":L=le.name.toLowerCase(),G=fe.name.toLowerCase();break;case "startDate":L=le.startDate?.getTime()||0,G=fe.startDate?.getTime()||0;break;case "endDate":L=le.endDate?.getTime()||0,G=fe.endDate?.getTime()||0;break;case "progress":L=le.progress||0,G=fe.progress||0;break;case "status":L=le.status||"todo",G=fe.status||"todo";break;case "priority":let de={urgent:0,high:1,medium:2,low:3,none:4};L=de[le.priority]??4,G=de[fe.priority]??4;break;case "position":return 0;default:return 0}return L<G?oe==="asc"?-1:1:L>G?oe==="asc"?1:-1:0}),M},[e,Se,Ie,et,Ge,oe,Ye]),Oe=react.useCallback((M,le)=>{let fe=de=>{a.onTaskUpdate?.({...M,...de});},L=de=>de?M.customFields?.find(j=>j.fieldId===de)?.value:void 0,G=(de,T)=>{if(!de)return;let xe=[...M.customFields||[]],Le=xe.findIndex(Qe=>Qe.fieldId===de);Le>=0?xe[Le]={fieldId:de,value:T}:xe.push({fieldId:de,value:T}),fe({customFields:xe});};switch(le.type){case "name":return null;case "status":return jsxRuntime.jsx(Dm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:T=>{fe({status:T,progress:T==="completed"?100:T==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsxRuntime.jsx(Em,{value:M.priority,onChange:T=>fe({priority:T}),isDark:H,locale:d});case "assignees":{let T=M.hasChildren,j=M.assignees||[];if(T&&M.subtasks?.length){let xe=new Map;(M.assignees||[]).forEach(Qe=>xe.set(Qe.name,Qe));let Le=Qe=>{(Qe||[]).forEach(tt=>{(tt.assignees||[]).forEach(xt=>{xe.has(xt.name)||xe.set(xt.name,xt);}),tt.subtasks?.length&&Le(tt.subtasks);});};Le(M.subtasks),j=Array.from(xe.values());}return jsxRuntime.jsx(Am,{value:j,availableUsers:i,onChange:xe=>fe({assignees:xe}),isDark:H,locale:d,disabled:T})}case "startDate":return jsxRuntime.jsx(Pi,{value:M.startDate,onChange:T=>fe({startDate:T}),isDark:H,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsxRuntime.jsx(Pi,{value:M.endDate,onChange:T=>fe({endDate:T}),isDark:H,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":return jsxRuntime.jsx($m,{value:M.progress||0,onChange:T=>{let j=T===100?"completed":T>0?"in-progress":"todo";fe({progress:T,status:j});},isDark:H});case "tags":return jsxRuntime.jsx(Xm,{value:M.tags||[],isDark:H});case "text":return jsxRuntime.jsx(Um,{value:L(le.customFieldId)||"",onChange:T=>G(le.customFieldId,T),isDark:H});case "number":return jsxRuntime.jsx(Gm,{value:L(le.customFieldId)||0,onChange:T=>G(le.customFieldId,T),isDark:H});case "date":let de=L(le.customFieldId);return jsxRuntime.jsx(Pi,{value:de?new Date(de):void 0,onChange:T=>G(le.customFieldId,T),isDark:H,locale:d});case "dropdown":return jsxRuntime.jsx(_m,{value:L(le.customFieldId)||"",options:le.options||[],onChange:T=>G(le.customFieldId,T),isDark:H});case "checkbox":return jsxRuntime.jsx(Km,{value:L(le.customFieldId)||false,onChange:T=>G(le.customFieldId,T),isDark:H});case "estimatedTime":{let T=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(ar,{value:M.estimatedTime,onChange:j=>fe({estimatedTime:j}),isDark:H,locale:d,disabled:T,lens:C,hourlyRate:F(M)})}case "quotedTime":{let T=M.status==="completed"||M.progress===100,j=k?.enabled&&(!k.columns||k.columns.includes("quotedTime"));return jsxRuntime.jsx(ar,{value:M.quotedTime,onChange:xe=>fe({quotedTime:xe}),isDark:H,locale:d,disabled:T,isBlurred:j,lens:C,hourlyRate:F(M)})}case "elapsedTime":{let T=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(ar,{value:M.elapsedTime,onChange:j=>fe({elapsedTime:j}),isDark:H,locale:d,disabled:T,lens:C,hourlyRate:F(M)})}case "effortMinutes":{if(P&&M.subtasks&&M.subtasks.length>0){let{allocated:Qe,quoted:tt}=En(M),xt=F(M);if(C==="financial"&&xt&&Qe>0&&tt>0){let Rt=Math.round(Qe/60*xt),Ot=Math.round(tt/60*xt)-Rt;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:C,hourlyRate:F(M)}),Ot!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ot>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>0?"+":"",Ot>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`]})]})}return jsxRuntime.jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:C,hourlyRate:F(M)})}let T=M.status==="completed"||M.progress===100,j=M.effortMinutes||0,xe=M.soldEffortMinutes||0,Le=F(M);if(C==="financial"&&Le&&j>0&&xe>0){let Qe=Math.round(j/60*Le),xt=Math.round(xe/60*Le)-Qe;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ar,{value:j,onChange:Rt=>fe({effortMinutes:Rt}),isDark:H,locale:d,disabled:T,lens:C,hourlyRate:F(M)}),xt!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",xt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`]})]})}return jsxRuntime.jsx(ar,{value:j,onChange:Qe=>fe({effortMinutes:Qe}),isDark:H,locale:d,disabled:T,lens:C,hourlyRate:F(M)})}case "timeLoggedMinutes":{if(P&&M.subtasks&&M.subtasks.length>0){let{spent:j}=En(M);return jsxRuntime.jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:C,hourlyRate:F(M)})}let T=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(ar,{value:M.timeLoggedMinutes,onChange:a.onLogTime?j=>{a.onLogTime?.(M,j);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:T,lens:C,hourlyRate:F(M)})}case "soldEffortMinutes":{if(P&&M.subtasks&&M.subtasks.length>0){let{quoted:xe}=En(M),Le=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,isBlurred:Le,lens:C,hourlyRate:F(M)})}let T=M.status==="completed"||M.progress===100,j=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ar,{value:M.soldEffortMinutes,onChange:xe=>fe({soldEffortMinutes:xe}),isDark:H,locale:d,disabled:T,isBlurred:j,lens:C,hourlyRate:F(M)})}case "scheduleVariance":{let T=M.effortMinutes||0,j=M.soldEffortMinutes||0,xe=M.timeLoggedMinutes||0,Le=T>0||j>0||xe>0;return jsxRuntime.jsx(eg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Le})}case "hoursBar":{if(P&&M.hasChildren){let{spent:T,allocated:j,quoted:xe}=En(M),Le=T>j&&j>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",Le?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Sn(T)}),j>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-white/60":"text-gray-600",children:Sn(j)})]}),xe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Sn(xe)})]})]})}return jsxRuntime.jsx(ag,{task:M,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:C,hourlyRate:F(M)})}case "teamLoad":return jsxRuntime.jsx(og,{task:M,isDark:H,locale:d});case "blockers":return jsxRuntime.jsx(sg,{blockers:M.blockers,isDark:H,locale:d});case "weight":{let T=Re.get(M.id);if(T!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",T>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:T>0?`${Number(T.toFixed(2))}%`:"\u2014"});let j=M.weight||0;return jsxRuntime.jsx(tw,{value:j,onChange:xe=>fe({weight:xe}),isDark:H})}default:return jsxRuntime.jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,P,Re]),bt=react.useCallback(M=>{let fe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof fe=="string"?fe:String(fe||M.type)},[O,d]),gt=react.useMemo(()=>{let fe=Ct.reduce((G,de)=>G+de.width,0)+(v?48:0),L={};for(let G of Ct)L[G.id]=`${G.width/fe*100}%`;return L},[Ct,v]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Ke,className:u(H?"bg-[#0D0D0D]":"bg-white",W&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ve.length," ",O.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Se,onChange:M=>ke(M.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"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"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),b&&Te>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:q,onClick:()=>D(!ne),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?ne?"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]":ne?"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"}),Je==="all"?d==="es"?"Todos":"All":`L${Je}`]}),ne&&jsxRuntime.jsx("div",{ref:ce,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Te,5)},(M,le)=>({value:le+1,label:`L${le+1}`}))].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{z(M.value),D(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?Je===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Je===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:M.label}),Je===M.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsxRuntime.jsx(Eg,{value:Ie,hideCompleted:et,onChange:He,onHideCompletedChange:ae,isDark:H,locale:d}),B?.enabled&&B.data&&!Y&&jsxRuntime.jsx("button",{onClick:()=>ye(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),w&&x&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:O.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ct.map(M=>{let le=M.id!=="name",fe=st===M.id&&lt!==M.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",le&&"cursor-grab",lt===M.id&&"opacity-50",fe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:gt[M.id],minWidth:M.minWidth},draggable:le,onDragStart:le?L=>be(L,M.id):void 0,onDragEnd:le?A:void 0,onDragOver:le?L=>K(L,M.id):void 0,onDragLeave:le?X:void 0,onDrop:le?L=>me(L,M.id):void 0,onContextMenu:L=>Be(L,void 0,M.id),children:[le&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>wt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[bt(M),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",Ge===M.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:bt(M)}),f&&M.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",W===M.id&&"bg-[#007BFF]"),onMouseDown:L=>ie(L,M.id)})]},M.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),mt(le=>!le);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",at&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(wg,{isOpen:at,onClose:()=>mt(false),columns:Xe,customFields:c,onColumnsChange:rt,onCreateCustomField:()=>{mt(false),Ce(true);},isDark:H,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ve.map((M,le)=>{let fe=zt.has(M.id),L=Math.min(le*.01,.2),G=M.hasChildren&&M.level===0,de=M.subtasks?.length||0;if(G){let{spent:T,allocated:j,quoted:xe}=En(M),Le=Z1(M),Qe=ew(M);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:L},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:Ct.map(tt=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:gt[tt.id],minWidth:tt.minWidth},children:tt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:xt=>{xt.stopPropagation(),ht(M.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:xt=>{xt.stopPropagation(),ht(M.id);},className:"flex-shrink-0 cursor-pointer",children:fe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxRuntime.jsx("span",{title:M.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:M.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",de," ",d==="es"?de===1?"Tarea":"Tareas":de===1?"Item":"Items",")"]}),Le!==null&&jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Le>=1?"text-[#32D74B]":Le>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Le.toFixed(2)]}),Qe>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Qe]})]}):tt.type==="timeLoggedMinutes"?jsxRuntime.jsx(ar,{value:T>0?T:void 0,isDark:H,locale:d,disabled:true,lens:C,hourlyRate:F(M)}):tt.type==="soldEffortMinutes"?jsxRuntime.jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,lens:C,hourlyRate:F(M)}):tt.type==="effortMinutes"?jsxRuntime.jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:C,hourlyRate:F(M)}):Oe(M,tt)},tt.id))},M.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:L},className:u("flex items-center border-b transition-colors",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:T=>Be(T,M),children:[Ct.map(T=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:gt[T.id],minWidth:T.minWidth},children:T.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&M.level>0&&jsxRuntime.jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),b&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),ht(M.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),b&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate font-bold text-[13px]",M.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Oe(M,T)},T.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),te&&Ve.length>0&&(()=>{let{spent:M,allocated:le,quoted:fe}=ee,L=le-M,G=L<0,de=G?`+${Sn(Math.abs(L))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Sn(L)} ${d==="es"?"AHORRADO":"SAVED"}`,T=C==="financial"&&I>0,j=Qe=>T?`$${(Qe/60*I).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Sn(Qe),xe=T?Math.abs(L/60*I):0,Le=T?`${G?"+":"-"}$${xe.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${G?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:de;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ct.map(Qe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:gt[Qe.id],minWidth:Qe.minWidth},children:Qe.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Qe.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(M)}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(le)}),le>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold ml-1",G?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:T?Le:de})]}):Qe.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe>0?j(fe):"\u2013"}):Qe.type==="effortMinutes"?(()=>{if(T&&fe>0&&le>0){let tt=Math.round(fe/60*(I||25)),xt=Math.round(le/60*(I||25)),Rt=tt-xt,na=tt>0?Math.round(Rt/tt*100):0;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(le)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Rt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>=0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:le>0?j(le):"\u2013"})})():Qe.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?j(M):"\u2013"}):Qe.type==="progress"?(()=>{let tt=e||[],xt=0,Rt=0,na=0,Ot=0;for(let cr of tt){let Ka=cr.weight||Re.get(cr.id)||0,Pn=cr.progress||0;Ka>0&&(xt+=Pn*Ka,Rt+=Ka),na+=Pn,Ot++;}let _a=Rt>0?Math.round(xt/Rt*10)/10:Ot>0?Math.round(na/Ot):0;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_a,"%"]})})():Qe.type==="weight"?(()=>{let tt=e||[],xt=[],Rt=cr=>{for(let Ka of cr)xt.push(Ka),Ka.subtasks?.length&&Rt(Ka.subtasks);};Rt(tt);let Ot=xt.filter(cr=>!cr.subtasks?.length||cr.subtasks.length===0).reduce((cr,Ka)=>cr+(Ka.weight||0),0),_a=Math.abs(Ot-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",_a?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ot.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Qe.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ve.length===0&&Se&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),B?.enabled&&B.data&&Y&&jsxRuntime.jsx(Mg,{data:B.data,isDark:H,locale:d,onClose:()=>ye(false),lens:t?.lens})]}),jsxRuntime.jsx(cg,{state:yt,onClose:pt,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Lt,onColumnSort:We,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(Tg,{isOpen:Pt,onClose:()=>Ce(false),onSave:Ee,isDark:H,locale:d})]})}var $g=[{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:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,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}],Hg=[{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"}],zg=[{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 Kd={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"},Yd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},qd={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"},Hi={dark:Kd,light:Yd,neutral:qd};function Ug(e){return Hi[e]||Hi.dark}var Xd={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"}},Jd={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"}},zi={en:Xd,es:Jd};function ds(e){return zi[e]||zi.en}function Ui(e,t){let a=ds(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 Wg(e){let t=ds(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 Vg(e,t=0,a=true){let r=ds(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 us(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 Zd(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 jg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var qg=26,dw=22,cw=10;function Kg(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 ec(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 Xg(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 Yg(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 uw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",b=c.isCriticalPath,h=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",v=m?ec(c.effortMinutes,n,i):null,f=m?Xg(c,n,i):null,y=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",h,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":b?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*qg}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${dw}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)"}:b?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?b?"#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:[b&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),y&&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,": ",y.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Jg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,timerState:x,onLogTime:N,onUpdateEstimate:k,onUpdateSoldEffort:S,onStartTimer:C,onStopTimer:I,onDiscardTimer:$,blurFinancials:P=false,suppressDetailModal:te=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:J="en",customTranslations:ee,showBacklog:Re=true}=t,B=Ui(J,ee),Y=F==="dark"||F==="neutral",[ye,Ge]=react.useState(r||new Date),[U,oe]=react.useState(null),[Z,Se]=react.useState(null),[ke,Ie]=react.useState(null),[He,et]=react.useState({}),ae=3,Xe=3,pe=react.useCallback(W=>{Se(W.id),te||oe(W),v?.(W.id);},[te,v]),[at,mt]=react.useState(null),Pt=react.useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),Ce=react.useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),yt=react.useCallback(()=>{Ge(new Date);},[]),nt=react.useMemo(()=>{let W=ye.getFullYear(),re=ye.getMonth(),Ue=new Date(W,re,1),Ne=new Date(W,re+1,0),ze=Ue.getDay(),Fe=Ne.getDate(),Ke=us(e),lt=new Date;lt.setHours(0,0,0,0);let ut=[],st=ze,Ze=new Date(W,re,0).getDate();for(let Ct=st-1;Ct>=0;Ct--){let ht=new Date(W,re-1,Ze-Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>Zd(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ct=1;Ct<=Fe;Ct++){let ht=new Date(W,re,Ct),wt=ht.getTime()===lt.getTime();ut.push({date:ht,isCurrentMonth:true,isToday:wt,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(rt=>Zd(ht,rt)).map(rt=>({id:rt.id,title:rt.name,start:rt.startDate,end:rt.endDate,task:rt}))});}let zt=42-ut.length;for(let Ct=1;Ct<=zt;Ct++){let ht=new Date(W,re+1,Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>Zd(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return ut},[ye,e]),Je=react.useMemo(()=>us(e).filter(W=>!W.startDate||!W.endDate),[e]),z=react.useMemo(()=>{let W=us(e),re=0,Ue=0,Ne=0,ze=0,Fe=0;W.forEach(Ze=>{Ze.effortMinutes&&(re+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Ue+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Ne+=Ze.scheduleVariance,ze++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Fe+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ke=Ue>0?Math.min(100,Math.round(re/Ue*100)):0,lt=ze>0?Math.round(Ne/ze):0,st=`${Fe<0?"-":"+"}${Yg(Fe,O,H)}`;return {budgetUtil:Ke,avgVariance:lt,costDisplay:st,hasCostData:Ue>0}},[e,O,H]),ne=react.useMemo(()=>{let W=[0,0,0,0,0,0];return nt.forEach((re,Ue)=>{let Ne=Math.floor(Ue/7);re.events.forEach(ze=>{if(ze.task.startDate&&ze.task.soldEffortMinutes){let Fe=new Date(ze.task.startDate),Ke=re.date;Fe.getFullYear()===Ke.getFullYear()&&Fe.getMonth()===Ke.getMonth()&&Fe.getDate()===Ke.getDate()&&Ne<W.length&&(W[Ne]-=ze.task.soldEffortMinutes);}});}),W},[nt]),D=react.useMemo(()=>{let W=us(e),re=new Map,Ue=new Set,Ne=[0,0,0,0,0,0];if(nt.length===0)return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne};let ze=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Fe=ze(nt[0].date),Ke=ze(nt[nt.length-1].date),lt=[];for(let st of W){if(!st.startDate||!st.endDate)continue;let Ze=ze(st.startDate),zt=ze(st.endDate);if(Ze.getTime()===zt.getTime()||zt<Fe||Ze>Ke)continue;let Ct=Ze<Fe?Fe:Ze,ht=zt>Ke?Ke:zt,wt=Kg(Ct,Fe),rt=Kg(ht,Fe);wt<0||wt>41||rt<0||rt>41||wt!==rt&&(Ue.add(st.id),lt.push({task:st,startIdx:wt,endIdx:rt}));}lt.sort((st,Ze)=>st.startIdx!==Ze.startIdx?st.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(st.endIdx-st.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:st,startIdx:Ze,endIdx:zt}of lt){let Ct=Math.floor(Ze/7),ht=Math.floor(zt/7),wt=ze(st.startDate),rt=ze(st.endDate),Lt=false;for(let We=Ct;We<=ht;We++){let Be=We===Ct?Ze%7:0,pt=We===ht?zt%7:6,ie=pt-Be+1,be=0,A=ut[We]??[];for(ut[We]||(ut[We]=A);be<A.length&&(A[be]??-1)>=Be;)be++;if(be>=cw){Lt=true;break}be>=A.length?A.push(pt):A[be]=pt,Ne[We]=Math.max(Ne[We]??0,be+1);let K=We===Ct&&wt>=Fe,X=We===ht&&rt<=Ke,me=We*7+Be,Ee={taskId:st.id,task:st,rowIndex:We,startCol:Be,endCol:pt,spanCols:ie,lane:be,isStart:K,isEnd:X};re.has(me)||re.set(me,[]),re.get(me).push(Ee);}Lt&&(Ue.delete(st.id),re.forEach((We,Be)=>{let pt=We.filter(ie=>ie.taskId!==st.id);pt.length===0?re.delete(Be):re.set(Be,pt);}));}return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne}},[nt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=ye.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ce.charAt(0).toUpperCase()+ce.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",Y?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",Y?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",Y?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",Y?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",Y?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",Y?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",Y?"bg-[#050505]":"bg-white",n),style:i,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",Y?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",Y?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",Y?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",Y?"text-white":"text-gray-900"),children:Te}),jsxRuntime.jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:yt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",Y?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",Y?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",Y?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Se(null),children:nt.map((W,re)=>{let Ue=re%7===6,Ne=re>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(Y?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(Y?"border-b border-[#222]":"border-b border-gray-200"),Y?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&Y&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!Y&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?Y?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?Y?"text-white/60":"text-gray-900":Y?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let ze=Math.floor(re/7),Fe=(D.maxLanesPerRow[ze]??0)*qg,Ke=D.segmentsByCell.get(re);return Fe===0&&!Ke?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Fe}px`,zIndex:5},children:Ke?.map(lt=>jsxRuntime.jsx(uw,{segment:lt,isDark:Y,blurFinancials:P,isSelected:Z===lt.taskId,t:B,lens:O,hourlyRate:H,onClick:()=>{pe(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let ze=W.events.filter(Fe=>Fe.task.isMilestone&&!D.multiDayTaskIds.has(Fe.id));return ze.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[ze.slice(0,4).map(Fe=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Fe.title,onClick:Ke=>{Ke.stopPropagation(),pe(Fe.task);}},Fe.id)),ze.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",Y?"text-white/30":"text-gray-400"),children:["+",ze.length-4]})]})})(),(()=>{let ze=[];W.events.forEach(Ke=>{Ke.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&ze.push({taskId:Ke.id,type:lt.type,severity:lt.severity,variance:Ke.task.scheduleVariance});});});let Fe=ze[0];return Fe?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Fe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Fe.type,Fe.variance?` (+${Math.abs(Fe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let ze=W.events.filter(ut=>!D.multiDayTaskIds.has(ut.id)),Fe=He[re]||ae,Ke=ze.slice(0,Fe),lt=ze.length-Fe;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(ut=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{pe(ut.task),a.onEventClick?.(ut);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ut.task.progress===100||ut.task.status==="completed"?Y?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":Y?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:Y?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:u("flex-shrink-0 text-[9px]",ut.task.isMilestone?Y?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":Y?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),lt>0&&jsxRuntime.jsxs("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:Fe+Xe}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",J==="es"?"m\xE1s":"more"]}),Fe>ae&&ze.length>ae&&jsxRuntime.jsx("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let ze=re>=28,Fe=re%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ke=>{Ke.stopPropagation(),mt(at===re?null:re);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===re?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",at===re&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at===re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:ze?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ze?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",ze?"bottom-full mb-1":"top-full mt-1",Fe?"right-0":"left-0",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(Ro,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||W.date,endDate:Ke.endDate||W.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:Y,locale:J==="es"?"es":"en",defaultDate:W.date,dropdownDirection:ze?"up":"down"})})]})})]})})()}),re%7===6&&(()=>{let ze=Math.floor(re/7),Fe=ne[ze];if(!Fe||Fe===0)return null;let Ke=Yg(Fe,O,H);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Fe<0?"text-red-400":"text-emerald-400",P&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Fe<0?"-":"+",Ke]})})()]},re)})})})]}),Re&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",Y?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",Y?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",Y?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",Y?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",Y?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",Y?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{pe(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",Y?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",Y?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",Y?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(re=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${re.color}15`,color:re.color,border:`1px solid ${re.color}30`},children:re.name},re.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",Y?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",Y?"text-white/25":"text-gray-400",P&&"blur-sm select-none"),children:[ec(W.effortMinutes,O,H)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",ec(W.effortMinutes,O,H)]}),(()=>{let re=Xg(W,O,H);return re?jsxRuntime.jsx("span",{className:re.isNegative?"text-red-400":"text-emerald-400",children:re.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(jg,{task:W,isDark:Y})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((re,Ue)=>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:re.color||"#007FFF"},title:re.name,children:re.initials||re.name?.slice(0,2).toUpperCase()},Ue))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",Y?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),z.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",Y?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",Y?"text-white/60":"text-gray-700",P&&"blur-sm select-none"),children:[z.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",Y?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.budgetUtil}%`,background:z.budgetUtil>90?"#EF4444":z.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.avgVariance>0?"text-emerald-400":z.avgVariance<0?"text-red-400":Y?"text-white/50":"text-gray-600"),children:[z.avgVariance>0?"+":"",z.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",P&&"blur-sm select-none"),children:z.costDisplay})]})]})]})]})]}),!te&&jsxRuntime.jsx(Jr,{task:U,isOpen:!!U,onClose:()=>oe(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),oe(W);},theme:F==="dark"?"dark":"light",locale:J,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:U?p?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:us(e).filter(W=>W.id!==U?.id),comments:d?.filter(W=>W.taskId===U?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:k,onSoldEffortUpdate:S,onTimerStart:C,onTimerStop:I,onTimerDiscard:$,blurFinancials:P}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",Y?"text-white/90":"text-gray-900"),children:ke.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",Y?"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:ke.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(null),pe(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(jg,{task:W.task,isDark:Y}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",Y?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var 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)"},ac={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)"},rc={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)"},Gi={dark:tc,light:ac,neutral:rc};function Qg(e){return Gi[e]||Gi.dark}function mw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,b=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,h=p.map(f=>f.priority).filter(Boolean),v=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:h,labels:v}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.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 e0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ms(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 gs(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 a0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=react.useMemo(()=>({...e0,...n}),[n]),[l,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(w=>{let x=w.timestamp.toISOString().split("T")[0],N=y.get(x);N?N.push(w):y.set(x,[w]);}),Array.from(y.entries()).sort((w,x)=>x[0].localeCompare(w[0])).map(([w,x])=>({date:new Date(w),events:x.sort((N,k)=>k.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=react.useMemo(()=>{let y=new Set,w=new Set;return e.forEach(x=>{y.add(x.userId),w.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(w)}},[e]),h=y=>{p(w=>{let x=new Set(w);return x.has(y)?x.delete(y):x.add(y),x});},v=y=>{let x=new Date().getTime()-y.getTime(),N=Math.floor(x/6e4),k=Math.floor(x/36e5),S=Math.floor(x/864e5);return N<1?"just now":N<60?`${N}m ago`:k<24?`${k}h ago`:S<7?`${S}d ago`:y.toLocaleDateString()},f=react.useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return react.useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",i),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(y=>jsxRuntime.jsxs("option",{value:y,children:[gs(y)," ",y.replace("_"," ")]},y))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((w,x)=>{let N=l.has(w.id),k=s===w.id,S=t0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",k&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:S},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:gs(w.type)})}),x<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:S}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ms(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),h(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([C,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},C)),w.metadata&&Object.keys(w.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(w.metadata).map(([C,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},C))]})]})]})]},w.id)})})]},y.date?.toISOString()||"all"))})]})}function o0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&gs(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&ms(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(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,b)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>i(b),title:ms(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function oc(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 nc(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 n0(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 s0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function xw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*l,p.vy+=(m-p.y)*o.centerForce*l,n.forEach(g=>{if(p.id===g.id)return;let b=p.x-g.x,h=p.y-g.y,v=Math.sqrt(b*b+h*h)||1,f=o.chargeStrength*l/(v*v);p.vx+=b/v*f,p.vy+=h/v*f;});}),t.forEach(p=>{let d=i.get(typeof p.source=="string"?p.source:p.source.id),m=i.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,b=m.y-d.y,h=Math.sqrt(g*g+b*b)||1,v=(h-o.linkDistance)/h*o.forceStrength*l;d.vx+=g*v,d.vy+=b*v,m.vx-=g*v,m.vy-=b*v;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function i0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(1),[x,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=xw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let k=react.useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),S=react.useCallback(O=>{if(!m||!l.current)return;let F=l.current.getBoundingClientRect(),J=(O.clientX-F.left-x.x)/y,ee=(O.clientY-F.top-x.y)/y;d(Re=>Re.map(B=>B.id===m?{...B,x:J,y:ee,fx:J,fy:ee}:B));},[m,y,x]),C=react.useCallback(()=>{g(null);},[]),I=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),$=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),P=react.useCallback(O=>{let H=p.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[p]),te=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:u("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:oc(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[n0(O)," ",nc(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:S,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=P(typeof O.source=="string"?O.source:O.source.id),F=P(typeof O.target=="string"?O.target:O.target.id),J=s0(O.type),ee=v===O.id,Re=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",Re&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>$(O,B),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:oc(O.type),strokeWidth:Re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsxRuntime.jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:nc(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(O=>{let H=b===O.id,F=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:J=>k(O.id,J),onMouseEnter:()=>h(O.id),onMouseLeave:()=>h(null),onClick:J=>I(O,J),children:[jsxRuntime.jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:te(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function c0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[i,c]=react.useState(false),[l,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),b=i||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&!b&&h();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,b]);let h=()=>{b||(n(""),p(null),m(null),t());},v=async()=>{if(!(!s.trim()||b)){c(true),p(null),m(null);try{let y=await r(s.trim());m(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),h());};return e?jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:h,disabled:b,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:b}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,w)=>jsxRuntime.jsx("button",{onClick:()=>n(y),disabled:b,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&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:h,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!s.trim()||b,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:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var sc={"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 ww={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},kw={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 Cw(e,t,a){let r=sc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function fs(e){return `$${e.toFixed(4)}`}var ic=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Cw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),l={},p={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let 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 i=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=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)}},_o=new ic;function m0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(_o.getStats()),[s,n]=react.useState(_o.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(_o.getStats()),n(_o.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=_o.getRecentOperations(5);return jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:fs(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:fs(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:i.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:fs(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function b0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=react.useState(""),[c,l]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(null),x=react.useRef(null),N=m||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let $=P=>{P.key==="Escape"&&!N&&k();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,N]);let k=()=>{N||(i(""),l(""),d(""),h(null),f(null),w(null),t());},S=async()=>{if(!(!n.trim()||N)){g(true),h(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){h($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},C=()=>{v&&(a(v),k());};if(!e)return null;let I=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:$=>$.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:k,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:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(($,P)=>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:["#",P+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:$.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"})]}),$.start," \u2192 ",$.end]}),jsxRuntime.jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.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:x,value:n,onChange:$=>i($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:$=>l($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:$=>d($.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})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map(($,P)=>jsxRuntime.jsx("button",{onClick:()=>i($),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},P))})]})]})}),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:k,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"}),v?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:S,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 Ki({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&Fs(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,y,w)=>{console.warn(`Retry attempt ${y} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(v,f,y)=>{r(w=>{let x=w.cards.find($=>$.id===v);if(!x)return w;let N=x.columnId,k={...x,columnId:f,position:y},S=w.cards.map($=>$.id===v?k:$),C=w.columns.map($=>{if($.id===N)return {...$,cardIds:$.cardIds.filter(P=>P!==v)};if($.id===f){let P=S.filter(te=>te.columnId===f).sort((te,O)=>te.position-O.position);return {...$,cardIds:P.map(te=>te.id)}}return $}),I={...w,cards:S,columns:C};return o(I),I});},[o]),n=react.useCallback(async(v,f)=>{r(y=>{let w=y.cards.map(N=>N.id===v?{...N,...f}:N),x={...y,cards:w};return o(x),x});},[o]),i=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f},x=y.columns.map(k=>k.id===v.columnId?{...k,cardIds:[...k.cardIds,f]}:k),N={...y,cards:[...y.cards,w],columns:x};return o(N),N});},[o]),c=react.useCallback(async v=>{r(f=>{let y=f.cards.find(k=>k.id===v);if(!y)return f;let w=f.cards.filter(k=>k.id!==v),x=f.columns.map(k=>k.id===y.columnId?{...k,cardIds:k.cardIds.filter(S=>S!==v)}:k),N={...f,cards:w,columns:x};return o(N),N});},[o]),l=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f,cardIds:[]},x={...y,columns:[...y.columns,w]};return o(x),x});},[o]),p=react.useCallback(async(v,f)=>{r(y=>{let w=y.columns.map(N=>N.id===v?{...N,...f}:N),x={...y,columns:w};return o(x),x});},[o]),d=react.useCallback(async v=>{r(f=>{let y=f.cards.filter(N=>N.columnId!==v),w=f.columns.filter(N=>N.id!==v),x={...f,cards:y,columns:w};return o(x),x});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),b=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:b}}}function y0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Ki({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var bs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},v0={by:"none",order:"asc"};function w0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...bs,...e}),[s,n]=react.useState({...v0,...t}),i=react.useCallback(h=>{o(v=>({...v,...h}));},[]),c=react.useCallback(h=>{n(v=>({...v,...h}));},[]),l=react.useCallback(()=>{o(bs),n(v0);},[]),p=react.useCallback(()=>{a&&o({...bs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...bs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...bs,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),b=react.useCallback(h=>{let v=[...h];if(r.search){let f=r.search.toLowerCase();v=v.filter(y=>y.title.toLowerCase().includes(f)||y.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,y=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),x=String(f.getDate()).padStart(2,"0"),N=`${y}-${w}-${x}`;v=v.filter(k=>{if(!k.endDate&&!k.dueDate)return false;let S=k.endDate||k.dueDate;if(!S)return false;let C;if(typeof S=="string")C=S.split("T")[0]||S;else {let I=S.getUTCFullYear(),$=String(S.getUTCMonth()+1).padStart(2,"0"),P=String(S.getUTCDate()).padStart(2,"0");C=`${I}-${$}-${P}`;}switch(r.dateFilter){case "overdue":return C<N;case "today":return C===N;case "this-week":let I=new Date(N+"T00:00:00"),$=new Date(C+"T00:00:00"),P=new Date(I);return P.setDate(P.getDate()+7),$>=I&&$<=P;case "custom":if(r.dateRange){let te=typeof S=="string"?new Date(S):S;return te>=r.dateRange.start&&te<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,y)=>{let w=0;switch(s.by){case "created":let x=f.createdAt?new Date(f.createdAt).getTime():0,N=y.createdAt?new Date(y.createdAt).getTime():0;w=x-N;break;case "priority":let k={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},S=k[f.priority||"LOW"],C=k[y.priority||"LOW"];w=S-C;break;case "dueDate":let I=f.endDate||f.dueDate,$=y.endDate||y.dueDate;if(!I)return 1;if(!$)return -1;let P=typeof I=="string"?new Date(I).getTime():I.getTime(),te=typeof $=="string"?new Date($).getTime():$.getTime();w=P-te;break;case "title":w=f.title.localeCompare(y.title);break;case "estimate":let O=f.estimatedTime||0,H=y.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:b,hasActiveFilters:g}}var C0,T0;if(typeof window<"u")try{let e=Ds("ai");C0=e.generateObject,T0=e.generateText;}catch{}function N0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(C0&&T0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function dc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function D0(e){let{cards:t}=e,[a,r]=dc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,b=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let h=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(h&&v&&h.columnId===v.columnId){let f=t.filter(C=>C.columnId===h.columnId).sort((C,I)=>C.position-I.position),y=f.findIndex(C=>C.id===a.lastSelectedCardId),w=f.findIndex(C=>C.id===d),[x,N]=y<w?[y,w]:[w,y],k=f.slice(x,N+1).map(C=>C.id),S=Array.from(new Set([...a.selectedCardIds,...k]));r({selectedCardIds:S,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var S0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function E0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...S0,...a}),[a]),[s,n]=react.useState([]),i=react.useCallback((h,v,f,y,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:v,columnId:f,strategy:y,color:w,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,x]);},[o.minCardsPerStack,s]),c=react.useCallback(h=>{n(v=>v.filter(f=>f.id!==h));},[]),l=react.useCallback(h=>{n(v=>v.map(f=>f.id===h?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((h,v)=>{n(f=>f.map(y=>y.id===h&&!y.cardIds.includes(v)?{...y,cardIds:[...y.cardIds,v]}:y));},[]),d=react.useCallback((h,v)=>{n(f=>f.map(y=>{if(y.id===h){let w=y.cardIds.filter(x=>x!==v);return w.length<o.minCardsPerStack?null:{...y,cardIds:w}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),m=react.useCallback(h=>s.filter(v=>v.columnId===h).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async h=>{let v=t.filter(N=>N.columnId===h);if(v.length<o.minCardsPerStack*2)return [];let f=[],y=new Map;v.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(k=>{y.has(k)||y.set(k,[]),y.get(k).push(N);});}),y.forEach((N,k)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${k}`,cardIds:N.map(S=>S.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${k}"`,confidence:.85});});let w=new Map;v.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(k=>{w.has(k)||w.set(k,[]),w.get(k).push(N);});}),w.forEach((N,k)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${k.slice(-4)}`,cardIds:N.map(S=>S.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(N=>{N.priority&&(x.has(N.priority)||x.set(N.priority,[]),x.get(N.priority).push(N));}),x.forEach((N,k)=>{if(N.length>=o.minCardsPerStack){let S={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[k.toLowerCase()]||"\u26AA";f.push({stack:{title:`${S} ${k} Priority`,cardIds:N.map(C=>C.id),columnId:h,strategy:"priority",color:k==="high"||k==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${k} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of v){let S=(await r.findSimilar(N,v)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(S.length>=o.minCardsPerStack-1){let C=[N.id,...S.map($=>$.card.id)],I=S.reduce(($,P)=>$+P.similarity,0)/S.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:C,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${S.length+1} similar tasks`,confidence:I});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,k)=>k.confidence-N.confidence).slice(0,5)},[t,o,r]),b=react.useCallback(h=>{i(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[i]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),y=f[0];f.length>0&&y&&y.confidence>=.9&&b(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:b,config:o}}var F0=react.createContext(null);function M0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Ds("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Ds("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Ds("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(F0.Provider,{value:{store:o},children:e})}function Yi(){let e=react.useContext(F0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ys(){let e=Yi(),[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 i=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),l=react.useCallback((y,w)=>{e.updateColumn(y,w);},[e]),p=react.useCallback(y=>{e.deleteColumn(y);},[e]),d=react.useCallback(y=>e.getColumn(y),[e]),m=react.useCallback(y=>{e.addCard(y);},[e]),g=react.useCallback((y,w)=>{e.updateCard(y,w);},[e]),b=react.useCallback(y=>{e.deleteCard(y);},[e]),h=react.useCallback((y,w,x)=>{e.moveCard(y,w,x);},[e]),v=react.useCallback(y=>e.getCard(y),[e]),f=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:b,moveCard:h,getCard:v,getCardsByColumn:f}}function A0(e){let{cards:t}=ys();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 L0(e="position",t="asc"){let{cards:a}=ys();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;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 qi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=qc.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 i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{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);}},zw=new qi;function B0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(b=>{let h=e[b.index];if(!h)return null;let v=c?c(h,b.index):b.index,f={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsxRuntime.jsx("div",{style:f,"data-index":b.index,children:r(h,b.index)},v)})})})}function R0(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 $0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:i}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:b,children:m.map(h=>{let v=e[h.index];if(!v)return null;let f=c?c(v,h.index):h.index,y={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":h.index,children:o(v,h.index)},f)})})})}function H0(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 z0(e,t=10){return e>t}var mc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},gc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},bc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},hc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},xc={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)"},wc={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)"},kc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Cc={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}},Tc={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}},Xi={spacing:mc,borderRadius:gc,fontSize:fc,fontWeight:bc,lineHeight:hc,zIndex:yc,duration:xc,easing:vc,shadows:wc,opacity:kc,kanban:Cc,gantt:Tc};function U0(e,t,a){return e[t]??a}function Nc(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)?Nc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Vw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Dc(e="asakaa"){let t=Nc(Xi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Vw(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
- }`}function hs(e,t="asakaa"){let a=[],r=Cc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
416
+ }`}function xs(e,t="asakaa"){let a=[],r=Nc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
417
417
  ${a.join(`
418
418
  `)}
419
- }`}var qi={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"}},Nc={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"}},Dc={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 Sc(e=qi,t="asakaa"){let a=Tc(t),r=hs(e,t);return `${a}
419
+ }`}var Ji={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"}},Sc={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"}},Ec={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 Fc(e=Ji,t="asakaa"){let a=Dc(t),r=xs(e,t);return `${a}
420
420
 
421
- ${r}`}function U0(){return `/**
421
+ ${r}`}function W0(){return `/**
422
422
  * ASAKAA Design Tokens
423
423
  * Auto-generated from design-tokens.ts
424
424
  * Do not edit this file directly
425
425
  */
426
426
 
427
- ${Sc(qi)}
427
+ ${Fc(Ji)}
428
428
 
429
429
  /* Light theme */
430
430
  [data-theme="light"] {
431
- ${hs(Nc,"asakaa").split(`
431
+ ${xs(Sc,"asakaa").split(`
432
432
  `).slice(1,-1).join(`
433
433
  `)}
434
434
  }
435
435
 
436
436
  /* Neutral theme */
437
437
  [data-theme="neutral"] {
438
- ${hs(Dc,"asakaa").split(`
438
+ ${xs(Ec,"asakaa").split(`
439
439
  `).slice(1,-1).join(`
440
440
  `)}
441
441
  }
442
- `}var Vw=({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 W0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=un();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,i])=>{let c=n,l=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Vw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
443
- Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=p0;exports.AI_FEATURES=ww;exports.AI_MODELS=oc;exports.AddCardButton=Al;exports.AddColumnButton=Sl;exports.AttachmentUploader=Ur;exports.BoardProvider=F0;exports.BulkOperationsToolbar=Xs;exports.BurnDownChart=Gl;exports.CUSTOM_FIELD_TYPES=Hg;exports.CalendarBoard=Xg;exports.Card=Kr;exports.CardDetailModal=$l;exports.CardDetailModalV2=Ul;exports.CardHistoryReplay=r0;exports.CardHistoryTimeline=t0;exports.CardRelationshipsGraph=s0;exports.CardStack=pw;exports.CardTemplateSelector=Jl;exports.CircuitBreaker=sl;exports.Column=rn;exports.ColumnManager=ni;exports.CommandPalette=Bl;exports.ConfigMenu=td;exports.ContextMenu=bn;exports.DEFAULT_SHORTCUTS=Yn;exports.DEFAULT_TABLE_COLUMNS=Og;exports.DEFAULT_TEMPLATES=Xl;exports.DateRangePicker=In;exports.DependenciesSelector=Rn;exports.DependencyLine=Qn;exports.DistributionCharts=_l;exports.EditableColumnTitle=gl;exports.ErrorBoundary=sn;exports.ExportImportModal=Zl;exports.FilterBar=ed;exports.GANTT_AI_SYSTEM_PROMPT=bm;exports.GanttAIAssistant=wi;exports.GanttBoard=um;exports.GanttI18nContext=mn;exports.GanttMilestone=bi;exports.GanttToolbar=oi;exports.GenerateGanttTasksDialog=f0;exports.GeneratePlanModal=d0;exports.GroupBySelector=Yl;exports.HealthBar=vl;exports.KanbanBoard=po;exports.KanbanToolbar=Nl;exports.KanbanViewAdapter=_n;exports.KeyboardShortcutsHelp=ql;exports.ListView=Rg;exports.MenuIcons=qt;exports.PluginManager=Ki;exports.PrioritySelector=Fo;exports.ProfitabilityReport=wl;exports.QuickTaskCreate=Io;exports.RATE_LIMITS=vw;exports.STANDARD_FIELDS=$g;exports.SwimlaneBoardView=jl;exports.TagBadge=bl;exports.TagList=Pu;exports.TagPicker=lo;exports.TaskBar=ui;exports.TaskDetailModal=qr;exports.TaskFormModal=fm;exports.TaskGrid=li;exports.ThemeModal=nd;exports.ThemeProvider=Ep;exports.ThemeSwitcher=W0;exports.TimeInputPopover=$r;exports.TimePill=hl;exports.TimePopover=yl;exports.Timeline=yi;exports.UserAssignmentSelector=Po;exports.VelocityChart=Vl;exports.VirtualGrid=O0;exports.VirtualList=I0;exports.aiUsageTracker=Vo;exports.borderRadius=pc;exports.calculatePosition=Ds;exports.calendarDarkTheme=Zd;exports.calendarEnTranslations=Yd;exports.calendarEsTranslations=qd;exports.calendarLightTheme=ec;exports.calendarNeutralTheme=tc;exports.calendarThemes=Wi;exports.calendarTranslations=$i;exports.cardToGanttTask=Ti;exports.cardsToGanttTasks=Cm;exports.cn=u;exports.createKanbanView=ip;exports.createRetryWrapper=Cf;exports.darkTheme=ad;exports.darkTokenTheme=qi;exports.defaultTheme=Qs;exports.designTokens=Yi;exports.duration=hc;exports.easing=yc;exports.exportTokensToCSS=U0;exports.findTaskByName=to;exports.fontSize=mc;exports.fontWeight=gc;exports.formatCost=ms;exports.ganttEnTranslations=ei;exports.ganttEsTranslations=Mp;exports.ganttTaskToCardUpdate=km;exports.ganttThemes=dt;exports.ganttTokens=kc;exports.ganttTranslations=sd;exports.ganttUtils=Pe;exports.generateCSSVariables=Tc;exports.generateCompleteCSS=Sc;exports.generateInitialPositions=xf;exports.generateTasksContext=hm;exports.generateThemeVariables=hs;exports.getCalendarTheme=Jg;exports.getCalendarTranslations=is;exports.getListViewTheme=zg;exports.getListViewTranslations=Sd;exports.getMonthNames=Ug;exports.getToken=z0;exports.getTranslations=Pp;exports.getWeekdayNames=Wg;exports.kanbanTokens=wc;exports.lightTheme=rd;exports.lightTokenTheme=Nc;exports.lineHeight=fc;exports.listViewDarkTheme=_d;exports.listViewEnTranslations=Nd;exports.listViewEsTranslations=Dd;exports.listViewLightTheme=jd;exports.listViewNeutralTheme=Kd;exports.listViewThemes=Oi;exports.listViewTranslations=Ni;exports.mergeCalendarTranslations=Hi;exports.mergeListViewTranslations=Di;exports.mergeTranslations=id;exports.neutralTheme=od;exports.neutralTokenTheme=Dc;exports.opacity=vc;exports.parseLocalCommand=vm;exports.parseNaturalDate=kd;exports.parseNaturalDuration=Cd;exports.parseProgress=Td;exports.parseStatus=xm;exports.pluginManager=Hw;exports.retrySyncOperation=kf;exports.retryWithBackoff=Ss;exports.shadows=xc;exports.shouldVirtualizeGrid=H0;exports.spacing=uc;exports.themes=Oo;exports.useAI=T0;exports.useBoard=h0;exports.useBoardCore=bs;exports.useBoardStore=ji;exports.useCardStacking=S0;exports.useDragState=Cl;exports.useFilteredCards=P0;exports.useFilters=v0;exports.useGanttI18n=Er;exports.useKanbanState=_i;exports.useKeyboardShortcuts=Np;exports.useMultiSelect=N0;exports.useSelectionState=ic;exports.useSortedCards=A0;exports.useTheme=un;exports.useVirtualGrid=$0;exports.useVirtualList=B0;exports.validateAIResponse=wm;exports.withErrorBoundary=Ll;exports.wouldCreateCircularDependency=Fs;exports.zIndex=bc;//# sourceMappingURL=index.cjs.map
442
+ `}var Gw=({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 V0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=pn();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,i])=>{let c=n,l=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Gw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
443
+ Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=m0;exports.AI_FEATURES=kw;exports.AI_MODELS=sc;exports.AddCardButton=Il;exports.AddColumnButton=Fl;exports.AttachmentUploader=Vr;exports.BoardProvider=M0;exports.BulkOperationsToolbar=Qs;exports.BurnDownChart=jl;exports.CUSTOM_FIELD_TYPES=zg;exports.CalendarBoard=Jg;exports.Card=qr;exports.CardDetailModal=zl;exports.CardDetailModalV2=Vl;exports.CardHistoryReplay=o0;exports.CardHistoryTimeline=a0;exports.CardRelationshipsGraph=i0;exports.CardStack=mw;exports.CardTemplateSelector=Zl;exports.CircuitBreaker=ll;exports.Column=on;exports.ColumnManager=ii;exports.CommandPalette=Ol;exports.ConfigMenu=rd;exports.ContextMenu=hn;exports.DEFAULT_SHORTCUTS=qn;exports.DEFAULT_TABLE_COLUMNS=$g;exports.DEFAULT_TEMPLATES=Ql;exports.DateRangePicker=Bn;exports.DependenciesSelector=On;exports.DependencyLine=Zn;exports.DistributionCharts=Kl;exports.EditableColumnTitle=bl;exports.ErrorBoundary=ln;exports.ExportImportModal=td;exports.FilterBar=ad;exports.GANTT_AI_SYSTEM_PROMPT=hm;exports.GanttAIAssistant=Ci;exports.GanttBoard=pm;exports.GanttI18nContext=gn;exports.GanttMilestone=yi;exports.GanttToolbar=si;exports.GenerateGanttTasksDialog=b0;exports.GeneratePlanModal=c0;exports.GroupBySelector=Xl;exports.HealthBar=kl;exports.KanbanBoard=go;exports.KanbanToolbar=Sl;exports.KanbanViewAdapter=jn;exports.KeyboardShortcutsHelp=Jl;exports.ListView=Og;exports.MenuIcons=Qt;exports.PluginManager=qi;exports.PrioritySelector=Po;exports.ProfitabilityReport=Cl;exports.QuickTaskCreate=Ro;exports.RATE_LIMITS=ww;exports.STANDARD_FIELDS=Hg;exports.SwimlaneBoardView=Yl;exports.TagBadge=yl;exports.TagList=Au;exports.TagPicker=uo;exports.TaskBar=mi;exports.TaskDetailModal=Jr;exports.TaskFormModal=bm;exports.TaskGrid=ci;exports.ThemeModal=id;exports.ThemeProvider=Fp;exports.ThemeSwitcher=V0;exports.TimeInputPopover=zr;exports.TimePill=xl;exports.TimePopover=vl;exports.Timeline=vi;exports.UserAssignmentSelector=Lo;exports.VelocityChart=_l;exports.VirtualGrid=$0;exports.VirtualList=B0;exports.aiUsageTracker=_o;exports.borderRadius=gc;exports.calculatePosition=Es;exports.calendarDarkTheme=tc;exports.calendarEnTranslations=Xd;exports.calendarEsTranslations=Jd;exports.calendarLightTheme=ac;exports.calendarNeutralTheme=rc;exports.calendarThemes=Gi;exports.calendarTranslations=zi;exports.cardToGanttTask=Di;exports.cardsToGanttTasks=Tm;exports.cn=u;exports.createKanbanView=lp;exports.createRetryWrapper=Tf;exports.darkTheme=od;exports.darkTokenTheme=Ji;exports.defaultTheme=ei;exports.designTokens=Xi;exports.duration=xc;exports.easing=vc;exports.exportTokensToCSS=W0;exports.findTaskByName=ro;exports.fontSize=fc;exports.fontWeight=bc;exports.formatCost=fs;exports.ganttEnTranslations=ai;exports.ganttEsTranslations=Pp;exports.ganttTaskToCardUpdate=Cm;exports.ganttThemes=dt;exports.ganttTokens=Tc;exports.ganttTranslations=ld;exports.ganttUtils=Pe;exports.generateCSSVariables=Dc;exports.generateCompleteCSS=Fc;exports.generateInitialPositions=vf;exports.generateTasksContext=ym;exports.generateThemeVariables=xs;exports.getCalendarTheme=Qg;exports.getCalendarTranslations=ds;exports.getListViewTheme=Ug;exports.getListViewTranslations=Fd;exports.getMonthNames=Wg;exports.getToken=U0;exports.getTranslations=Ap;exports.getWeekdayNames=Vg;exports.kanbanTokens=Cc;exports.lightTheme=nd;exports.lightTokenTheme=Sc;exports.lineHeight=hc;exports.listViewDarkTheme=Kd;exports.listViewEnTranslations=Sd;exports.listViewEsTranslations=Ed;exports.listViewLightTheme=Yd;exports.listViewNeutralTheme=qd;exports.listViewThemes=Hi;exports.listViewTranslations=Si;exports.mergeCalendarTranslations=Ui;exports.mergeListViewTranslations=Ei;exports.mergeTranslations=dd;exports.neutralTheme=sd;exports.neutralTokenTheme=Ec;exports.opacity=kc;exports.parseLocalCommand=wm;exports.parseNaturalDate=Td;exports.parseNaturalDuration=Nd;exports.parseProgress=Dd;exports.parseStatus=vm;exports.pluginManager=zw;exports.retrySyncOperation=Cf;exports.retryWithBackoff=Fs;exports.shadows=wc;exports.shouldVirtualizeGrid=z0;exports.spacing=mc;exports.themes=Ho;exports.useAI=N0;exports.useBoard=y0;exports.useBoardCore=ys;exports.useBoardStore=Yi;exports.useCardStacking=E0;exports.useDragState=Nl;exports.useFilteredCards=A0;exports.useFilters=w0;exports.useGanttI18n=Mr;exports.useKanbanState=Ki;exports.useKeyboardShortcuts=Dp;exports.useMultiSelect=D0;exports.useSelectionState=dc;exports.useSortedCards=L0;exports.useTheme=pn;exports.useVirtualGrid=H0;exports.useVirtualList=R0;exports.validateAIResponse=km;exports.withErrorBoundary=Bl;exports.wouldCreateCircularDependency=Ps;exports.zIndex=yc;//# sourceMappingURL=index.cjs.map
444
444
  //# sourceMappingURL=index.cjs.map