@libxai/board 1.4.25 → 1.4.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'),xm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Lb=require('react-markdown'),Ib=require('remark-gfm'),Bb=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var xm__default=/*#__PURE__*/_interopDefault(xm);var Lb__default=/*#__PURE__*/_interopDefault(Lb);var Ib__default=/*#__PURE__*/_interopDefault(Ib);var Bb__default=/*#__PURE__*/_interopDefault(Bb);var Qn=(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 es=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 [es.Translate.toString(e),es.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function d(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function ts(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 y0(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Ti(e,t){return e.length===0?1e3:t===0?ts(null,e[0].position):t>=e.length?ts(e[e.length-1].position,null):ts(e[t-1].position,e[t].position)}function oc(e,t=100){return e>t}var x0=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 v0(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 as(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=x0,onRetry:c}=t,u,i=0;for(let m=1;m<=a;m++){i=m;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(u=l,m===a||!n(u,m))return {error:u,attempts:i,success:false};let f=v0(m,r,o,s);if(c)try{c(u,m,f);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,f));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function k0(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 w0(e,t={}){return async(...a)=>as(()=>e(...a),t)}var Ni=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 nc=(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))(nc||{}),xo=class xo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,c=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(c,o,u?n:"");break;case "INFO":console.info(c,o,u?n:"");break;case "WARN":console.warn(c,o,u?n:"");break;case "ERROR":console.error(c,o,u?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",...xo.globalOptions};}static configure(t){xo.globalOptions={...xo.globalOptions,...t};}child(t){return new xo({...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 rs((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new rs(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:nc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};xo.globalOptions={};var Di=xo,rs=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}},sc=new Di;function T0(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 N0(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(c=>c.id===s.columnId);return [s.id,Si(s.title),Si(s.description||""),Si(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 D0(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 xm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=n.toDataURL("image/png"),u=297,i=210,m=n.width/n.height,l=u-20,g=l/m;g>i-20&&(g=i-20,l=g*m);let f=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,u,15,"F"),f.text(e.title||"Kanban Board",10,10);let x=(u-l)/2;return f.addImage(c,"PNG",x,20,l,g),f}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 c=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,c.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):c.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(u.description,160);o.text(m,25,s),s+=m.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let m=[];u.startDate&&m.push(`Start: ${u.startDate}`),u.endDate&&m.push(`End: ${u.endDate}`),i.push(m.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Si(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function lc(e,t,a,r){switch(t){case "json":return T0(e,r);case "csv":return N0(e);case "pdf":return await D0(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function dc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);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"},c=new Blob([e],{type:n[t]}),u=URL.createObjectURL(c),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function S0(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 E0(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=cc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let c=cc(t[n]||"");if(c.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let i={};a.forEach((f,x)=>{i[f]=c[x]||"";});let m=i.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let l=o.get(m),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),l.cardIds.push(g.id);}catch(c){s.push(`Line ${n+1}: ${c instanceof Error?c.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 cc(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 uc(e,t){switch(t){case "json":return S0(e);case "csv":return E0(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function mc(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 Ei=react.createContext(null);function pc(){return react.useContext(Ei)}var gc=react.createContext(null);function fc({children:e,themeName:t}){return jsxRuntime.jsx(gc.Provider,{value:{themeName:t},children:e})}function Wo(){return react.useContext(gc)}function Pt({children:e,container:t}){let[a,r]=react.useState(false),o=pc(),s=Wo();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:c,themeName:u}=o,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var vc={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},R0="#BDC3C7",O0=({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 vo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),c=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let f=u.current.getBoundingClientRect(),x=window.innerHeight,k=window.innerWidth,p=160,v=220,b=4,h=f.right-p;h<10&&(h=f.left),h+p>k-10&&(h=k-p-10);let y=x-f.bottom,C=f.top,N;y>=v+b?N=f.bottom+b:C>=v+b?N=f.top-v-b:N=y>=C?f.bottom+b:Math.max(10,f.top-v-b),n({top:N,left:h}),o(true);};react.useEffect(()=>{let f=x=>{c.current&&!c.current.contains(x.target)&&!u.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let m=f=>{t(f),o(false);},l=e?vc[e]:null,g=l?.color||R0;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:l?.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:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Pt,{children:jsxRuntime.jsxs("div",{ref:c,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(vc).map(([f,x])=>jsxRuntime.jsxs("button",{onClick:()=>m(f),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:x.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(O0,{color:x.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:x.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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:()=>m(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: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var $0=[{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 un({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),g=(Wo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),y=window.innerHeight,C=window.innerWidth,N=320,S=380,w=4,E=h.left;E+N>C-10&&(E=C-N-10),E<10&&(E=10);let L=y-h.bottom,T=h.top,z;L>=S+w?z=h.bottom+w:T>=S+w?z=h.top-S-w:z=L>=T?h.bottom+w:Math.max(10,h.top-S-w),c({top:z,left:E}),s(true);};react.useEffect(()=>{let h=y=>{u.current&&!u.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let x=h=>{let y=new Date,C=E=>{let L=E.getFullYear(),T=String(E.getMonth()+1).padStart(2,"0"),z=String(E.getDate()).padStart(2,"0");return `${L}-${T}-${z}`},N=C(y),S=new Date(y);S.setDate(S.getDate()+h);let w=C(S);a(N,w),s(false);},k=()=>{if(!e||!t)return "Set date";let h=S=>{if(S instanceof Date)return S;if(typeof S!="string"||!S.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=S.split("-").map(Number);if(w.length!==3||w.some(z=>isNaN(z)))return null;let E=w[0],L=w[1],T=w[2];return E===void 0||L===void 0||T===void 0?null:new Date(E,L-1,T)},y=h(e),C=h(t);if(!y||!C||isNaN(y.getTime())||isNaN(C.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[y.getMonth()]} ${y.getDate()} \u2013 ${N[C.getMonth()]} ${C.getDate()}`},p=e&&t,b=(()=>{if(!t)return false;let h=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),h<y})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:p?`${k()}`:"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:k()})]}),o&&jsxRuntime.jsx(Pt,{children:jsxRuntime.jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"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:g?"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:g?"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:$0.map(h=>jsxRuntime.jsx("button",{onClick:()=>x(h.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:h.label},h.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"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:h=>a(h.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:h=>a(e,h.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"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:h=>{h.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function wo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[c,u]=react.useState(""),[i,m]=react.useState({top:0,left:0}),l=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let b=g.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,C=300,N=380,S=4,w=b.right-C;w<10&&(w=b.left),w+C>y-10&&(w=y-C-10);let E=h-b.bottom,L=b.top,T;E>=N+S?T=b.bottom+S:L>=N+S?T=b.top-N-S:T=E>=L?b.bottom+S:Math.max(10,b.top-N-S),m({top:T,left:w}),n(true);};react.useEffect(()=>{let b=h=>{l.current&&!l.current.contains(h.target)&&!g.current?.contains(h.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let x=b=>{let h=e.some(y=>y.id===b.id);a(h?e.filter(y=>y.id!==b.id):[...e,b]);},k=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),p=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>s?n(false):f(),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:[p.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):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(Pt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>u(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:k.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"}):k.map(b=>{let h=e.some(y=>y.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>x(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:h?"#3b82f6":"transparent"},children:h?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function os(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(m=>{if(typeof m=="string")return m;let l=m;return l.taskId||l.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,c=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let m of i){if(!s.has(m)&&c(m))return true;if(n.has(m))return true}}return n.delete(u),false};return c(a)}function pn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[c,u]=react.useState(false),[i,m]=react.useState(""),[l,g]=react.useState(t.length>0),[f,x]=react.useState({top:0,left:0}),[k,p]=react.useState(null),v=react.useRef(null),b=react.useRef(null),h=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),E=window.innerHeight,L=window.innerWidth,T=300,z=l?380:120,H=4,J=w.right-T;J<10&&(J=w.left),J+T>L-10&&(J=L-T-10);let D=E-w.bottom,ve=w.top,de;D>=z+H?de=w.bottom+H:ve>=z+H?de=w.top-z-H:de=D>=ve?w.bottom+H:Math.max(10,w.top-z-H),x({top:de,left:J}),u(true);};react.useEffect(()=>{if(!c||!b.current)return;let w=b.current.getBoundingClientRect(),E=window.innerHeight,L=window.innerWidth,T=300,z=l?380:120,H=4,J=w.right-T;J<10&&(J=w.left),J+T>L-10&&(J=L-T-10);let D=E-w.bottom,ve=w.top,de;D>=z+H?de=w.bottom+H:ve>=z+H?de=w.top-z-H:de=D>=ve?w.bottom+H:Math.max(10,w.top-z-H),x({top:de,left:J});},[l,c]),react.useEffect(()=>{let w=E=>{v.current&&!v.current.contains(E.target)&&!b.current?.contains(E.target)&&(u(false),m(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=E=>{E.key==="Escape"&&(u(false),m(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let y=w=>{let E=t.includes(w),L=a.find(T=>T.id===w);if(p(null),E){let T=t.filter(z=>z!==w);r(T),T.length===0&&g(false);}else {if(s&&os(a,w,e)){let z=`Cannot add "${L?.title||w}" as dependency - would create circular reference`;p(z),n?.(w,L?.title||w),setTimeout(()=>p(null),3e3);return}r([...t,w]),g(true);}},C=()=>{let w=!l;g(w),w||r([]);},N=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),S=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?u(false):h(),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})]}),c&&jsxRuntime.jsx(Pt,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),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:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&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"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>m(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:N.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):N.map(w=>{let E=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>y(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:L=>{L.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:L=>{L.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:E?"#3b82f6":"transparent",borderColor:E?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),u(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 Hr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:c=[],allCards:u=[]})=>{let{attributes:i,listeners:m,setNodeRef:l,transform:g,transition:f,isDragging:x}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:es.Transform.toString(g),transition:f};if(t)return jsxRuntime.jsx("div",{ref:l,style:k,...i,...m,onClick:()=>a?.(e),children:t(e)});let p=c.filter(y=>e.assignedUserIds?.includes(y.id)),v=e.progress===100,b=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),h={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:h,className:d("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...m,onClick:y=>{y.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:y=>{y.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:y=>{y.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((y,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),C===3&&b.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",b.length-4]})})]},y.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.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:y=>y.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(vo,{priority:e.priority,onChange:y=>n?.(e.id,{priority:y})})}),jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(un,{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:(y,C)=>n?.(e.id,{startDate:y,endDate:C})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(wo,{assignedUsers:p,availableUsers:c,onChange:y=>n?.(e.id,{assignedUserIds:y.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(pn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:u,onChange:y=>n?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsxRuntime.jsx("span",{className:"asakaa-label",children:y},y))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(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)));Hr.displayName="Card";var ns={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"}},Pc=({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 Fc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),m=[...Object.entries(ns).map(([p,v])=>({id:p,label:v.label,color:v.color,icon:v.icon})),...r.filter(p=>!Object.keys(ns).includes(p.id)).map(p=>({id:p.id,label:p.title,color:p.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let p=ns[e];if(p)return {...p,id:e};let v=r.find(b=>b.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...ns.todo,id:"todo"}},g=()=>{if(!i.current)return;let p=i.current.getBoundingClientRect(),v=window.innerHeight,b=window.innerWidth,h=180,y=280,C=4,N=p.right-h;N<10&&(N=p.left),N+h>b-10&&(N=b-h-10);let S=v-p.bottom,w=p.top,E;S>=y+C?E=p.bottom+C:w>=y+C?E=p.top-y-C:E=S>=w?p.bottom+C:Math.max(10,p.top-y-C),c({top:E,left:N}),s(true);};react.useEffect(()=>{let p=v=>{u.current&&!u.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),react.useEffect(()=>{let p=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o]);let f=p=>{t(p),s(false);},x=l(),k=x.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):g(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:x.label,children:jsxRuntime.jsx(Pc,{icon:x.icon,color:k})}),o&&jsxRuntime.jsx(Pt,{children:jsxRuntime.jsxs("div",{ref:u,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:m.map(p=>jsxRuntime.jsxs("button",{onClick:()=>f(p.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:p.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Pc,{icon:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.label}),e===p.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p.id))})]})})]})}function Ac({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[c,u]=react.useState(false),[i,m]=react.useState(e),[l,g]=react.useState({top:0,left:0}),f=react.useRef(null),x=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(s&&x.current){let h=x.current.getBoundingClientRect();g({top:h.bottom+window.scrollY+8,left:h.left+window.scrollX});}},[s]),react.useEffect(()=>{let h=y=>{f.current&&!f.current.contains(y.target)&&!x.current?.contains(y.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=y=>{y.key==="Escape"&&(n(false),u(false),m(e));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s,e]),react.useEffect(()=>{c&&k.current&&(k.current.focus(),k.current.select());},[c]);let p=()=>{u(true),m(e);},v=()=>{let h=i.trim();h&&h!==e&&t(h),u(false),n(false),m(e);},b=h=>{h.key==="Enter"?v():h.key==="Escape"&&(u(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:x,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",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"})]})}),s&&jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.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:c?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:"Rename Column"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:h=>m(h.target.value),onKeyDown:b,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:p,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:"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(),n(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:"Delete"})]})]})]})})})]})}var _o=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:c,availableUsers:u,allCards:i,enableVirtualization:m,cardHeight:l=120,isCollapsed:g,onToggleCollapse:f,onColumnRename:x,onColumnDelete:k,isDeletable:p=false,className:v,renderMetrics:b})=>{let{setNodeRef:h,isOver:y}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),N=m??oc(t.length),S=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,children:a(e,t)});let E=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let z=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:z}:z>=80?{state:"warning",percentage:z}:z>=60?{state:"approaching",percentage:z}:{state:"ok",percentage:z}})(),L=E.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:d("asakaa-column",y&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",v),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:d(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&E.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${E.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[E.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"})]}),E.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"})]}),E.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"})}),E.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"})]})]}),(x||k)&&jsxRuntime.jsx(Ac,{columnTitle:e.title,onRename:z=>x?.(e.id,z),onDelete:k?()=>k(e.id):void 0,isDeletable:p}),f&&jsxRuntime.jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!g&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(z=>z.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"})}):N?jsxRuntime.jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(z=>{let H=t[z.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${z.start}px)`},children:jsxRuntime.jsx(Hr,{card:H,render:r,onClick:n,onUpdate:c,availableUsers:u,allCards:i})},H.id):null})}):t.map(z=>jsxRuntime.jsx(Hr,{card:z,render:r,onClick:n,onUpdate:c,availableUsers:u,allCards:i},z.id))})})]})});_o.displayName="Column";function Li({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let u=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},i=m=>{m.key==="Enter"?u():m.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:u,onKeyDown:i,className:d("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:d("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function of(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 $c(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(c=>{let u=c.name.toLowerCase(),i=u.replace(/\s+/g,""),m=u.split(/\s+/);return !!(i===s||u===s||m.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function nf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function sf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var lf=["\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 Hc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:c="dark",locale:u="es",currentUser:i,enableEmoji:m=true,enableAttachments:l=true,pendingFiles:g=[],onFilesSelect:f,onRemoveFile:x,maxFileSizeMB:k=10}){let p=c==="dark",[v,b]=react.useState(false),[h,y]=react.useState([]),[C,N]=react.useState(0),[S,w]=react.useState(null),[E,L]=react.useState(false),T=react.useRef(null),z=react.useRef(null),H=react.useRef(null),J=react.useRef(null),D=react.useCallback(($,ae)=>{let Re=of($,ae);if(w(Re),Re){let ke=r.filter(Ze=>Ze.name.toLowerCase().includes(Re.query)||Ze.email&&Ze.email.toLowerCase().includes(Re.query)).slice(0,5);y(ke),b(ke.length>0),N(0);}else b(false),y([]);},[r]),ve=$=>{let ae=$.target.value;if(t(ae),D(ae,$.target.selectionStart||0),T.current){T.current.style.height="24px";let Re=T.current.scrollHeight,ke=280,Ze=Math.min(Re,ke);T.current.style.height=`${Ze}px`,T.current.style.overflowY=Re>ke?"auto":"hidden";}},de=()=>{T.current&&D(e,T.current.selectionStart||0);},V=react.useCallback($=>{if(!S||!T.current)return;let ae=e.slice(0,S.start),Re=e.slice(S.end),ke=`@${$.name.replace(/\s+/g,"")} `,Ze=ae+ke+Re;t(Ze),b(false),w(null),setTimeout(()=>{if(T.current){let Ee=S.start+ke.length;T.current.selectionStart=Ee,T.current.selectionEnd=Ee,T.current.focus();}},0);},[S,e,t]),I=$=>{if(v&&h.length>0)switch($.key){case "ArrowDown":$.preventDefault(),N(ae=>ae<h.length-1?ae+1:0);break;case "ArrowUp":$.preventDefault(),N(ae=>ae>0?ae-1:h.length-1);break;case "Enter":{$.preventDefault();let ae=h[C];ae&&V(ae);break}case "Tab":{$.preventDefault();let ae=h[C];ae&&V(ae);break}case "Escape":$.preventDefault(),b(false);break}else $.key==="Enter"&&!$.shiftKey&&($.preventDefault(),a());};react.useEffect(()=>{let $=ae=>{z.current&&!z.current.contains(ae.target)&&T.current&&!T.current.contains(ae.target)&&b(false),J.current&&!J.current.contains(ae.target)&&L(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let Te=react.useCallback($=>{if(!T.current)return;let ae=T.current.selectionStart||e.length,Re=e.slice(0,ae)+$+e.slice(ae);t(Re),L(false),setTimeout(()=>{if(T.current){let ke=ae+$.length;T.current.selectionStart=ke,T.current.selectionEnd=ke,T.current.focus();}},0);},[e,t]),Q=react.useCallback($=>{if(!f||!$.target.files)return;let ae=Array.from($.target.files),Re=k*1024*1024,ke=ae.filter(Ze=>Ze.size>Re?(console.warn(`File ${Ze.name} exceeds max size of ${k}MB`),false):true);ke.length>0&&f(ke),$.target.value="";},[f,k]),et=react.useCallback($=>$.type.startsWith("image/")?lucideReact.Image:$.type.includes("pdf")||$.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(v&&z.current){let $=z.current.children[C];$&&$.scrollIntoView({block:"nearest"});}},[C,v]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[g.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:g.map($=>{let ae=et($.file),Re=$.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",p?"bg-white/10":"bg-gray-100"),children:[Re&&$.preview?jsxRuntime.jsx("img",{src:$.preview,alt:$.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(ae,{className:d("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:d("text-xs truncate",p?"text-white":"text-gray-900"),children:$.file.name}),jsxRuntime.jsx("p",{className:d("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:sf($.file.size)})]}),x&&jsxRuntime.jsx("button",{onClick:()=>x($.id),className:d("p-0.5 rounded-full transition-colors",p?"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"})})]},$.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:d("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:d("flex items-end gap-1 px-2 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(!E),disabled:s||n,className:d("p-1 rounded transition-colors flex-shrink-0",p?"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:E&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:d("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",p?"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:lf.map($=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Te($),className:d("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",p?"hover:bg-white/10":"hover:bg-gray-100"),children:$},$))})})})]}),l&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:d("p-1.5 rounded transition-colors",p?"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:u==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:H,type:"file",multiple:true,onChange:Q,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:ve,onSelect:de,onKeyDown:I,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:d("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",p?"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()&&g.length===0||s,className:d("p-1.5 rounded transition-colors",(e.trim()||g.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":p?"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:v&&h.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:d("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:h.map(($,ae)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>V($),className:d("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ae===C?p?"bg-white/10":"bg-gray-100":p?"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:$.color||"#8B5CF6"},children:nf($.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:d("text-sm font-medium truncate",p?"text-white":"text-gray-900"),children:$.name}),$.email&&jsxRuntime.jsx("p",{className:d("text-xs truncate",p?"text-[#6B7280]":"text-gray-500"),children:$.email})]})]},$.id))})})]})]})]})}function Uc({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((c,u)=>c.type==="mention"?jsxRuntime.jsx("span",{className:d("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:c.value},u):jsxRuntime.jsx("span",{children:c.value},u))})}var cs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Zr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[c,u]=react.useState(false),[i,m]=react.useState(""),[l,g]=react.useState(false),[f,x]=react.useState(cs[10]||"#3B82F6"),[k,p]=react.useState({top:0,left:0}),v=react.useRef(null),b=react.useRef(null),h=react.useRef(null),y=react.useRef(null),C=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),N=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(c&&b.current){let T=b.current.getBoundingClientRect();p({top:T.bottom+6,left:T.left});}},[c]),react.useEffect(()=>{let T=z=>{let H=z.target,J=v.current?.contains(H),D=h.current?.contains(H);!J&&!D&&(u(false),m(""),g(false));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),react.useEffect(()=>{c&&y.current&&y.current.focus();},[c]);let S=T=>{let z=e.some(H=>H.id===T.id);a(z?e.filter(H=>H.id!==T.id):[...e,T]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let T=await r(i.trim(),f);T&&(a([...e,T]),m(""),x(cs[Math.floor(Math.random()*cs.length)]||"#3B82F6"));}finally{g(false);}}},E=(T,z)=>{z.stopPropagation(),a(e.filter(H=>H.id!==T));},L={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&u(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:L,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color: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:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:h,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:k.top,left:k.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:y,type:"text",value:i,onChange:T=>m(T.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:T=>{T.key==="Enter"&&i.trim()&&!N&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(T=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:z=>E(T.id,z),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(T=>{let z=e.some(H=>H.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>S(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{z||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{z||(H.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:cs.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>x(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:f===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Bi({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 Wc({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(Bi,{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 To=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{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 Gc(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 hf(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 yf({className:e}){return jsxRuntime.jsxs("svg",{className:d("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 Ri({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=hf(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"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Gc(e.loggedMinutes),i=e.estimateMinutes?Gc(e.estimateMinutes):null,m=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:d("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(yf,{className:c[t]}),jsxRuntime.jsx("span",{children:m})]})}function _c(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function ms(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 kf(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 wf({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Cf({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 jc({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 Tf({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 Oi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:c,onStopTimer:u,onDiscardTimer:i,onClose:m,className:l}){let[g,f]=react.useState(""),[x,k]=react.useState(t.estimateMinutes?ms(t.estimateMinutes):""),[p,v]=react.useState(""),[b,h]=react.useState(false),[y,C]=react.useState(false),N=react.useRef(null);react.useEffect(()=>{N.current?.focus();},[]);let S=async()=>{let L=_c(g);if(!(L<=0||!s)){h(true);try{await s({durationMinutes:L,note:p.trim()||void 0,source:"manual"}),f(""),v("");}finally{h(false);}}},w=async()=>{if(!n)return;let L=x.trim()?_c(x):null;await n(L),C(false);},E=L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),S()),L.key==="Escape"&&m?.();};return jsxRuntime.jsxs("div",{className:d("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",l),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:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(jc,{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:kf(o)})]}),jsxRuntime.jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Cf,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(jc,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:c,className:d("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(wf,{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(Tf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:N,type:"text",value:g,onChange:L=>f(L.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:d("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:b||!g.trim(),className:d("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:p,onChange:L=>v(L.target.value),onKeyDown:E,placeholder:"Note (optional)",className:d("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:ms(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"}),y?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:x,onChange:L=>k(L.target.value),onKeyDown:L=>{L.key==="Enter"&&w(),L.key==="Escape"&&C(false);},onBlur:w,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?ms(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:d("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:d("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(L=>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:L.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:ms(L.durationMinutes)})]},L.id))})]})]})}function Ef(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Mf(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 Fr({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[c,u]=react.useState(Mf(r)),[i,m]=react.useState(""),[l,g]=react.useState(false),f=react.useRef(null);react.useEffect(()=>{f.current?.focus();},[]);let x=async()=>{g(true);let h=Ef(c);await o(h&&h>0?h:null,i||void 0),g(false);},k=async()=>{g(true),await o(null),g(false);},p=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),x()),h.key==="Escape"&&s();},v={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},b={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxRuntime.jsxs("div",{className:d("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:d("text-sm font-medium",a?"text-white":"text-gray-900"),children:v[e]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:d("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("input",{ref:f,type:"text",value:c,onChange:h=>u(h.target.value),onKeyDown:p,placeholder:b[e],className:d("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsxRuntime.jsx("div",{className:"mb-3",children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:h=>m(h.target.value),onKeyDown:p,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:d("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:l||!c.trim(),className:d("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:l?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:k,disabled:l,className:d("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Pf(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 Ff(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 Ui({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Pf(e.health),s=Ff(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},c=e.progressPercent??0,u=Math.min(100,c),i=c>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:d("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:d("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:d("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:d("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:d("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:d("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:d("h-full transition-all duration-300",o),style:{width:`${u}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:d("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[c,"%"]})]})}function jo(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 Lf(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 If(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 Bf(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 Rf({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",c=a?"text-[#9CA3AF]":"text-gray-500",u=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:d("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:d("text-sm font-medium mb-1",c),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:d("text-2xl font-bold",o),children:[r?"+":"",jo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:d("text-xs mt-1",c),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:d("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:d("text-sm font-medium mb-2",c),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:d("font-medium",u),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:d("font-medium",u),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:d("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:d("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:d("text-sm font-medium mb-2",c),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:c,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:d("font-medium",u),children:jo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:d("font-medium",u),children:jo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:d("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:d("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function Of({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",c=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:d("border-b",s,r&&d("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:d("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:d("text-xs mt-1",c),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?jo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:jo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:d("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":c),children:[o,jo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:d("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":c),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:d("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",If(e.status,a),Lf(e.status,a)),children:Bf(e.status,t)})})]})}function zi({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",c=n?"bg-[#0F1117]":"bg-gray-50",u=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",m=n?"text-[#E5E7EB]":"text-gray-900",l=n?"text-[#9CA3AF]":"text-gray-500",g=n?"bg-[#0F1117]/50":"bg-gray-50",f=react.useMemo(()=>e?[...e.tasks].sort((x,k)=>x.varianceMinutes===null?1:k.varianceMinutes===null?-1:k.varianceMinutes-x.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:d("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:d("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:d("space-y-6 p-6",c,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:d("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:d("text-sm mt-1",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Rf,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:d("rounded-lg border overflow-hidden",u,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:g,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:d("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:d("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:d("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:d("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:d("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsxRuntime.jsx("th",{className:d("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:d("divide-y",i),children:f.map(x=>jsxRuntime.jsx(Of,{task:x,locale:a,isDark:n,onClick:s},x.taskId))})]})})}),jsxRuntime.jsx("div",{className:d("text-xs text-center",l),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 Ko(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 Jf(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 au(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 Zf(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 zr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:c=[],availableTags:u=[],onCreateTag:i,attachments:m=[],onUploadAttachments:l,onDeleteAttachment:g,availableTasks:f=[],comments:x=[],onAddComment:k,currentUser:p,mentionableUsers:v=[],onUploadCommentAttachments:b,enableTimeTracking:h=false,timeTrackingSummary:y,timeEntries:C=[],isTimerRunning:N=false,timerElapsedSeconds:S=0,onTimeLog:w,onEstimateUpdate:E,onSoldEffortUpdate:L,onTimerStart:T,onTimerStop:z,onTimerDiscard:H,blurFinancials:J=false}){let D=s==="dark",ve={textTertiary:D?"#6B7280":"#9CA3AF",textSecondary:D?"#9CA3AF":"#6B7280",textPrimary:D?"#FFFFFF":"#111827",borderLight:D?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:D?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:D?"#1A1D25":"#FFFFFF",bgSecondary:D?"#0F1117":"#F9FAFB",hoverBg:D?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},de=e&&"title"in e&&!("name"in e),V=e,[I,Te]=react.useState(e?au(e,c):null),[Q,et]=react.useState(false),[$,ae]=react.useState(false),[Re,ke]=react.useState(false),[Ze,Ee]=react.useState(null),[ze,re]=react.useState(new Date),[K,q]=react.useState(false),[be,we]=react.useState(false),[Je,G]=react.useState(""),[he,je]=react.useState(false),[Ie,Ke]=react.useState(false),[O,ne]=react.useState(false),[X,Me]=react.useState(false),[Ve,tt]=react.useState(""),rt=react.useRef(null),_e=react.useRef(null),[Nt,ht]=react.useState(""),xt=react.useRef(null),[yt,U]=react.useState(""),[Oe,Qe]=react.useState(false),[Ne,$e]=react.useState([]),[me,R]=react.useState(""),[j,Be]=react.useState(false),De=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 P=au(e,c);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),Te(P),tt(P.description||""),ht(P.name||"");}},[e?.id,e?.quotedMinutes,c,t]),react.useEffect(()=>{if(!t||!Ve)return;let P=setTimeout(()=>{let oe=_e.current;oe&&(oe.style.height="auto",oe.style.height=`${Math.max(100,oe.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Ve]),react.useEffect(()=>()=>{rt.current&&clearTimeout(rt.current),xt.current&&clearTimeout(xt.current);},[]),react.useEffect(()=>{t&&De.current&&x.length>0&&setTimeout(()=>{De.current&&(De.current.scrollTop=De.current.scrollHeight);},100);},[t,x.length]);let fe=react.useCallback(P=>{Te(P),de&&o&&V?o(Zf(P,V)):r&&r(P);},[de,V,o,r]),Ce=react.useCallback(()=>{et(false),ae(false),ke(false),Ee(null),we(false),G(""),je(false);},[]),ee=react.useCallback((P,oe)=>{if(!I)return;let Xe={...I,[P]:oe};fe(Xe);},[I,fe]),B=react.useCallback(()=>{let P=_e.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),_=react.useCallback(P=>{tt(P),setTimeout(B,0),rt.current&&clearTimeout(rt.current),rt.current=setTimeout(()=>{if(I){let oe={...I,description:P};fe(oe);}},800);},[I,fe,B]),Pe=react.useCallback(P=>{ht(P),xt.current&&clearTimeout(xt.current),xt.current=setTimeout(()=>{if(I&&P.trim()){let oe={...I,name:P.trim()};fe(oe);}},800);},[I,fe]),A=react.useCallback(P=>{let oe=P.map(Xe=>{let nt={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Xe};return Xe.type.startsWith("image/")&&(nt.preview=URL.createObjectURL(Xe)),nt});$e(Xe=>[...Xe,...oe]);},[]),Z=react.useCallback(P=>{$e(oe=>{let Xe=oe.find(nt=>nt.id===P);return Xe?.preview&&URL.revokeObjectURL(Xe.preview),oe.filter(nt=>nt.id!==P)});},[]),ce=react.useCallback(async()=>{if(!(!I||!yt.trim()&&Ne.length===0||!k)){Qe(true);try{let P=$c(yt,v),oe=[];if(Ne.length>0&&b){let Xe=Ne.map(nt=>nt.file);oe=await b(Xe);}await k(I.id,yt.trim(),P.length>0?P:void 0,oe.length>0?oe:void 0),U(""),Ne.forEach(Xe=>{Xe.preview&&URL.revokeObjectURL(Xe.preview);}),$e([]);}finally{Qe(false);}}},[I,yt,Ne,k,v,b]),He=react.useCallback(()=>{if(!I||!me.trim())return;let P=I.subtasks||[],oe={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:me.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},Xe=[...P,oe],nt={...I,subtasks:Xe};fe(nt),R(""),Be(false);},[I,me,fe]),ue=react.useCallback(P=>{if(!I?.subtasks)return;let oe=I.subtasks.map(nt=>nt.id===P?{...nt,progress:nt.progress===100?0:100}:nt),Xe={...I,subtasks:oe};fe(Xe);},[I,fe]),it=react.useCallback(P=>{if(!I?.subtasks)return;let oe=I.subtasks.filter(nt=>nt.id!==P),Xe={...I,subtasks:oe};fe(Xe);},[I,fe]),dt=react.useCallback(P=>{let oe=typeof P=="string"?new Date(P):P,nt=new Date().getTime()-oe.getTime(),mt=Math.floor(nt/6e4),Ia=Math.floor(nt/36e5),ia=Math.floor(nt/864e5);return mt<1?n==="es"?"Ahora":"Just now":mt<60?n==="es"?`Hace ${mt} min`:`${mt}m ago`:Ia<24?n==="es"?`Hace ${Ia}h`:`${Ia}h ago`:ia<7?n==="es"?`Hace ${ia}d`:`${ia}d ago`:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Dt=react.useCallback(P=>{if(!I)return;let oe=I.progress||0;P==="completed"?oe=100:P==="in-progress"&&oe===0?oe=10:P==="todo"&&(oe=0);let Xe={...I,status:P,progress:oe};fe(Xe),et(false);},[I,fe]),Ft=react.useCallback((P,oe)=>{if(!I)return;let Xe={...I,startDate:P,endDate:oe};fe(Xe);},[I,fe]),Kt=react.useCallback(()=>{let P=ze.getFullYear(),oe=ze.getMonth(),Xe=new Date(P,oe,1),mt=new Date(P,oe+1,0).getDate(),Ia=Xe.getDay(),ia=[],sr=new Date(P,oe,0).getDate();for(let Ha=Ia-1;Ha>=0;Ha--)ia.push({date:new Date(P,oe-1,sr-Ha),isCurrentMonth:false});for(let Ha=1;Ha<=mt;Ha++)ia.push({date:new Date(P,oe,Ha),isCurrentMonth:true});let ha=42-ia.length;for(let Ha=1;Ha<=ha;Ha++)ia.push({date:new Date(P,oe+1,Ha),isCurrentMonth:false});return ia},[ze]),nr=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),ne(false),!I||!l)return;let oe=Array.from(P.dataTransfer.files);if(oe.length!==0){Me(true);try{await l(I.id,oe);}finally{Me(false);}}},[I,l]),La=react.useCallback(async P=>{if(!I||!l||!P.target.files)return;let oe=Array.from(P.target.files);if(oe.length!==0){Me(true);try{await l(I.id,oe);}finally{Me(false);}P.target.value="";}},[I,l]),Fe=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),ne(true);},[]),St=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),ne(false);},[]),sa=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),ma=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!I?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&I&&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:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",D?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3 h-[49px]",D?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:d("w-4 h-4",D?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",D?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:d("text-xs font-mono",D?"text-[#6B7280]":"text-gray-400"),children:I.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 P=I.progress===100?0:100,Xe={...I,progress:P,status:P===100?"completed":"todo"};fe(Xe);},className:d("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",I.progress===100?"bg-green-500 border-green-500":D?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:I.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Nt,onChange:P=>Pe(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:d("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",I.progress===100?"line-through text-[#6B7280]":D?"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:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ce(),et(!Q);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",I.progress===100||I.status==="completed"?"bg-green-500/20 text-green-400":I.progress&&I.progress>0||I.status==="in-progress"?"bg-blue-500/20 text-blue-400":D?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:I.progress===100||I.status==="completed"?n==="es"?"COMPLETADO":"DONE":I.progress&&I.progress>0||I.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>et(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",D?"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(P=>jsxRuntime.jsxs("button",{onClick:()=>Dt(P.id),className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",D?"hover:bg-white/5":"hover:bg-gray-50",I.status===P.id&&(D?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:D?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),ke(!Re);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",D?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[I.assignees&&I.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[I.assignees.slice(0,3).map((P,oe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},oe)),I.assignees.length>3&&jsxRuntime.jsxs("span",{className:d("text-xs",D?"text-[#6B7280]":"text-gray-400"),children:["+",I.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",D?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",D?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ke(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",D?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(P=>{let oe=I.assignees?.some(Xe=>Xe.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Xe=I.assignees||[],nt;oe?nt=Xe.filter(mt=>mt.name!==P.name):nt=[...Xe,P],ee("assignees",nt);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",D?"hover:bg-white/5":"hover:bg-gray-50",oe&&(D?"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:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:d("flex-1",D?"text-white":"text-gray-900"),children:P.name}),oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",D?"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:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ee(Ze?null:"start"),re(I.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",D?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[I.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:d("mx-1",D?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),I.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",D?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:d("w-44 py-2 border-r",D?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,oe=new Date(P);oe.setDate(P.getDate()+1);let Xe=new Date(P);Xe.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let nt=new Date(P);nt.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let mt=new Date(P);mt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Ia=new Date(P);Ia.setDate(P.getDate()+14);let ia=new Date(P);return ia.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.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:Xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:nt,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:mt,display:mt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ia,display:Ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ia,display:ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ha,Ha)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",D?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ze==="start"){let Er=I.endDate&&ha.date>I.endDate?ha.date:I.endDate;Ft(ha.date,Er),Ee("end");}else {let Er=I.startDate&&ha.date<I.startDate?ha.date:I.startDate;Ft(Er,ha.date),Ee(null);}},children:[jsxRuntime.jsx("span",{children:ha.label}),jsxRuntime.jsx("span",{className:d("text-xs",D?"text-[#6B7280]":"text-gray-400"),children:ha.display})]},Ha))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",D?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ft(void 0,void 0),Ee(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",D?"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:d("text-xs mb-3 px-2 py-1 rounded",D?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ze==="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:d("font-medium",D?"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:()=>re(new Date),className:d("p-1 rounded text-sm transition-colors",D?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>re(new Date(ze.getFullYear(),ze.getMonth()-1)),className:d("p-1 rounded",D?"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:()=>re(new Date(ze.getFullYear(),ze.getMonth()+1)),className:d("p-1 rounded",D?"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(P=>jsxRuntime.jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",D?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Kt().map((P,oe)=>{let Xe=P.date.toDateString()===new Date().toDateString(),nt=I.startDate?.toDateString()===P.date.toDateString(),mt=I.endDate?.toDateString()===P.date.toDateString(),Ia=nt||mt,ia=I.startDate&&I.endDate&&P.date>=I.startDate&&P.date<=I.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let sr=new Date(P.date);if(Ze==="start"){let ha=I.endDate&&sr>I.endDate?sr:I.endDate;Ft(sr,ha),Ee("end");}else {let ha=I.startDate&&sr<I.startDate?sr:I.startDate;Ft(ha,sr),Ee(null);}},className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(D?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(D?"text-white":"text-gray-900"),Xe&&"ring-2 ring-[#3B82F6]",nt&&"bg-[#3B82F6] text-white",mt&&!nt&&"bg-[#7C3AED] text-white",ia&&!Ia&&(D?"bg-[#7C3AED]/20":"bg-purple-100"),!Ia&&(D?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},oe)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ce(),ae(!$);},className:d("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",I.priority==="high"||I.priority==="urgent"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":I.priority==="low"?"bg-green-500/20 text-green-400":D?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:I.priority?I.priority==="high"||I.priority==="urgent"?n==="es"?"Alta":"High":I.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ae(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",D?"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(P=>jsxRuntime.jsxs("button",{onClick:()=>{ee("priority",P.id),ae(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",D?"hover:bg-white/5":"hover:bg-gray-50",I.priority===P.id&&(D?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:D?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",D?"text-white":"text-gray-900"),children:I.startDate&&I.endDate?`${Math.ceil((I.endDate.getTime()-I.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:d("w-4 h-4 rounded-full border-2",D?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[K?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:I.progress||0,onChange:P=>{let oe=parseInt(P.target.value),Xe=I.status;oe===100?Xe="completed":oe>0?Xe="in-progress":Xe="todo";let nt={...I,progress:oe,status:Xe};fe(nt);},onBlur:()=>q(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",D?"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-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>q(true),className:d("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",D?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:d("h-full rounded-full transition-all",I.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${I.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium min-w-[40px]",D?"text-white":"text-gray-900"),children:[I.progress||0,"%"]})]})]}),h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"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:I.status==="completed"||I.progress===100?jsxRuntime.jsx("span",{className:d("text-sm px-2 py-0.5 cursor-not-allowed",D?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:y?.estimateMinutes?Ko(y.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:d("text-sm px-2 py-0.5 rounded",D?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Ko(y.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:d("text-sm",D?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie==="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(Fr,{mode:"estimate",locale:n,isDark:D,currentValue:y?.estimateMinutes||null,onSave:async P=>{await E?.(I.id,P),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:J?jsxRuntime.jsx("span",{className:d("text-sm select-none blur-[4px] opacity-60 pointer-events-none",D?"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"}):I.status==="completed"||I.progress===100?jsxRuntime.jsx("span",{className:d("text-sm px-2 py-0.5 cursor-not-allowed",D?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:I.quotedMinutes?Ko(I.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):I.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:d("text-sm px-2 py-0.5 rounded",D?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Ko(I.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:d("text-sm",D?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie==="quoted"&&!J&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(Fr,{mode:"quoted",locale:n,isDark:D,currentValue:I.quotedMinutes||null,onSave:async P=>{L?(await L(I.id,P),Te(oe=>oe?{...oe,quotedMinutes:P}:null)):ee("quotedMinutes",P),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[I.status==="completed"||I.progress===100?jsxRuntime.jsx("div",{className:d("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",D?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxRuntime.jsxs("button",{type:"button",onClick:()=>z?.(I.id),className:d("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"}),Jf(S||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>T?.(I.id),className:d("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",D?"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"})}),I.status==="completed"||I.progress===100?jsxRuntime.jsxs("div",{className:d("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",D?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ke("log"),className:d("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",D?"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"]}),y&&y.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:d("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":D?"text-white":"text-gray-900"),children:[Ko(y.loggedMinutes),y.estimateMinutes&&jsxRuntime.jsxs("span",{className:d("font-normal",D?"text-[#6B7280]":"text-gray-400"),children:[" / ",Ko(y.estimateMinutes)]})]}),y.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:d("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie==="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(Fr,{mode:"log",locale:n,isDark:D,currentValue:null,onSave:async(P,oe)=>{P&&await w?.(I.id,{durationMinutes:P,note:oe,source:"manual"}),Ke(false);},onClose:()=>Ke(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Zr,{selectedTags:I.tags||[],availableTags:u,onChange:P=>{ee("tags",P);},onCreateTag:i,theme:ve})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0 mt-1",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[I.dependencies&&I.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:I.dependencies.map(P=>{let oe=f.find(Xe=>Xe.id===P);return jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",D?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[oe?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Xe=(I.dependencies||[]).filter(nt=>nt!==P);ee("dependencies",Xe);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),we(!be);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",D?"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:d("text-sm",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{we(false),G("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",D?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("p-2 border-b",D?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Je,onChange:P=>G(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",D?"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:f.length>0?f.filter(P=>P.id!==I.id).filter(P=>Je===""||P.name.toLowerCase().includes(Je.toLowerCase())).map(P=>{let oe=I.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Xe=I.dependencies||[],nt;oe?nt=Xe.filter(mt=>mt!==P.id):nt=[...Xe,P.id],ee("dependencies",nt);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",D?"hover:bg-white/5":"hover:bg-gray-50",oe&&(D?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",oe?"bg-blue-500 border-blue-500":D?"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:d("block truncate",D?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:d("text-xs",D?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",D?"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:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),je(!he);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",D?"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:I.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:d("text-sm",D?"text-white":"text-gray-900"),children:To.find(P=>P.value===I.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",D?"text-[#6B7280]":"text-gray-400")})]}),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:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",D?"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:To.map(P=>{let oe=I.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{ee("color",P.value),je(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",oe&&"ring-2 ring-offset-2",D?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:oe?P.value:void 0},title:P.name,children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-28 truncate flex-shrink-0",D?"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:I.isMilestone||false,onChange:P=>ee("isMilestone",P.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",I.isMilestone?"bg-purple-500 border-purple-500":D?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:d("text-sm",D?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",D?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:d("w-4 h-4",D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",D?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:_e,value:Ve,onChange:P=>_(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("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",D?"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:d("mt-6 pt-4 border-t",D?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",D?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",I.subtasks&&I.subtasks.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",D?"text-[#6B7280]":"text-gray-400"),children:["(",I.subtasks.filter(P=>P.progress===100).length,"/",I.subtasks.length,")"]})]})}),I.subtasks&&I.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...I.subtasks].sort((P,oe)=>(P.position??0)-(oe.position??0)).map(P=>jsxRuntime.jsxs("div",{className:d("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",D?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>ue(P.id),className:d("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":D?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:d("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":D?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("button",{onClick:()=>it(P.id),className:d("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",D?"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"})})]},P.id))}),j?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:me,onChange:P=>R(P.target.value),onKeyDown:P=>{P.key==="Enter"&&me.trim()?He():P.key==="Escape"&&(Be(false),R(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:d("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",D?"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:He,disabled:!me.trim(),className:d("px-3 py-2 rounded-lg text-sm font-medium transition-colors",me.trim()?"bg-blue-500 hover:bg-blue-600 text-white":D?"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:()=>{Be(false),R("");},className:d("p-2 rounded-lg transition-colors",D?"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:()=>Be(true),className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",D?"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:d("mt-6 pt-4 border-t",D?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",D?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",D?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:m.map(P=>{let oe=ma(P.type),Xe=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",D?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Xe&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",D?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(oe,{className:d("w-5 h-5",D?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",D?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:d("text-xs",D?"text-[#6B7280]":"text-gray-400"),children:sa(P.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(P.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",D?"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"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Fe,onDragLeave:St,onDrop:nr,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",O?D?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":D?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",X&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:La,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||X}),X?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:d("text-sm",D?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:d("w-6 h-6 mx-auto mb-2",O?"text-blue-500":D?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",D?"text-[#9CA3AF]":"text-gray-500"),children:O?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:d("text-xs mt-1",D?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:d("w-96 border-l flex flex-col",D?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:d("px-4 py-3 border-b flex items-center justify-between h-[49px]",D?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",D?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",D?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:d("p-1.5 rounded transition-colors",D?"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'),Zu=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),ah=require('react-markdown'),rh=require('remark-gfm'),oh=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Zu__default=/*#__PURE__*/_interopDefault(Zu);var ah__default=/*#__PURE__*/_interopDefault(ah);var rh__default=/*#__PURE__*/_interopDefault(rh);var oh__default=/*#__PURE__*/_interopDefault(oh);var Vn=(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 _n=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 [_n.Translate.toString(e),_n.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function m(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function jn(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 Hg(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function mi(e,t){return e.length===0?1e3:t===0?jn(null,e[0].position):t>=e.length?jn(e[e.length-1].position,null):jn(e[t-1].position,e[t].position)}function Wd(e,t=100){return e>t}var Wg=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 Gg(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 Kn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Wg,onRetry:l}=t,u,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(u=d,c===a||!n(u,c))return {error:u,attempts:i,success:false};let f=Gg(c,r,o,s);if(l)try{l(u,c,f);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,f));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function Vg(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 _g(e,t={}){return async(...a)=>Kn(()=>e(...a),t)}var pi=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 Gd=(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))(Gd||{}),mo=class mo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,u?n:"");break;case "INFO":console.info(l,o,u?n:"");break;case "WARN":console.warn(l,o,u?n:"");break;case "ERROR":console.error(l,o,u?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 qn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new qn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Gd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};mo.globalOptions={};var gi=mo,qn=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}},Vd=new gi;function Kg(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 qg(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,fi(s.title),fi(s.description||""),fi(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 Yg(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 Zu__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),u=297,i=210,c=n.width/n.height,d=u-20,p=d/c;p>i-20&&(p=i-20,d=p*c);let f=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,u,15,"F"),f.text(e.title||"Kanban Board",10,10);let v=(u-d)/2;return f.addImage(l,"PNG",v,20,d,p),f}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(u.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let c=[];u.startDate&&c.push(`Start: ${u.startDate}`),u.endDate&&c.push(`End: ${u.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function fi(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function jd(e,t,a,r){switch(t){case "json":return Kg(e,r);case "csv":return qg(e);case "pdf":return await Yg(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Kd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),u=URL.createObjectURL(l),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function Xg(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 Jg(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=qd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=qd(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,v)=>{i[f]=l[v]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function qd(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 Yd(e,t){switch(t){case "json":return Xg(e);case "csv":return Jg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Xd(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 hi=react.createContext(null);function Jd(){return react.useContext(hi)}var Zd=react.createContext(null);function Qd({children:e,themeName:t}){return jsxRuntime.jsx(Zd.Provider,{value:{themeName:t},children:e})}function Bo(){return react.useContext(Zd)}function wt({children:e,container:t}){let[a,r]=react.useState(false),o=Jd(),s=Bo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:u}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var oc={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},nf="#BDC3C7",sf=({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}),l=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let f=u.current.getBoundingClientRect(),v=window.innerHeight,k=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>k-10&&(b=k-g-10);let x=v-f.bottom,D=f.top,N;x>=y+h?N=f.bottom+h:D>=y+h?N=f.top-y-h:N=x>=D?f.bottom+h:Math.max(10,f.top-y-h),n({top:N,left:b}),o(true);};react.useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&!u.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?oc[e]:null,p=d?.color||nf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(wt,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(oc).map(([f,v])=>jsxRuntime.jsxs("button",{onClick:()=>c(f),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:v.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(sf,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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:()=>c(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: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var lf=[{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 nn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),p=(Bo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,D=window.innerWidth,N=320,C=380,w=4,R=b.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let F=x-b.bottom,T=b.top,H;F>=C+w?H=b.bottom+w:T>=C+w?H=b.top-C-w:H=F>=T?b.bottom+w:Math.max(10,b.top-C-w),l({top:H,left:R}),s(true);};react.useEffect(()=>{let b=x=>{u.current&&!u.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,D=R=>{let F=R.getFullYear(),T=String(R.getMonth()+1).padStart(2,"0"),H=String(R.getDate()).padStart(2,"0");return `${F}-${T}-${H}`},N=D(x),C=new Date(x);C.setDate(C.getDate()+b);let w=D(C);a(N,w),s(false);},k=()=>{if(!e||!t)return "Set date";let b=C=>{if(C instanceof Date)return C;if(typeof C!="string"||!C.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=C.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let R=w[0],F=w[1],T=w[2];return R===void 0||F===void 0||T===void 0?null:new Date(R,F-1,T)},x=b(e),D=b(t);if(!x||!D||isNaN(x.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[x.getMonth()]} ${x.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${k()}`:"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:k()})]}),o&&jsxRuntime.jsx(wt,{children:jsxRuntime.jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:lf.map(b=>jsxRuntime.jsx("button",{onClick:()=>v(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"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:b=>a(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:b=>a(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,u]=react.useState(""),[i,c]=react.useState({top:0,left:0}),d=react.useRef(null),p=react.useRef(null),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,D=300,N=380,C=4,w=h.right-D;w<10&&(w=h.left),w+D>x-10&&(w=x-D-10);let R=b-h.bottom,F=h.top,T;R>=N+C?T=h.bottom+C:F>=N+C?T=h.top-N-C:T=R>=F?h.bottom+C:Math.max(10,h.top-N-C),c({top:T,left:w}),n(true);};react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):f(),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:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:h=>u(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:k.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"}):k.map(h=>{let b=e.some(x=>x.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>v(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter: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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:b?"#3b82f6":"transparent"},children:b?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Yn(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(u),false};return l(a)}function ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,u]=react.useState(false),[i,c]=react.useState(""),[d,p]=react.useState(t.length>0),[f,v]=react.useState({top:0,left:0}),[k,g]=react.useState(null),y=react.useRef(null),h=react.useRef(null),b=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,F=window.innerWidth,T=300,H=d?380:120,A=4,ie=w.right-T;ie<10&&(ie=w.left),ie+T>F-10&&(ie=F-T-10);let S=R-w.bottom,j=w.top,le;S>=H+A?le=w.bottom+A:j>=H+A?le=w.top-H-A:le=S>=j?w.bottom+A:Math.max(10,w.top-H-A),v({top:le,left:ie}),u(true);};react.useEffect(()=>{if(!l||!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,F=window.innerWidth,T=300,H=d?380:120,A=4,ie=w.right-T;ie<10&&(ie=w.left),ie+T>F-10&&(ie=F-T-10);let S=R-w.bottom,j=w.top,le;S>=H+A?le=w.bottom+A:j>=H+A?le=w.top-H-A:le=S>=j?w.bottom+A:Math.max(10,w.top-H-A),v({top:le,left:ie});},[d,l]),react.useEffect(()=>{let w=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(u(false),c(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{let w=R=>{R.key==="Escape"&&(u(false),c(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let x=w=>{let R=t.includes(w),F=a.find(T=>T.id===w);if(g(null),R){let T=t.filter(H=>H!==w);r(T),T.length===0&&p(false);}else {if(s&&Yn(a,w,e)){let H=`Cannot add "${F?.title||w}" as dependency - would create circular reference`;g(H),n?.(w,F?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),p(true);}},D=()=>{let w=!d;p(w),w||r([]);},N=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),C=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?u(false):b(),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:C,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:C},children:t.length})]}),l&&jsxRuntime.jsx(wt,{children:jsxRuntime.jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>c(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:N.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):N.map(w=>{let R=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:F=>{F.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:F=>{F.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),u(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 Lr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:f,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:_n.Transform.toString(p),transition:f};if(t)return jsxRuntime.jsx("div",{ref:d,style:k,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=l.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:b,className:m("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,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";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,D)=>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:N=>{N.currentTarget.style.display="none";}}),D===3&&h.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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(nn,{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,D)=>n?.(e.id,{startDate:x,endDate:D})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(fo,{assignedUsers:g,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:u,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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(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&&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)));Lr.displayName="Card";var Xn={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"}},gc=({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 fc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),c=[...Object.entries(Xn).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(Xn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Xn[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...Xn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,D=4,N=g.right-b;N<10&&(N=g.left),N+b>h-10&&(N=h-b-10);let C=y-g.bottom,w=g.top,R;C>=x+D?R=g.bottom+D:w>=x+D?R=g.top-x-D:R=C>=w?g.bottom+D:Math.max(10,g.top-x-D),l({top:R,left:N}),s(true);};react.useEffect(()=>{let g=y=>{u.current&&!u.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=d(),k=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):p(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:v.label,children:jsxRuntime.jsx(gc,{icon:v.icon,color:k})}),o&&jsxRuntime.jsx(wt,{children:jsxRuntime.jsxs("div",{ref:u,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:c.map(g=>jsxRuntime.jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(gc,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function hc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[l,u]=react.useState(false),[i,c]=react.useState(e),[d,p]=react.useState({top:0,left:0}),f=react.useRef(null),v=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),react.useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),u(false),c(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),react.useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{u(true),c(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),u(false),n(false),c(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(u(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",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"})]})}),s&&jsxRuntime.jsx(wt,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.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:"Rename Column"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:h,onBlur:y,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:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,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:"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(),n(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:"Delete"})]})]})]})})})]})}var $o=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:f,onColumnRename:v,onColumnDelete:k,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),D=c??Wd(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:h,className:y,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),R=w.state==="exceeded",F=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:m("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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:m(F()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.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"})]})]}),(v||k)&&jsxRuntime.jsx(hc,{columnTitle:e.title,onRename:T=>v?.(e.id,T),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsxRuntime.jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(T=>T.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:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(T=>{let H=t[T.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsxRuntime.jsx(Lr,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i})},H.id):null})}):t.map(T=>jsxRuntime.jsx(Lr,{card:T,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i},T.id))})})]})});$o.displayName="Column";function ki({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let u=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?u():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:u,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Ef(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 wc(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let u=l.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Pf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Mf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ff=["\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 Cc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:f,onRemoveFile:v,maxFileSizeMB:k=10}){let g=l==="dark",[y,h]=react.useState(false),[b,x]=react.useState([]),[D,N]=react.useState(0),[C,w]=react.useState(null),[R,F]=react.useState(false),T=react.useRef(null),H=react.useRef(null),A=react.useRef(null),ie=react.useRef(null),S=react.useCallback((B,ee)=>{let we=Ef(B,ee);if(w(we),we){let he=r.filter(We=>We.name.toLowerCase().includes(we.query)||We.email&&We.email.toLowerCase().includes(we.query)).slice(0,5);x(he),h(he.length>0),N(0);}else h(false),x([]);},[r]),j=B=>{let ee=B.target.value;if(t(ee),S(ee,B.target.selectionStart||0),T.current){T.current.style.height="24px";let we=T.current.scrollHeight,he=280,We=Math.min(we,he);T.current.style.height=`${We}px`,T.current.style.overflowY=we>he?"auto":"hidden";}},le=()=>{T.current&&S(e,T.current.selectionStart||0);},Le=react.useCallback(B=>{if(!C||!T.current)return;let ee=e.slice(0,C.start),we=e.slice(C.end),he=`@${B.name.replace(/\s+/g,"")} `,We=ee+he+we;t(We),h(false),w(null),setTimeout(()=>{if(T.current){let ke=C.start+he.length;T.current.selectionStart=ke,T.current.selectionEnd=ke,T.current.focus();}},0);},[C,e,t]),L=B=>{if(y&&b.length>0)switch(B.key){case "ArrowDown":B.preventDefault(),N(ee=>ee<b.length-1?ee+1:0);break;case "ArrowUp":B.preventDefault(),N(ee=>ee>0?ee-1:b.length-1);break;case "Enter":{B.preventDefault();let ee=b[D];ee&&Le(ee);break}case "Tab":{B.preventDefault();let ee=b[D];ee&&Le(ee);break}case "Escape":B.preventDefault(),h(false);break}else B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),a());};react.useEffect(()=>{let B=ee=>{H.current&&!H.current.contains(ee.target)&&T.current&&!T.current.contains(ee.target)&&h(false),ie.current&&!ie.current.contains(ee.target)&&F(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let fe=react.useCallback(B=>{if(!T.current)return;let ee=T.current.selectionStart||e.length,we=e.slice(0,ee)+B+e.slice(ee);t(we),F(false),setTimeout(()=>{if(T.current){let he=ee+B.length;T.current.selectionStart=he,T.current.selectionEnd=he,T.current.focus();}},0);},[e,t]),Q=react.useCallback(B=>{if(!f||!B.target.files)return;let ee=Array.from(B.target.files),we=k*1024*1024,he=ee.filter(We=>We.size>we?(console.warn(`File ${We.name} exceeds max size of ${k}MB`),false):true);he.length>0&&f(he),B.target.value="";},[f,k]),qe=react.useCallback(B=>B.type.startsWith("image/")?lucideReact.Image:B.type.includes("pdf")||B.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(y&&H.current){let B=H.current.children[D];B&&B.scrollIntoView({block:"nearest"});}},[D,y]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(B=>{let ee=qe(B.file),we=B.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[we&&B.preview?jsxRuntime.jsx("img",{src:B.preview,alt:B.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(ee,{className:m("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:m("text-xs truncate",g?"text-white":"text-gray-900"),children:B.file.name}),jsxRuntime.jsx("p",{className:m("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Mf(B.file.size)})]}),v&&jsxRuntime.jsx("button",{onClick:()=>v(B.id),className:m("p-0.5 rounded-full transition-colors",g?"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"})})]},B.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:m("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(!R),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",g?"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:R&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ie,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"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:Ff.map(B=>jsxRuntime.jsx("button",{type:"button",onClick:()=>fe(B),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:B},B))})})})]}),d&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",g?"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:u==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:A,type:"file",multiple:true,onChange:Q,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:j,onSelect:le,onKeyDown:L,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",g?"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()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"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:y&&b.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((B,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Le(B),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ee===D?g?"bg-white/10":"bg-gray-100":g?"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:B.color||"#8B5CF6"},children:Pf(B.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:m("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:B.name}),B.email&&jsxRuntime.jsx("p",{className:m("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:B.email})]})]},B.id))})})]})]})]})}function Tc({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,u)=>l.type==="mention"?jsxRuntime.jsx("span",{className:m("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},u):jsxRuntime.jsx("span",{children:l.value},u))})}var ts=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Kr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,u]=react.useState(false),[i,c]=react.useState(""),[d,p]=react.useState(false),[f,v]=react.useState(ts[10]||"#3B82F6"),[k,g]=react.useState({top:0,left:0}),y=react.useRef(null),h=react.useRef(null),b=react.useRef(null),x=react.useRef(null),D=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),N=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let T=h.current.getBoundingClientRect();g({top:T.bottom+6,left:T.left});}},[l]),react.useEffect(()=>{let T=H=>{let A=H.target,ie=y.current?.contains(A),S=b.current?.contains(A);!ie&&!S&&(u(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let C=T=>{let H=e.some(A=>A.id===T.id);a(H?e.filter(A=>A.id!==T.id):[...e,T]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let T=await r(i.trim(),f);T&&(a([...e,T]),c(""),v(ts[Math.floor(Math.random()*ts.length)]||"#3B82F6"));}finally{p(false);}}},R=(T,H)=>{H.stopPropagation(),a(e.filter(A=>A.id!==T));},F={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:y,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&u(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:F,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:b,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:k.top,left:k.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:i,onChange:T=>c(T.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:T=>{T.key==="Enter"&&i.trim()&&!N&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(T=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:H=>R(T.id,H),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(T=>{let H=e.some(A=>A.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>C(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:A=>{H||(A.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:A=>{H||(A.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:ts.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:f===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Ci({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 Dc({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(Ci,{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:"#6366F1",light:"#818CF8"},{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 Sc(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 zf(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 Hf({className:e}){return jsxRuntime.jsxs("svg",{className:m("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 Ti({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=zf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Sc(e.loggedMinutes),i=e.estimateMinutes?Sc(e.estimateMinutes):null,c=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:m("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(Hf,{className:l[t]}),jsxRuntime.jsx("span",{children:c})]})}function Pc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function rs(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 Vf(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 _f({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function jf({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 Mc({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 Kf({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 Ni({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:u,onDiscardTimer:i,onClose:c,className:d}){let[p,f]=react.useState(""),[v,k]=react.useState(t.estimateMinutes?rs(t.estimateMinutes):""),[g,y]=react.useState(""),[h,b]=react.useState(false),[x,D]=react.useState(false),N=react.useRef(null);react.useEffect(()=>{N.current?.focus();},[]);let C=async()=>{let F=Pc(p);if(!(F<=0||!s)){b(true);try{await s({durationMinutes:F,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},w=async()=>{if(!n)return;let F=v.trim()?Pc(v):null;await n(F),D(false);},R=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),C()),F.key==="Escape"&&c?.();};return jsxRuntime.jsxs("div",{className:m("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:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Mc,{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:Vf(o)})]}),jsxRuntime.jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(jf,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Mc,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:m("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(_f,{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(Kf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:N,type:"text",value:p,onChange:F=>f(F.target.value),onKeyDown:R,placeholder:"8 (=8h), 2h 30m",className:m("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:C,disabled:h||!p.trim(),className:m("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:g,onChange:F=>y(F.target.value),onKeyDown:R,placeholder:"Note (optional)",className:m("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:rs(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:v,onChange:F=>k(F.target.value),onKeyDown:F=>{F.key==="Enter"&&w(),F.key==="Escape"&&D(false);},onBlur:w,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?rs(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:m("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:m("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(F=>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:F.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:rs(F.durationMinutes)})]},F.id))})]})]})}function Jf(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Zf(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 yo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,u]=react.useState(Zf(r)),[i,c]=react.useState(""),[d,p]=react.useState(false),f=react.useRef(null);react.useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=Jf(l);await o(b&&b>0?b:null,i||void 0),p(false);},k=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxRuntime.jsxs("div",{className:m("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:m("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:m("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("input",{ref:f,type:"text",value:l,onChange:b=>u(b.target.value),onKeyDown:g,placeholder:h[e],className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("p",{className:m("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsxRuntime.jsx("div",{className:"mb-3",children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsxRuntime.jsx("button",{type:"button",onClick:v,disabled:d||!l.trim(),className:m("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:k,disabled:d,className:m("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Qf(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 e0(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 Ei({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Qf(e.health),s=e0(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,u=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:m("h-full transition-all duration-300",o),style:{width:`${u}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Uo(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 a0(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 r0(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 o0(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 n0({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",u=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:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",Uo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:m("font-medium",u),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:m("font-medium",u),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:m("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:m("font-medium",u),children:Uo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:m("font-medium",u),children:Uo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:m("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function s0({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:m("border-b",s,r&&m("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:m("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:m("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Uo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Uo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Uo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",r0(e.status,a),a0(e.status,a)),children:o0(e.status,t)})})]})}function Pi({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",u=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=react.useMemo(()=>e?[...e.tasks].sort((v,k)=>v.varianceMinutes===null?1:k.varianceMinutes===null?-1:k.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:m("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:m("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(n0,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:m("rounded-lg border overflow-hidden",u,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:p,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:m("divide-y",i),children:f.map(v=>jsxRuntime.jsx(s0,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsxRuntime.jsx("div",{className:m("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 zo(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 x0(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 zc(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 k0(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 Br({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:f=[],comments:v=[],onAddComment:k,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:C=0,onTimeLog:w,onEstimateUpdate:R,onSoldEffortUpdate:F,onTimerStart:T,onTimerStop:H,onTimerDiscard:A,blurFinancials:ie=false}){let S=s==="dark",j={textTertiary:S?"#6B7280":"#9CA3AF",textSecondary:S?"#9CA3AF":"#6B7280",textPrimary:S?"#FFFFFF":"#111827",borderLight:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:S?"#1A1D25":"#FFFFFF",bgSecondary:S?"#0F1117":"#F9FAFB",hoverBg:S?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},le=e&&"title"in e&&!("name"in e),Le=e,[L,fe]=react.useState(e?zc(e,l):null),[Q,qe]=react.useState(false),[B,ee]=react.useState(false),[we,he]=react.useState(false),[We,ke]=react.useState(null),[je,ae]=react.useState(new Date),[G,q]=react.useState(false),[me,Ne]=react.useState(false),[Xe,U]=react.useState(""),[De,Me]=react.useState(false),[Ae,X]=react.useState(false),[I,K]=react.useState(false),[de,Se]=react.useState(false),[Ke,ot]=react.useState(""),ct=react.useRef(null),Ye=react.useRef(null),[sa,_]=react.useState(""),Y=react.useRef(null),[ge,et]=react.useState(""),[Ee,Oe]=react.useState(false),[oe,ye]=react.useState([]),[$,ne]=react.useState(""),[$e,Ze]=react.useState(false),at=react.useRef(null);react.useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=zc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),fe(P),ot(P.description||""),_(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!Ke)return;let P=setTimeout(()=>{let J=Ye.current;J&&(J.style.height="auto",J.style.height=`${Math.max(100,J.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Ke]),react.useEffect(()=>()=>{ct.current&&clearTimeout(ct.current),Y.current&&clearTimeout(Y.current);},[]),react.useEffect(()=>{t&&at.current&&v.length>0&&setTimeout(()=>{at.current&&(at.current.scrollTop=at.current.scrollHeight);},100);},[t,v.length]);let Ve=react.useCallback(P=>{fe(P),le&&o&&Le?o(k0(P,Le)):r&&r(P);},[le,Le,o,r]),ve=react.useCallback(()=>{qe(false),ee(false),he(false),ke(null),Ne(false),U(""),Me(false);},[]),He=react.useCallback((P,J)=>{if(!L)return;let _e={...L,[P]:J};Ve(_e);},[L,Ve]),W=react.useCallback(()=>{let P=Ye.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),ce=react.useCallback(P=>{ot(P),setTimeout(W,0),ct.current&&clearTimeout(ct.current),ct.current=setTimeout(()=>{if(L){let J={...L,description:P};Ve(J);}},800);},[L,Ve,W]),vt=react.useCallback(P=>{_(P),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{if(L&&P.trim()){let J={...L,name:P.trim()};Ve(J);}},800);},[L,Ve]),z=react.useCallback(P=>{let J=P.map(_e=>{let Ge={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:_e};return _e.type.startsWith("image/")&&(Ge.preview=URL.createObjectURL(_e)),Ge});ye(_e=>[..._e,...J]);},[]),te=react.useCallback(P=>{ye(J=>{let _e=J.find(Ge=>Ge.id===P);return _e?.preview&&URL.revokeObjectURL(_e.preview),J.filter(Ge=>Ge.id!==P)});},[]),Ie=react.useCallback(async()=>{if(!(!L||!ge.trim()&&oe.length===0||!k)){Oe(true);try{let P=wc(ge,y),J=[];if(oe.length>0&&h){let _e=oe.map(Ge=>Ge.file);J=await h(_e);}await k(L.id,ge.trim(),P.length>0?P:void 0,J.length>0?J:void 0),et(""),oe.forEach(_e=>{_e.preview&&URL.revokeObjectURL(_e.preview);}),ye([]);}finally{Oe(false);}}},[L,ge,oe,k,y,h]),dt=react.useCallback(()=>{if(!L||!$.trim())return;let P=L.subtasks||[],J={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:$.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},_e=[...P,J],Ge={...L,subtasks:_e};Ve(Ge),ne(""),Ze(false);},[L,$,Ve]),Qe=react.useCallback(P=>{if(!L?.subtasks)return;let J=L.subtasks.map(Ge=>Ge.id===P?{...Ge,progress:Ge.progress===100?0:100}:Ge),_e={...L,subtasks:J};Ve(_e);},[L,Ve]),qt=react.useCallback(P=>{if(!L?.subtasks)return;let J=L.subtasks.filter(Ge=>Ge.id!==P),_e={...L,subtasks:J};Ve(_e);},[L,Ve]),ft=react.useCallback(P=>{let J=typeof P=="string"?new Date(P):P,Ge=new Date().getTime()-J.getTime(),Yt=Math.floor(Ge/6e4),Pa=Math.floor(Ge/36e5),ia=Math.floor(Ge/864e5);return Yt<1?n==="es"?"Ahora":"Just now":Yt<60?n==="es"?`Hace ${Yt} min`:`${Yt}m ago`:Pa<24?n==="es"?`Hace ${Pa}h`:`${Pa}h ago`:ia<7?n==="es"?`Hace ${ia}d`:`${ia}d ago`:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Fa=react.useCallback(P=>{if(!L)return;let J=L.progress||0;P==="completed"?J=100:P==="in-progress"&&J===0?J=10:P==="todo"&&(J=0);let _e={...L,status:P,progress:J};Ve(_e),qe(false);},[L,Ve]),Vt=react.useCallback((P,J)=>{if(!L)return;let _e={...L,startDate:P,endDate:J};Ve(_e);},[L,Ve]),Ea=react.useCallback(()=>{let P=je.getFullYear(),J=je.getMonth(),_e=new Date(P,J,1),Yt=new Date(P,J+1,0).getDate(),Pa=_e.getDay(),ia=[],Oa=new Date(P,J,0).getDate();for(let $a=Pa-1;$a>=0;$a--)ia.push({date:new Date(P,J-1,Oa-$a),isCurrentMonth:false});for(let $a=1;$a<=Yt;$a++)ia.push({date:new Date(P,J,$a),isCurrentMonth:true});let Aa=42-ia.length;for(let $a=1;$a<=Aa;$a++)ia.push({date:new Date(P,J+1,$a),isCurrentMonth:false});return ia},[je]),Wr=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),K(false),!L||!d)return;let J=Array.from(P.dataTransfer.files);if(J.length!==0){Se(true);try{await d(L.id,J);}finally{Se(false);}}},[L,d]),Fe=react.useCallback(async P=>{if(!L||!d||!P.target.files)return;let J=Array.from(P.target.files);if(J.length!==0){Se(true);try{await d(L.id,J);}finally{Se(false);}P.target.value="";}},[L,d]),Rt=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),K(true);},[]),Ot=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),K(false);},[]),Ar=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ra=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!L?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&L&&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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",S?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",S?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:m("text-xs font-mono",S?"text-[#6B7280]":"text-gray-400"),children:L.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 P=L.progress===100?0:100,_e={...L,progress:P,status:P===100?"completed":"todo"};Ve(_e);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",L.progress===100?"bg-green-500 border-green-500":S?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:L.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:sa,onChange:P=>vt(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",L.progress===100?"line-through text-[#6B7280]":S?"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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ve(),qe(!Q);},className:m("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",L.progress===100||L.status==="completed"?"bg-green-500/20 text-green-400":L.progress&&L.progress>0||L.status==="in-progress"?"bg-blue-500/20 text-blue-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:L.progress===100||L.status==="completed"?n==="es"?"COMPLETADO":"DONE":L.progress&&L.progress>0||L.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>qe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"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(P=>jsxRuntime.jsxs("button",{onClick:()=>Fa(P.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",L.status===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{ve(),he(!we);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[L.assignees&&L.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[L.assignees.slice(0,3).map((P,J)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},J)),L.assignees.length>3&&jsxRuntime.jsxs("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:["+",L.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>he(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let J=L.assignees?.some(_e=>_e.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let _e=L.assignees||[],Ge;J?Ge=_e.filter(Yt=>Yt.name!==P.name):Ge=[..._e,P],He("assignees",Ge);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",J&&(S?"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:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:m("flex-1",S?"text-white":"text-gray-900"),children:P.name}),J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ke(We?null:"start"),ae(L.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[L.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:m("mx-1",S?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),L.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:()=>ke(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:m("w-44 py-2 border-r",S?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,J=new Date(P);J.setDate(P.getDate()+1);let _e=new Date(P);_e.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ge=new Date(P);Ge.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let Yt=new Date(P);Yt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Pa=new Date(P);Pa.setDate(P.getDate()+14);let ia=new Date(P);return ia.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.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:_e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ge,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Yt,display:Yt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Pa,display:Pa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ia,display:ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Aa,$a)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(We==="start"){let wr=L.endDate&&Aa.date>L.endDate?Aa.date:L.endDate;Vt(Aa.date,wr),ke("end");}else {let wr=L.startDate&&Aa.date<L.startDate?Aa.date:L.startDate;Vt(wr,Aa.date),ke(null);}},children:[jsxRuntime.jsx("span",{children:Aa.label}),jsxRuntime.jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Aa.display})]},$a))})(),jsxRuntime.jsx("div",{className:m("border-t mt-2 pt-2",S?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Vt(void 0,void 0),ke(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"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:m("text-xs mb-3 px-2 py-1 rounded",S?"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:m("font-medium",S?"text-white":"text-gray-900"),children:je.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:()=>ae(new Date),className:m("p-1 rounded text-sm transition-colors",S?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ae(new Date(je.getFullYear(),je.getMonth()-1)),className:m("p-1 rounded",S?"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:()=>ae(new Date(je.getFullYear(),je.getMonth()+1)),className:m("p-1 rounded",S?"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(P=>jsxRuntime.jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Ea().map((P,J)=>{let _e=P.date.toDateString()===new Date().toDateString(),Ge=L.startDate?.toDateString()===P.date.toDateString(),Yt=L.endDate?.toDateString()===P.date.toDateString(),Pa=Ge||Yt,ia=L.startDate&&L.endDate&&P.date>=L.startDate&&P.date<=L.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Oa=new Date(P.date);if(We==="start"){let Aa=L.endDate&&Oa>L.endDate?Oa:L.endDate;Vt(Oa,Aa),ke("end");}else {let Aa=L.startDate&&Oa<L.startDate?Oa:L.startDate;Vt(Aa,Oa),ke(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(S?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(S?"text-white":"text-gray-900"),_e&&"ring-2 ring-[#3B82F6]",Ge&&"bg-[#3B82F6] text-white",Yt&&!Ge&&"bg-[#7C3AED] text-white",ia&&!Pa&&(S?"bg-[#7C3AED]/20":"bg-purple-100"),!Pa&&(S?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},J)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ve(),ee(!B);},className:m("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",L.priority==="high"||L.priority==="urgent"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":L.priority==="low"?"bg-green-500/20 text-green-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:L.priority?L.priority==="high"||L.priority==="urgent"?n==="es"?"Alta":"High":L.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&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:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"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(P=>jsxRuntime.jsxs("button",{onClick:()=>{He("priority",P.id),ee(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",L.priority===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:L.startDate&&L.endDate?`${Math.ceil((L.endDate.getTime()-L.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:m("w-4 h-4 rounded-full border-2",S?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[G?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:L.progress||0,onChange:P=>{let J=parseInt(P.target.value),_e=L.status;J===100?_e="completed":J>0?_e="in-progress":_e="todo";let Ge={...L,progress:J,status:_e};Ve(Ge);},onBlur:()=>q(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",S?"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-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>q(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",S?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:m("h-full rounded-full transition-all",L.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${L.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:m("text-sm font-medium min-w-[40px]",S?"text-white":"text-gray-900"),children:[L.progress||0,"%"]})]})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"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:L.status==="completed"||L.progress===100?jsxRuntime.jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?zo(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>X("estimate"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:zo(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>X("estimate"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ae==="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(yo,{mode:"estimate",locale:n,isDark:S,currentValue:x?.estimateMinutes||null,onSave:async P=>{await R?.(L.id,P),X(false);},onClose:()=>X(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ie?jsxRuntime.jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",S?"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"}):L.status==="completed"||L.progress===100?jsxRuntime.jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:L.quotedMinutes?zo(L.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):L.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>X("quoted"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:zo(L.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>X("quoted"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ae==="quoted"&&!ie&&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(yo,{mode:"quoted",locale:n,isDark:S,currentValue:L.quotedMinutes||null,onSave:async P=>{F?(await F(L.id,P),fe(J=>J?{...J,quotedMinutes:P}:null)):He("quotedMinutes",P),X(false);},onClose:()=>X(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[L.status==="completed"||L.progress===100?jsxRuntime.jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",S?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxRuntime.jsxs("button",{type:"button",onClick:()=>H?.(L.id),className:m("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"}),x0(C||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>T?.(L.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",S?"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"})}),L.status==="completed"||L.progress===100?jsxRuntime.jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",S?"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:()=>X("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",S?"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:m("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":S?"text-white":"text-gray-900"),children:[zo(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:m("font-normal",S?"text-[#6B7280]":"text-gray-400"),children:[" / ",zo(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:m("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:Ae==="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(yo,{mode:"log",locale:n,isDark:S,currentValue:null,onSave:async(P,J)=>{P&&await w?.(L.id,{durationMinutes:P,note:J,source:"manual"}),X(false);},onClose:()=>X(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Kr,{selectedTags:L.tags||[],availableTags:u,onChange:P=>{He("tags",P);},onCreateTag:i,theme:j})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:m("w-4 h-4 mt-1.5",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[L.dependencies&&L.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:L.dependencies.map(P=>{let J=f.find(_e=>_e.id===P);return jsxRuntime.jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",S?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[J?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let _e=(L.dependencies||[]).filter(Ge=>Ge!==P);He("dependencies",_e);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{ve(),Ne(!me);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ne(false),U("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:m("p-2 border-b",S?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Xe,onChange:P=>U(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",S?"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:f.length>0?f.filter(P=>P.id!==L.id).filter(P=>Xe===""||P.name.toLowerCase().includes(Xe.toLowerCase())).map(P=>{let J=L.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let _e=L.dependencies||[],Ge;J?Ge=_e.filter(Yt=>Yt!==P.id):Ge=[..._e,P.id],He("dependencies",Ge);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",J&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",J?"bg-blue-500 border-blue-500":S?"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:m("block truncate",S?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{ve(),Me(!De);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:L.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:bo.find(P=>P.value===L.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:De&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Me(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",S?"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(P=>{let J=L.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{He("color",P.value),Me(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",J&&"ring-2 ring-offset-2",S?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:J?P.value:void 0},title:P.name,children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"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:L.isMilestone||false,onChange:P=>He("isMilestone",P.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",L.isMilestone?"bg-purple-500 border-purple-500":S?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:Ye,value:Ke,onChange:P=>ce(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("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",S?"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:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",L.subtasks&&L.subtasks.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",L.subtasks.filter(P=>P.progress===100).length,"/",L.subtasks.length,")"]})]})}),L.subtasks&&L.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...L.subtasks].sort((P,J)=>(P.position??0)-(J.position??0)).map(P=>jsxRuntime.jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",S?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Qe(P.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":S?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:m("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":S?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("button",{onClick:()=>qt(P.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",S?"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"})})]},P.id))}),$e?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:$,onChange:P=>ne(P.target.value),onKeyDown:P=>{P.key==="Enter"&&$.trim()?dt():P.key==="Escape"&&(Ze(false),ne(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",S?"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:dt,disabled:!$.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",$.trim()?"bg-blue-500 hover:bg-blue-600 text-white":S?"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:()=>{Ze(false),ne("");},className:m("p-2 rounded-lg transition-colors",S?"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:()=>Ze(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",S?"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:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold mb-3",S?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let J=Ra(P.type),_e=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[_e&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",S?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(J,{className:m("w-5 h-5",S?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",S?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Ar(P.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(P.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",S?"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"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Rt,onDragLeave:Ot,onDrop:Wr,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",I?S?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":S?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",de&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||de}),de?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:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:m("w-6 h-6 mx-auto mb-2",I?"text-blue-500":S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:I?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:m("text-xs mt-1",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:m("w-96 border-l flex flex-col",S?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",S?"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: ${D?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
16
+ background: ${S?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:De,className:d("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",D?"scrollbar-slim":"scrollbar-slim-light"),children:x.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...x].sort((P,oe)=>{let Xe=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,nt=typeof oe.createdAt=="string"?new Date(oe.createdAt):oe.createdAt;return Xe.getTime()-nt.getTime()}).map(P=>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:P.user?.color||"#8B5CF6"},children:P.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:d("text-sm font-medium",D?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",D?"text-[#6B7280]":"text-gray-400"),children:dt(P.createdAt)})]}),jsxRuntime.jsx("div",{className:d("text-sm",D?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Uc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(oe=>{let Xe=oe.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:d("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",D?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Xe?jsxRuntime.jsx(lucideReact.Image,{className:d("w-4 h-4",D?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:d("w-4 h-4",D?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:d("text-xs truncate max-w-[100px]",D?"text-white":"text-gray-900"),children:oe.name})]},oe.id)})})]})]},P.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:d("w-10 h-10 mb-3",D?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",D?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("py-4 pl-4 pr-2 border-t",D?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Hc,{value:yt,onChange:U,onSubmit:ce,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:Oe,theme:s,locale:n,currentUser:p,enableEmoji:true,enableAttachments:!!b,pendingFiles:Ne,onFilesSelect:A,onRemoveFile:Z})})]})]})]})})}function Gi(){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 eo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:c,isLoading:u,error:i,children:m,availableTags:l=[],onCreateTag:g,attachmentsByCard:f,onUploadAttachments:x,onDeleteAttachment:k,comments:p,onAddComment:v,currentUser:b,mentionableUsers:h,onTaskOpen:y,onUploadCommentAttachments:C,enableTimeTracking:N,timeTrackingSummary:S,timeEntries:w,timerState:E,onLogTime:L,onUpdateEstimate:T,onUpdateSoldEffort:z,onStartTimer:H,onStopTimer:J,onDiscardTimer:D,blurFinancials:ve=false,sidePanel:de,renderColumnMetrics:V,suppressDetailModal:I=false}){let[Te,Q]=Gi(),[et,$]=react.useState(null),[ae,Re]=react.useState(false),ke=react.useRef(null),Ze=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ee=o?.theme||"dark",ze=Ee==="dark"||Ee==="neutral",re=ze?"dark":"",K=react.useCallback((X,Me)=>{t.onCardUpdate?.(X,Me);},[t]),q=react.useCallback((X,Me)=>{t.onColumnUpdate?.(X,{title:Me});},[t]),be=react.useCallback(X=>{t.onColumnDelete?.(X);},[t]),we=["todo","in-progress","completed"],Je=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),G=react.useMemo(()=>{let X=new Map;return e.columns.forEach(Me=>{let Ve=Me.cardIds.map(tt=>e.cards.find(rt=>rt.id===tt)).filter(tt=>tt!==void 0).sort((tt,rt)=>tt.position-rt.position);X.set(Me.id,Ve);}),X},[e.cards,e.columns]);react.useEffect(()=>{let X=ke.current;if(!X)return;let Me=_e=>{let Nt=_e.target,ht=_e.button===1,xt=Nt===X||Nt.classList.contains("asakaa-column")&&!Nt.closest(".asakaa-card");(ht||_e.button===0&&xt&&!Te.isDragging)&&(_e.preventDefault(),Re(true),Ze.current={x:_e.clientX,y:_e.clientY,scrollLeft:X.scrollLeft,scrollTop:X.scrollTop},X.style.cursor="grabbing",X.style.userSelect="none");},Ve=_e=>{if(!ae)return;let Nt=_e.clientX-Ze.current.x,ht=_e.clientY-Ze.current.y;X.scrollLeft=Ze.current.scrollLeft-Nt,X.scrollTop=Ze.current.scrollTop-ht;},tt=()=>{ae&&(Re(false),X.style.cursor="",X.style.userSelect="");},rt=()=>{ae&&(Re(false),X.style.cursor="",X.style.userSelect="");};return X.addEventListener("mousedown",Me),document.addEventListener("mousemove",Ve),document.addEventListener("mouseup",tt),X.addEventListener("mouseleave",rt),()=>{X.removeEventListener("mousedown",Me),document.removeEventListener("mousemove",Ve),document.removeEventListener("mouseup",tt),X.removeEventListener("mouseleave",rt);}},[ae,Te.isDragging]);let he=react.useMemo(()=>e.cards.map(X=>({id:X.id,name:X.title,startDate:X.startDate?new Date(X.startDate):void 0,endDate:X.endDate?new Date(X.endDate):void 0,progress:X.progress||0,status:X.columnId,priority:X.priority?.toLowerCase(),dependencies:Array.isArray(X.dependencies)?X.dependencies.map(Me=>typeof Me=="string"?Me:Me.taskId):[]})),[e.cards]),je=react.useCallback(X=>{let{active:Me}=X,Ve=e.cards.find(tt=>tt.id===Me.id);Ve&&Q({isDragging:true,draggedCardId:Ve.id,sourceColumnId:Ve.columnId,targetColumnId:Ve.columnId});},[e.cards,Q]),Ie=react.useCallback(X=>{let{active:Me,over:Ve}=X;if(!Ve||!e.cards.find(_e=>_e.id===Me.id))return;let rt=null;Ve.data.current?.type==="column"?rt=Ve.id:Ve.data.current?.type==="card"&&(rt=e.cards.find(Nt=>Nt.id===Ve.id)?.columnId||null),rt&&rt!==Te.targetColumnId&&Q({...Te,targetColumnId:rt});},[e.cards,Te,Q]),Ke=react.useCallback(async X=>{let{active:Me,over:Ve}=X;if(Q({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Ve)return;let tt=e.cards.find(ht=>ht.id===Me.id);if(!tt)return;let rt,_e;if(Ve.data.current?.type==="column"){rt=Ve.id;let ht=G.get(rt)||[];_e=Ti(ht,0);}else {let ht=e.cards.find(U=>U.id===Ve.id);if(!ht)return;rt=ht.columnId;let xt=G.get(rt)||[],yt=xt.findIndex(U=>U.id===Ve.id);_e=Ti(xt,yt);}let Nt=e.columns.find(ht=>ht.id===rt);if(Nt&&Nt.wipLimit&&Nt.wipLimitType==="hard"){let ht=G.get(rt)||[];if(tt.columnId!==rt&&ht.length>=Nt.wipLimit){t.onWipLimitExceeded?.(Nt,tt);return}}(tt.columnId!==rt||tt.position!==_e)&&await t.onCardMove?.(tt.id,rt,_e);},[e.cards,e.columns,G,t,Q]),O=react.useCallback(X=>{I||$(X),a?.(X),y?.(X.id);},[a,y,I]),ne=react.useCallback(X=>{t.onCardUpdate?.(X.id,X),$(X);},[t]);return u?jsxRuntime.jsx("div",{className:d("asakaa-board",re,n),style:c,children:jsxRuntime.jsx(cb,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:d("asakaa-board",re,n),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(fc,{themeName:Ee,children:[jsxRuntime.jsxs("div",{className:d("flex h-full overflow-hidden",de?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Je,collisionDetection:core$1.closestCorners,onDragStart:je,onDragOver:Ie,onDragEnd:Ke,children:[jsxRuntime.jsxs("div",{ref:ke,className:d("asakaa-board",de?"flex-1":"",re,n),style:{...c,cursor:ae?"grabbing":void 0},"data-theme":Ee,children:[e.columns.sort((X,Me)=>X.position-Me.position).map(X=>{let Me=G.get(X.id)||[],Ve=!we.includes(X.id);return jsxRuntime.jsx(_o,{column:X,cards:Me,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:V?(tt,rt)=>V(tt,rt):void 0,onCardClick:O,onCardUpdate:K,onColumnRename:q,onColumnDelete:be,isDeletable:Ve,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},X.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:Te.draggedCardId?jsxRuntime.jsx(Hr,{card:e.cards.find(X=>X.id===Te.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),de]}),!I&&jsxRuntime.jsx(zr,{task:et,isOpen:!!et,onClose:()=>$(null),onCardUpdate:ne,theme:ze?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:g,attachments:et?f?.get(et.id)||[]:[],onUploadAttachments:x,onDeleteAttachment:k,availableTasks:he,comments:p,onAddComment:v,currentUser:b,mentionableUsers:h,onUploadCommentAttachments:C,enableTimeTracking:N,timeTrackingSummary:S,timeEntries:w,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:L,onEstimateUpdate:T,onSoldEffortUpdate:z,onTimerStart:H,onTimerStop:J,onTimerDiscard:D,blurFinancials:ve})]})}function cb({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 fb={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},bb={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:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},hb={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},yb={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function xb({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let i=m=>{c.current&&!c.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:c,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, #3B82F6 0%, #2563EB 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:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,m)=>i.position-m.position).map((i,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function vb({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[c,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=x=>{i.current&&!i.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let l=[{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(f=>f.handler),g=async(f,x)=>{if(x){u(f);try{await x();}catch(k){console.error(`Export ${f} failed:`,k);}finally{u(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((f,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(f.id,f.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===f.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"})}):f.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:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function kb({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, #3B82F6 0%, #2563EB 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:t})]})}function _i({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:c,onExportExcel:u,translations:i}){let m=r==="dark"?fb:bb,l={...o==="es"?hb:yb,...i},g=n||c||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vb,{theme:m,t:l,onExportCSV:n,onExportJSON:c,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(xb,{columns:e,onSelect:t,theme:m,t:l,createTaskLabel:a}):jsxRuntime.jsx(kb,{onClick:()=>t(),label:a||l.newTask}))]})})}function Ki({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[c,u]=react.useState(""),i=react.useCallback(()=>{let g=c.trim();g&&(e(g),u(""),n(false));},[c,e]),m=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(u(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||n(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:d("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:c,onChange:g=>u(g.target.value),onKeyDown:m,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!c.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:()=>{u(""),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:d("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 Yi({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:c="dark",locale:u="es"}){let[i,m]=react.useState(false),[l,g]=react.useState(false),[f,x]=react.useState(""),[k,p]=react.useState([]),[v,b]=react.useState(""),[h,y]=react.useState(""),[C,N]=react.useState(""),[S,w]=react.useState(false),[E,L]=react.useState(false),[T,z]=react.useState(false),H=react.useRef(null),J=react.useRef(null),D={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},ve=react.useCallback(()=>{x(""),p([]),b(""),y(""),N(""),w(false),L(false),z(false),m(false);},[]);react.useEffect(()=>{i&&H.current&&H.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let Q=et=>{J.current&&!J.current.contains(et.target)&&(f.trim()||ve());};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[i,f,ve]);let de=react.useCallback(async()=>{let Q=f.trim();if(!(!Q||l)){g(true);try{await t({name:Q,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:v?new Date(v):void 0,endDate:h?new Date(h):void 0,priority:C||void 0}),x(""),p([]),b(""),y(""),N(""),w(!1),L(!1),z(!1),H.current?.focus();}catch(et){console.error("Error creating card:",et);}finally{g(false);}}},[f,e,k,v,h,C,t,l]),V=react.useCallback(Q=>{Q.key==="Enter"&&!Q.shiftKey?(Q.preventDefault(),de()):Q.key==="Escape"&&ve();},[de,ve]),I=react.useCallback(Q=>{p(et=>et.includes(Q)?et.filter($=>$!==Q):[...et,Q]);},[]),Te=c==="dark";return i?jsxRuntime.jsxs("div",{ref:J,className:d("rounded-lg overflow-hidden shadow-lg",Te?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:f,onChange:Q=>x(Q.target.value),onKeyDown:V,placeholder:D.placeholder,disabled:l,className:d("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Te?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!S),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",S||k.length>0?"bg-emerald-500/20 text-emerald-400":Te?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:D.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),k.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:k.length})]}),jsxRuntime.jsx("button",{onClick:()=>L(!E),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",E||v||h?"bg-blue-500/20 text-blue-400":Te?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:D.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>z(!T),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||C?C==="urgent"?"bg-red-500/20 text-red-400":C==="high"?"bg-orange-500/20 text-orange-400":C==="medium"?"bg-yellow-500/20 text-yellow-400":C==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Te?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:D.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:de,disabled:!f.trim()||l,className:d("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):D.save})]})]}),S&&a.length>0&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Te?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(Q=>jsxRuntime.jsxs("button",{onClick:()=>I(Q.id),className:d("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(Q.id)?"bg-emerald-500 text-white":Te?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[Q.avatar?jsxRuntime.jsx("img",{src:Q.avatar,alt:Q.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(Q.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:Q.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:Q.name.split(" ")[0]})]},Q.id))})}),E&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Te?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Te?"text-gray-500":"text-gray-400"),children:D.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:Q=>b(Q.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Te?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Te?"text-gray-500":"text-gray-400"),children:D.endDate}),jsxRuntime.jsx("input",{type:"date",value:h,onChange:Q=>y(Q.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Te?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Te?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(Q=>jsxRuntime.jsx("button",{onClick:()=>N(C===Q?"":Q),className:d("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",C===Q?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[Q]} text-white`:Te?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:D[Q]},Q))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:n,className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Te?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:D.buttonLabel})]})}var kn=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(eo,{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 bu(e={}){return new kn(e)}var Yo=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 qi(e,t){let a=r=>jsxRuntime.jsx(Yo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ji({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:c,onOpenAIUsage:u,shortcut:i="k",className:m=""}){let[l,g]=react.useState(false),[f,x]=react.useState(""),[k,p]=react.useState("home"),[v,b]=react.useState(""),[h,y]=react.useState("");react.useEffect(()=>{let w=E=>{(E.metaKey||E.ctrlKey)&&E.key===i&&(E.preventDefault(),g(L=>!L)),E.key==="Escape"&&(g(false),p("home"),x(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{l||(p("home"),x(""),b(""),y(""));},[l]);let C=react.useCallback(()=>{g(false);},[]),N=react.useCallback(w=>{let[E,L]=w.split(":");switch(E){case "create-card":p("create-card");break;case "create-card-in":b(L||"");break;case "navigate":L?(a?.(L),C()):p("navigate");break;case "search":r?.(f),C();break;case "priority":p("priority");break;case "set-priority":h&&L&&(o?.(h,L),C());break;case "assign":p("assign");break;case "assign-user":h&&L&&(s?.(h,L),C());break;case "ai":p("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":c?.(),C();break;case "ai-usage":u?.(),C();break;case "back":p("home");break;}},[f,h,t,a,r,o,s,n,c,u,C]),S=react.useCallback(()=>{v&&f.trim()&&(t?.(v,f.trim()),C());},[v,f,t,C]);return l?jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:x,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:k==="create-card"&&v?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&k==="create-card"&&v&&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."}),k==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(E=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:E},E))})]},w.id))})]}),k==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let E=e.columns.find(L=>L.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},w.id)})})]}),k==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function xu(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:at,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",S?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...v].sort((P,J)=>{let _e=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ge=typeof J.createdAt=="string"?new Date(J.createdAt):J.createdAt;return _e.getTime()-Ge.getTime()}).map(P=>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:P.user?.color||"#8B5CF6"},children:P.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:m("text-sm font-medium",S?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:ft(P.createdAt)})]}),jsxRuntime.jsx("div",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Tc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(J=>{let _e=J.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:J.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[_e?jsxRuntime.jsx(lucideReact.Image,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:m("text-xs truncate max-w-[100px]",S?"text-white":"text-gray-900"),children:J.name})]},J.id)})})]})]},P.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:m("w-10 h-10 mb-3",S?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:m("py-4 pl-4 pr-2 border-t",S?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Cc,{value:ge,onChange:et,onSubmit:Ie,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:Ee,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:oe,onFilesSelect:z,onRemoveFile:te})})]})]})]})})}function Fi(){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 Yr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:u,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:f,onUploadAttachments:v,onDeleteAttachment:k,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:w,timerState:R,onLogTime:F,onUpdateEstimate:T,onUpdateSoldEffort:H,onStartTimer:A,onStopTimer:ie,onDiscardTimer:S,blurFinancials:j=false}){let[le,Le]=Fi(),[L,fe]=react.useState(null),[Q,qe]=react.useState(false),B=react.useRef(null),ee=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),we=o?.theme||"dark",he=we==="dark"||we==="neutral",We=he?"dark":"",ke=react.useCallback((X,I)=>{t.onCardUpdate?.(X,I);},[t]),je=react.useCallback((X,I)=>{t.onColumnUpdate?.(X,{title:I});},[t]),ae=react.useCallback(X=>{t.onColumnDelete?.(X);},[t]),G=["todo","in-progress","completed"],q=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),me=react.useMemo(()=>{let X=new Map;return e.columns.forEach(I=>{let K=I.cardIds.map(de=>e.cards.find(Se=>Se.id===de)).filter(de=>de!==void 0).sort((de,Se)=>de.position-Se.position);X.set(I.id,K);}),X},[e.cards,e.columns]);react.useEffect(()=>{let X=B.current;if(!X)return;let I=Ke=>{let ot=Ke.target,ct=Ke.button===1,Ye=ot===X||ot.classList.contains("asakaa-column")&&!ot.closest(".asakaa-card");(ct||Ke.button===0&&Ye&&!le.isDragging)&&(Ke.preventDefault(),qe(true),ee.current={x:Ke.clientX,y:Ke.clientY,scrollLeft:X.scrollLeft,scrollTop:X.scrollTop},X.style.cursor="grabbing",X.style.userSelect="none");},K=Ke=>{if(!Q)return;let ot=Ke.clientX-ee.current.x,ct=Ke.clientY-ee.current.y;X.scrollLeft=ee.current.scrollLeft-ot,X.scrollTop=ee.current.scrollTop-ct;},de=()=>{Q&&(qe(false),X.style.cursor="",X.style.userSelect="");},Se=()=>{Q&&(qe(false),X.style.cursor="",X.style.userSelect="");};return X.addEventListener("mousedown",I),document.addEventListener("mousemove",K),document.addEventListener("mouseup",de),X.addEventListener("mouseleave",Se),()=>{X.removeEventListener("mousedown",I),document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",de),X.removeEventListener("mouseleave",Se);}},[Q,le.isDragging]);let Ne=react.useMemo(()=>e.cards.map(X=>({id:X.id,name:X.title,startDate:X.startDate?new Date(X.startDate):void 0,endDate:X.endDate?new Date(X.endDate):void 0,progress:X.progress||0,status:X.columnId,priority:X.priority?.toLowerCase(),dependencies:Array.isArray(X.dependencies)?X.dependencies.map(I=>typeof I=="string"?I:I.taskId):[]})),[e.cards]),Xe=react.useCallback(X=>{let{active:I}=X,K=e.cards.find(de=>de.id===I.id);K&&Le({isDragging:true,draggedCardId:K.id,sourceColumnId:K.columnId,targetColumnId:K.columnId});},[e.cards,Le]),U=react.useCallback(X=>{let{active:I,over:K}=X;if(!K||!e.cards.find(Ke=>Ke.id===I.id))return;let Se=null;K.data.current?.type==="column"?Se=K.id:K.data.current?.type==="card"&&(Se=e.cards.find(ot=>ot.id===K.id)?.columnId||null),Se&&Se!==le.targetColumnId&&Le({...le,targetColumnId:Se});},[e.cards,le,Le]),De=react.useCallback(async X=>{let{active:I,over:K}=X;if(Le({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!K)return;let de=e.cards.find(ct=>ct.id===I.id);if(!de)return;let Se,Ke;if(K.data.current?.type==="column"){Se=K.id;let ct=me.get(Se)||[];Ke=mi(ct,0);}else {let ct=e.cards.find(_=>_.id===K.id);if(!ct)return;Se=ct.columnId;let Ye=me.get(Se)||[],sa=Ye.findIndex(_=>_.id===K.id);Ke=mi(Ye,sa);}let ot=e.columns.find(ct=>ct.id===Se);if(ot&&ot.wipLimit&&ot.wipLimitType==="hard"){let ct=me.get(Se)||[];if(de.columnId!==Se&&ct.length>=ot.wipLimit){t.onWipLimitExceeded?.(ot,de);return}}(de.columnId!==Se||de.position!==Ke)&&await t.onCardMove?.(de.id,Se,Ke);},[e.cards,e.columns,me,t,Le]),Me=react.useCallback(X=>{fe(X),a?.(X),x?.(X.id);},[a,x]),Ae=react.useCallback(X=>{t.onCardUpdate?.(X.id,X),fe(X);},[t]);return u?jsxRuntime.jsx("div",{className:m("asakaa-board",We,n),style:l,children:jsxRuntime.jsx(L0,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:m("asakaa-board",We,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Qd,{themeName:we,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:q,collisionDetection:core$1.closestCorners,onDragStart:Xe,onDragOver:U,onDragEnd:De,children:[jsxRuntime.jsxs("div",{ref:B,className:m("asakaa-board",We,n),style:{...l,cursor:Q?"grabbing":void 0},"data-theme":we,children:[e.columns.sort((X,I)=>X.position-I.position).map(X=>{let I=me.get(X.id)||[],K=!G.includes(X.id);return jsxRuntime.jsx($o,{column:X,cards:I,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Me,onCardUpdate:ke,onColumnRename:je,onColumnDelete:ae,isDeletable:K,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},X.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:le.draggedCardId?jsxRuntime.jsx(Lr,{card:e.cards.find(X=>X.id===le.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Br,{task:L,isOpen:!!L,onClose:()=>fe(null),onCardUpdate:Ae,theme:he?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:L?f?.get(L.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:k,availableTasks:Ne,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:w,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:F,onEstimateUpdate:T,onSoldEffortUpdate:H,onTimerStart:A,onTimerStop:ie,onTimerDiscard:S,blurFinancials:j})]})}function L0({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 $0={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},U0={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:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},z0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},H0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function W0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,c)=>i.position-c.position).map((i,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function G0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[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(f=>f.handler),p=async(f,v)=>{if(v){u(f);try{await v();}catch(k){console.error(`Export ${f} failed:`,k);}finally{u(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((f,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.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"})}):f.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:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function V0({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, #3B82F6 0%, #2563EB 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:t})]})}function Li({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:u,translations:i}){let c=r==="dark"?$0:U0,d={...o==="es"?z0:H0,...i},p=n||l||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(G0,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(W0,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsxRuntime.jsx(V0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Bi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,u]=react.useState(""),i=react.useCallback(()=>{let p=l.trim();p&&(e(p),u(""),n(false));},[l,e]),c=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(u(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:p=>u(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{u(""),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:m("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 Ri({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:u="es"}){let[i,c]=react.useState(false),[d,p]=react.useState(false),[f,v]=react.useState(""),[k,g]=react.useState([]),[y,h]=react.useState(""),[b,x]=react.useState(""),[D,N]=react.useState(""),[C,w]=react.useState(false),[R,F]=react.useState(false),[T,H]=react.useState(false),A=react.useRef(null),ie=react.useRef(null),S={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},j=react.useCallback(()=>{v(""),g([]),h(""),x(""),N(""),w(false),F(false),H(false),c(false);},[]);react.useEffect(()=>{i&&A.current&&A.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let Q=qe=>{ie.current&&!ie.current.contains(qe.target)&&(f.trim()||j());};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[i,f,j]);let le=react.useCallback(async()=>{let Q=f.trim();if(!(!Q||d)){p(true);try{await t({name:Q,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:D||void 0}),v(""),g([]),h(""),x(""),N(""),w(!1),F(!1),H(!1),A.current?.focus();}catch(qe){console.error("Error creating card:",qe);}finally{p(false);}}},[f,e,k,y,b,D,t,d]),Le=react.useCallback(Q=>{Q.key==="Enter"&&!Q.shiftKey?(Q.preventDefault(),le()):Q.key==="Escape"&&j();},[le,j]),L=react.useCallback(Q=>{g(qe=>qe.includes(Q)?qe.filter(B=>B!==Q):[...qe,Q]);},[]),fe=l==="dark";return i?jsxRuntime.jsxs("div",{ref:ie,className:m("rounded-lg overflow-hidden shadow-lg",fe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:A,type:"text",value:f,onChange:Q=>v(Q.target.value),onKeyDown:Le,placeholder:S.placeholder,disabled:d,className:m("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",fe?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!C),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||k.length>0?"bg-emerald-500/20 text-emerald-400":fe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),k.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:k.length})]}),jsxRuntime.jsx("button",{onClick:()=>F(!R),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||b?"bg-blue-500/20 text-blue-400":fe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>H(!T),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":fe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:le,disabled:!f.trim()||d,className:m("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):S.save})]})]}),C&&a.length>0&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",fe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(Q=>jsxRuntime.jsxs("button",{onClick:()=>L(Q.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(Q.id)?"bg-emerald-500 text-white":fe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[Q.avatar?jsxRuntime.jsx("img",{src:Q.avatar,alt:Q.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(Q.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:Q.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:Q.name.split(" ")[0]})]},Q.id))})}),R&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",fe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",fe?"text-gray-500":"text-gray-400"),children:S.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:Q=>h(Q.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",fe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",fe?"text-gray-500":"text-gray-400"),children:S.endDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:Q=>x(Q.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",fe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",fe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(Q=>jsxRuntime.jsx("button",{onClick:()=>N(D===Q?"":Q),className:m("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===Q?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[Q]} text-white`:fe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[Q]},Q))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(true),disabled:n,className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",fe?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:S.buttonLabel})]})}var hn=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(Yr,{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 eu(e={}){return new hn(e)}var Wo=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 Oi(e,t){let a=r=>jsxRuntime.jsx(Wo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ui({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:u,shortcut:i="k",className:c=""}){let[d,p]=react.useState(false),[f,v]=react.useState(""),[k,g]=react.useState("home"),[y,h]=react.useState(""),[b,x]=react.useState("");react.useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(F=>!F)),R.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(g("home"),v(""),h(""),x(""));},[d]);let D=react.useCallback(()=>{p(false);},[]),N=react.useCallback(w=>{let[R,F]=w.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":h(F||"");break;case "navigate":F?(a?.(F),D()):g("navigate");break;case "search":r?.(f),D();break;case "priority":g("priority");break;case "set-priority":b&&F&&(o?.(b,F),D());break;case "assign":g("assign");break;case "assign-user":b&&F&&(s?.(b,F),D());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":u?.(),D();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,l,u,D]),C=react.useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),D());},[y,f,t,D]);return d?jsxRuntime.jsx(wt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:v,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:k==="create-card"&&y?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&k==="create-card"&&y&&C();}}),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."}),k==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),k==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let R=e.columns.find(F=>F.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:F},F))})]},w.id)})})]}),k==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function ru(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;
@@ -25,12 +25,12 @@
25
25
  justify-content: center !important;
26
26
  background: rgba(0, 0, 0, 0.95) !important;
27
27
  cursor: pointer !important;
28
- `;let c=document.createElement("img");c.src=e,c.alt=t,c.className="attachment-lightbox-image",c.style.cssText=`
28
+ `;let l=document.createElement("img");l.src=e,l.alt=t,l.className="attachment-lightbox-image",l.style.cssText=`
29
29
  max-width: 92vw !important;
30
30
  max-height: 92vh !important;
31
31
  object-fit: contain !important;
32
32
  cursor: default !important;
33
- `,c.onclick=l=>l.stopPropagation();let u=document.createElement("div");u.className="attachment-lightbox-hint",u.textContent="Click anywhere or press ESC to close",u.style.cssText=`
33
+ `,l.onclick=d=>d.stopPropagation();let u=document.createElement("div");u.className="attachment-lightbox-hint",u.textContent="Click anywhere or press ESC to close",u.style.cssText=`
34
34
  position: absolute !important;
35
35
  bottom: 24px !important;
36
36
  left: 50% !important;
@@ -38,7 +38,7 @@
38
38
  font-size: 12px !important;
39
39
  color: rgba(255, 255, 255, 0.4) !important;
40
40
  pointer-events: none !important;
41
- `;let i=()=>{n.remove(),document.removeEventListener("keydown",m);},m=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let g=r>0?r-1:a.length-1;i(),o(g);}else if(l.key==="ArrowRight"&&a.length>1){let g=r<a.length-1?r+1:0;i(),o(g);}};if(n.onclick=i,document.addEventListener("keydown",m),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
41
+ `;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),o(p);}else if(d.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),o(p);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
42
42
  position: absolute !important;
43
43
  bottom: 48px !important;
44
44
  left: 50% !important;
@@ -48,7 +48,7 @@
48
48
  padding: 8px 12px !important;
49
49
  background: rgba(0, 0, 0, 0.4) !important;
50
50
  border-radius: 20px !important;
51
- `,l.onclick=x=>x.stopPropagation(),a.forEach((x,k)=>{let p=document.createElement("button");p.className=`attachment-lightbox-dot ${k===r?"active":""}`,p.style.cssText=`
51
+ `,d.onclick=v=>v.stopPropagation(),a.forEach((v,k)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${k===r?"active":""}`,g.style.cssText=`
52
52
  width: 8px !important;
53
53
  height: 8px !important;
54
54
  border-radius: 50% !important;
@@ -56,7 +56,7 @@
56
56
  border: none !important;
57
57
  padding: 0 !important;
58
58
  cursor: pointer !important;
59
- `,p.onclick=v=>{v.stopPropagation(),i(),o(k);},l.appendChild(p);});let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
59
+ `,g.onclick=y=>{y.stopPropagation(),i(),o(k);},d.appendChild(g);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
60
60
  position: absolute !important;
61
61
  left: 0 !important;
62
62
  top: 0 !important;
@@ -69,7 +69,7 @@
69
69
  border: none !important;
70
70
  cursor: pointer !important;
71
71
  opacity: 0.5 !important;
72
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=x=>{x.stopPropagation();let k=r>0?r-1:a.length-1;i(),o(k);};let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",f.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f.style.cssText=`
72
+ `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=v=>{v.stopPropagation();let k=r>0?r-1:a.length-1;i(),o(k);};let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",f.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f.style.cssText=`
73
73
  position: absolute !important;
74
74
  right: 0 !important;
75
75
  top: 0 !important;
@@ -82,7 +82,7 @@
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=x=>{x.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(l),n.appendChild(g),n.appendChild(f);}n.appendChild(c),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Sb(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 Eb(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 Qi(e){return e.startsWith("image/")}function Br({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,c]=react.useState(false),[u,i]=react.useState(false),[m,l]=react.useState(null),g=react.useRef(null),f=react.useRef(e);f.current=e;let x=react.useCallback((w,E)=>{E.preventDefault(),E.stopPropagation();let L=f.current.filter(H=>Qi(H.type)),T=L.findIndex(H=>H.id===w.id),z=H=>{let J=f.current.filter(ve=>Qi(ve.type)),D=J[H];D&&xu(D.url,D.name,J,H,z);};xu(w.url,w.name,L,T,z);},[]),k=react.useCallback(w=>{let E=[],L=[];return e.length+w.length>s?(L.push(`Maximum ${s} files allowed`),{valid:E,errors:L}):(w.forEach(T=>{if(T.size/1048576>r){L.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>T.type.match(H))){L.push(`${T.name} has invalid file type`);return}E.push(T);}),{valid:E,errors:L})},[e.length,s,r,o]),p=react.useCallback(async w=>{let{valid:E,errors:L}=k(w);if(L.length>0){l(L.join(", ")),setTimeout(()=>l(null),5e3);return}if(E.length!==0){i(true),l(null);try{await t?.(E);}catch(T){l(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[k,t]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),c(true);},[]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),c(false);},[]),h=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),y=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),c(false);let E=Array.from(w.dataTransfer.files);p(E);},[p]),C=react.useCallback(w=>{let E=w.target.files?Array.from(w.target.files):[];p(E),g.current&&(g.current.value="");},[p]),N=react.useCallback(()=>{g.current?.click();},[]),S=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:v,onDragLeave:b,onDragOver:h,onDrop:y,onClick:N,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?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"]})]})})]}),m&&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:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Qi(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>x(w,E),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Eb(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Sb(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>S(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function el({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],aiInsights:u=[],attachments:i=[],onAddComment:m,onDeleteComment:l,onUploadAttachments:g,onDeleteAttachment:f,onSuggestAssignee:x,onGenerateSubtasks:k,onEstimateEffort:p,currentUserId:v="user-1"}){let[b,h]=react.useState("details"),[y,C]=react.useState(false),[N,S]=react.useState({}),[w,E]=react.useState(""),[L,T]=react.useState(false),[z,H]=react.useState({});if(!t||!e)return null;let J=react.useCallback(()=>{C(false),S({}),h("details"),E(""),H({}),a();},[a]),D=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),S({}),C(false));},[e.id,N,r]),ve=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),J());},[e.id,o,J]),de=react.useCallback(()=>{m&&w.trim()&&(m(e.id,w.trim()),E(""));},[e.id,w,m]),V=react.useCallback(async()=>{if(x){T(true);try{let $=await x(e);H(ae=>({...ae,assignees:$}));}catch($){console.error("Failed to suggest assignee:",$);}finally{T(false);}}},[e,x]),I=react.useCallback(async()=>{if(k){T(true);try{let $=await k(e);H(ae=>({...ae,subtasks:$}));}catch($){console.error("Failed to generate subtasks:",$);}finally{T(false);}}},[e,k]),Te=react.useCallback(async()=>{if(p){T(true);try{let $=await p(e);H(ae=>({...ae,effort:$}));}catch($){console.error("Failed to estimate effort:",$);}finally{T(false);}}},[e,p]),Q={...e,...N},et=s.filter($=>Q.assignedUserIds?.includes($.id));return jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:J,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:$=>$.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:Q.priority==="URGENT"?"#EF4444":Q.priority==="HIGH"?"#F59E0B":Q.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),y?jsxRuntime.jsx("input",{type:"text",value:N.title??Q.title,onChange:$=>S({...N,title:$.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:Q.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:D,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{C(false),S({});},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:ve,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:J,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:()=>h("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>h("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),y?jsxRuntime.jsx("textarea",{value:N.description??Q.description??"",onChange:$=>S({...N,description:$.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:Q.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??Q.assignedUserIds??[],onChange:$=>{let ae=Array.from($.target.selectedOptions,Re=>Re.value);S({...N,assignedUserIds:ae});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map($=>jsxRuntime.jsx("option",{value:$.id,children:$.name},$.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:et.length>0?et.map($=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:$.color},children:$.initials}),jsxRuntime.jsx("span",{children:$.name})]},$.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"}),y?jsxRuntime.jsxs("select",{value:N.priority??Q.priority??"",onChange:$=>S({...N,priority:$.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:Q.priority==="URGENT"?"#EF4444":Q.priority==="HIGH"?"#F59E0B":Q.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:Q.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:Q.labels&&Q.labels.length>0?Q.labels.map($=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:$},$)):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"}),y?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:Q.startDate?new Date(Q.startDate).toISOString().split("T")[0]:"",onChange:$=>S({...N,startDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Q.startDate?new Date(Q.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:Q.endDate?new Date(Q.endDate).toISOString().split("T")[0]:"",onChange:$=>S({...N,endDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Q.endDate?new Date(Q.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??Q.estimatedTime??"",onChange:$=>S({...N,estimatedTime:$.target.value?parseFloat($.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:Q.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:Q.dependencies&&Q.dependencies.length>0?Q.dependencies.map($=>{let ae=typeof $=="string"?$:$.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ae.slice(-4)]},ae)}):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:Q.createdAt?new Date(Q.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:$=>E($.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:de,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map($=>{let ae=s.find(Re=>Re.id===$.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:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ae?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date($.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l($.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:$.content})]},$.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map($=>{let ae=s.find(Re=>Re.id===$.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("COMMENT")&&"\u{1F4AC}",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",$.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:ae?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Br,{cardId:e.id,attachments:i,onUpload:g?$=>g(e.id,$):void 0,onDelete:f,currentUserId:v,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:V,disabled:L||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:I,disabled:L||!k,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:Te,disabled:L||!p,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"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map(($,ae)=>{let Re=s.find(ke=>ke.id===$.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",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-ai-suggestion-name",children:Re?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:$.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",($.confidence*100).toFixed(0),"%"]})]})]},ae)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map(($,ae)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:$.title}),$.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:$.description}),$.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",$.estimatedTime,"h"]})]},ae))]}),z.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:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.map($=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${$.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:$.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:$.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:$.description}),$.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",$.suggestedAction]})]},$.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&u.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 Cn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[c,u]=react.useState({top:0,left:0}),i=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),g=window.innerHeight,f=window.innerWidth,x=4,k=l.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let p=g-l.bottom,v=l.top,b;return p>=s+x?b=l.bottom+x:v>=s+x?b=l.top-s-x:p>=v?b=l.bottom+x:b=Math.max(10,l.top-s-x),{top:b,left:k}},[e,o,s]);return react.useEffect(()=>{t&&u(m());},[t,m]),react.useEffect(()=>{if(!t)return;let l=f=>{let x=f.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.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 ot={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:"#FFFFFF",textSecondary:"#CCCCCC",textTertiary:"#888888",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.15)",taskBarPrimary:"#007AFF",taskBarProgress:"#007AFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#FF453A",criticalPathLight:"rgba(255, 69, 58, 0.2)",today:"#FF2E2E",todayLight:"rgba(255, 46, 46, 0.1)",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 10px rgba(255, 46, 46, 0.4)",executionBarBg:"rgba(0, 122, 255, 0.3)"},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:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#3B82F6",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:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},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"}};var Rb=["LOW","MEDIUM","HIGH","URGENT"],Ob=["todo","in-progress","review","done"];function rl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],onAddComment:u,onDeleteComment:i,currentUser:m,onAIGenerateDescription:l,onAICreateSubtasks:g,onAIFindSimilar:f,availableColumns:x=[],availableLabels:k=[],availableTags:p=[],onCreateTag:v,onUploadCoverImage:b,unsplashAccessKey:h,theme:y,onSubtasksChange:C,attachments:N=[],onUploadAttachments:S,onDeleteAttachment:w}){let E=Wo(),L=y||E?.themeName||"dark",[T,z]=react.useState(e),[H,J]=react.useState(false),[D,ve]=react.useState(()=>[...e?.subtasks||[]].sort((Z,ce)=>(Z.position??0)-(ce.position??0))),[de,V]=react.useState(false),[I,Te]=react.useState(""),[Q,et]=react.useState(""),[$,ae]=react.useState("all"),[Re,ke]=react.useState(false),[Ze,Ee]=react.useState(false),[ze,re]=react.useState(false),[K,q]=react.useState(false),[be,we]=react.useState(false),[Je,G]=react.useState(false),he=react.useRef(null),je=react.useRef(null),Ie=react.useRef(null),Ke=react.useRef(null),O=react.useRef(null),ne=react.useRef(null),X=react.useRef(null),Me=react.useRef(null),Ve=react.useRef(null),tt=react.useRef(null),rt=react.useRef(null),_e=react.useRef(null);react.useEffect(()=>{if(e&&!T){z({...e});let A=[...e.subtasks||[]].sort((Z,ce)=>(Z.position??0)-(ce.position??0));ve(A);}else if(e&&T&&e.id!==T.id){z({...e});let A=[...e.subtasks||[]].sort((Z,ce)=>(Z.position??0)-(ce.position??0));ve(A);}},[e,T]),react.useEffect(()=>{let A=Z=>{let ce=Z.target;Ke.current&&!Ke.current.contains(ce)&&ke(false),O.current&&!O.current.contains(ce)&&Ee(false),ne.current&&!ne.current.contains(ce)&&re(false),X.current&&!X.current.contains(ce)&&q(false);};if(Re||Ze||ze||K)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[Re,Ze,ze,K]),react.useEffect(()=>{if(!t)return;let A=Z=>{let ce=Z.target,He=ce.tagName==="INPUT"||ce.tagName==="TEXTAREA"||ce.isContentEditable;if(Z.key==="Escape"){Z.preventDefault(),Re||Ze||ze||K||be||Je?(ke(false),Ee(false),re(false),q(false),we(false),G(false)):He||a();return}if(He&&Z.key!=="Escape")return;let ue=Z.metaKey||Z.ctrlKey;switch(Z.key.toLowerCase()){case "s":Z.preventDefault(),ke(true);break;case "a":Z.preventDefault(),re(true);break;case "p":Z.preventDefault(),Ee(true);break;case "l":Z.preventDefault(),q(true);break;case "d":ue||(Z.preventDefault(),we(true),setTimeout(()=>Me.current?.focus(),0));break;case "e":ue||(Z.preventDefault(),G(true));break;case "i":Z.preventDefault(),J(true),setTimeout(()=>je.current?.focus(),0);break;case "t":Z.preventDefault(),V(true);break;case "c":Z.preventDefault(),Ie.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,Re,Ze,ze,K,be,Je]);let Nt=react.useCallback(A=>{let Z=A.currentTarget.textContent?.trim()||"";if(T&&Z!==T.title){let ce={...T,title:Z};z(ce),r?.(T.id,{title:Z});}},[T,r]),ht=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=T?.title||"",A.currentTarget.blur());},[T]),xt=react.useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),J(false);},[T,e,r]),yt=react.useCallback(A=>{if(T){let Z={...T,columnId:A};z(Z),r?.(T.id,{columnId:A}),ke(false);}},[T,r]),U=react.useCallback(A=>{if(T){let Z={...T,priority:A};z(Z),r?.(T.id,{priority:A}),Ee(false);}},[T,r]),Oe=react.useCallback(A=>{if(T){let Z=T.assignedUserIds||[],ce=Z.includes(A)?Z.filter(ue=>ue!==A):[...Z,A],He={...T,assignedUserIds:ce};z(He),r?.(T.id,{assignedUserIds:ce});}},[T,r]),Qe=react.useCallback(A=>{if(T){let Z=T.labels||[],ce=Z.includes(A)?Z.filter(ue=>ue!==A):[...Z,A],He={...T,labels:ce};z(He),r?.(T.id,{labels:ce});}},[T,r]),Ne=react.useCallback(A=>{if(T){let Z={...T,tags:A};z(Z),r?.(T.id,{tags:A});}},[T,r]),$e=react.useCallback(A=>{if(T){let Z=A.target.value,ce={...T,endDate:Z};z(ce),r?.(T.id,{endDate:Z}),we(false);}},[T,r]),me=react.useCallback(A=>{if(T){let Z={...T,estimatedTime:parseFloat(A)||0};z(Z),r?.(T.id,{estimatedTime:parseFloat(A)||0});}},[T,r]),R=react.useCallback(()=>{if(I.trim()&&T){let A={id:`subtask-${Date.now()}`,title:I.trim(),completed:false,position:D.length,createdAt:new Date},Z=[...D,A];ve(Z),Te(""),V(false),C?.(T.id,Z);}},[I,D,T,C]),j=react.useCallback(A=>{let Z=D.map(ce=>ce.id===A?{...ce,completed:!ce.completed,updatedAt:new Date}:ce);ve(Z),T&&C?.(T.id,Z);},[D,T,C]),Be=react.useCallback(A=>{let Z=D.filter(ce=>ce.id!==A);ve(Z),T&&C?.(T.id,Z);},[D,T,C]),De=react.useCallback(()=>{Q.trim()&&T&&u&&(u(T.id,Q.trim()),et(""));},[Q,T,u]),fe=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),De());},[De]),Ce=A=>jsxRuntime.jsx(Lb__default.default,{remarkPlugins:[Ib__default.default],rehypePlugins:[Bb__default.default],components:{a:({node:Z,...ce})=>jsxRuntime.jsx("a",{...ce,target:"_blank",rel:"noopener noreferrer"})},children:A}),ee=c.filter(A=>$==="comments"?A.type.includes("COMMENT"):$==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let B=T||e,_=s.filter(A=>B.assignedUserIds?.includes(A.id)),Pe=D.filter(A=>A.completed).length;return jsxRuntime.jsx(Pt,{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":L,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:he,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Nt,onKeyDown:ht,children:B.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ke,children:[jsxRuntime.jsxs("button",{ref:Ve,className:"modal-v2-field",onClick:()=>ke(!Re),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:B.columnId||"No status"})]}),jsxRuntime.jsx(Cn,{triggerRef:Ve,isOpen:Re,onClose:()=>ke(false),width:250,estimatedHeight:200,children:(x.length>0?x:Ob.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${B.columnId===A.id?"active":""}`,onClick:()=>yt(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:tt,className:"modal-v2-field",onClick:()=>re(!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:_.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:_.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(Cn,{triggerRef:tt,isOpen:ze,onClose:()=>re(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${B.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>Oe(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,B.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:O,children:[jsxRuntime.jsxs("button",{ref:rt,className:"modal-v2-field",onClick:()=>Ee(!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:"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:B.priority||"None"})]}),jsxRuntime.jsxs(Cn,{triggerRef:rt,isOpen:Ze,onClose:()=>Ee(false),width:180,estimatedHeight:220,children:[Rb.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${B.priority===A?"active":""}`,onClick:()=>U(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>U(""),children:"None"})]})]}),p.length>0||v?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(Zr,{selectedTags:B.tags||[],availableTags:p,onChange:Ne,onCreateTag:v,theme:ot[L]||ot.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:X,children:[jsxRuntime.jsxs("button",{ref:_e,className:"modal-v2-field",onClick:()=>q(!K),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:B.labels&&B.labels.length>0?jsxRuntime.jsx("span",{children:B.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Cn,{triggerRef:_e,isOpen:K,onClose:()=>q(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${B.labels?.includes(A)?"active":""}`,onClick:()=>Qe(A),children:[A,B.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:()=>{we(!be),setTimeout(()=>Me.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:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Me,type:"date",value:typeof B.endDate=="string"?B.endDate.split("T")[0]:B.endDate?(()=>{let A=new Date(B.endDate),Z=A.getUTCFullYear(),ce=String(A.getUTCMonth()+1).padStart(2,"0"),He=String(A.getUTCDate()).padStart(2,"0");return `${Z}-${ce}-${He}`})():"",onChange:$e,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>G(!Je),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:B.estimatedTime?`${B.estimatedTime}h`:"Not set"})]}),Je&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:B.estimatedTime||"",onChange:A=>me(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>G(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"})]}),H?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:B.description||"",onChange:A=>{if(T){let Z={...T,description:A.target.value};z(Z);}},onBlur:xt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>J(true),children:B.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ce(B.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"}),D.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Pe,"/",D.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>V(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:[D.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>j(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:()=>Be(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)),de&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:I,onChange:A=>Te(A.target.value),onKeyDown:A=>{A.key==="Enter"&&R(),A.key==="Escape"&&(V(false),Te(""));},onBlur:R,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(S||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(Br,{cardId:B.id,attachments:N,onUpload:S?A=>S(B.id,A):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="all"?"active":""}`,onClick:()=>ae("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="comments"?"active":""}`,onClick:()=>ae("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="history"?"active":""}`,onClick:()=>ae("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Ie,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Q,onChange:A=>et(A.target.value),onKeyDown:fe,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:De,disabled:!Q.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ee.map(A=>{let Z=s.find(He=>He.id===A.userId);if(A.type.includes("COMMENT")){let He=n.find(ue=>ue.id===A.metadata?.commentId);return He?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Z&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Z.color},children:Z.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:Z?.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:He.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:Z?.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)}),ee.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 jb({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 nl({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((c,u)=>c+u.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(jb,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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,c)=>n+c.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,c)=>n+c.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:"#3B82F6"},children:e.reduce((n,c)=>n+(c.planned||0),0)})]})]})]})}function th({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 sl({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,c=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=c;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(th,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ch={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Eu=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function uh({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,c=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:u,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Mu({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 il({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||ch[u.name]||Eu[e.indexOf(u)%Eu.length]})),c=n.map(u=>u.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?uh:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Mu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let m=i.payload,l=s>0?(m.value/s*100).toFixed(0):"0";return `${u} (${m.value} - ${l}%)`}})]}):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(Mu,{})}),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((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var Cs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,c]=react.useState(false),[u,i]=react.useState(false),[m,l]=react.useState(false),[g,f]=react.useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),k=y=>{r.onBulkUpdate?.(x,{priority:y}),c(false);},p=y=>{r.onBulkMove?.(x,y),i(false),a();},v=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),l(false);},b=y=>{let C=new Set;e.forEach(S=>{S.labels?.forEach(w=>C.add(w));});let N=Array.from(new Set([...C,...y]));r.onBulkUpdate?.(x,{labels:N}),f(false);},h=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),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:()=>c(!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(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(y),children:[jsxRuntime.jsx("span",{className:d("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>p(y.id),children:y.title},y.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([y.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([y]),children:y},y))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:h,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"})})]})]})})});Cs.displayName="BulkOperationsToolbar";function bh(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,c,u,i;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(f=>{let x=a?.find(k=>k.id===f);n=`assignee-${f}`,c=x?.name||`User ${f}`,u=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:c,groupValue:f,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",c="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={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];c=g.title,u=g.color,r.has(n)||r.set(n,{id:n,title:c,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,c=f,u="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:f,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",c="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ll({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),c=react.useMemo(()=>bh(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(m=>{let l=new Set(m);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(eo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:d("asakaa-swimlane-view",o),children:[c.map(i=>{let m=s.has(i.id),l=e.cards.filter(f=>i.cardIds.includes(f.id)),g={...e,cards:l};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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(eo,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),c.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 dl=[{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 cl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),c=dl.find(i=>i.value===e)||dl[0];react.useEffect(()=>{function i(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:d("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:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:d("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:dl.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:d("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Tn=[{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 xh(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&c&&u}function Iu(e={}){let{shortcuts:t=Tn,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(u=>{o.current=[...o.current,u];},[]),c=react.useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return react.useEffect(()=>{function u(i){if(!s.current)return;let m=i.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(xh(i,l)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:c,isEnabled:a}}function kh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function wh(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 Ch(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=wh(e),r=t?kh(t):"";return a?`${a} + ${r}`:r}function Th(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 ul({shortcuts:e=Tn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let n=Th(e);return jsxRuntime.jsxs("div",{className:d("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(([c,u])=>u.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"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:u.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Ch(i)})]},i.action))})]},c))})}),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 ml=[{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
+ `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(p),n.appendChild(f);}n.appendChild(l),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function X0(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 J0(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 Hi(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[u,i]=react.useState(false),[c,d]=react.useState(null),p=react.useRef(null),f=react.useRef(e);f.current=e;let v=react.useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let F=f.current.filter(A=>Hi(A.type)),T=F.findIndex(A=>A.id===w.id),H=A=>{let ie=f.current.filter(j=>Hi(j.type)),S=ie[A];S&&ru(S.url,S.name,ie,A,H);};ru(w.url,w.name,F,T,H);},[]),k=react.useCallback(w=>{let R=[],F=[];return e.length+w.length>s?(F.push(`Maximum ${s} files allowed`),{valid:R,errors:F}):(w.forEach(T=>{if(T.size/1048576>r){F.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(A=>T.type.match(A))){F.push(`${T.name} has invalid file type`);return}R.push(T);}),{valid:R,errors:F})},[e.length,s,r,o]),g=react.useCallback(async w=>{let{valid:R,errors:F}=k(w);if(F.length>0){d(F.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(T){d(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),y=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),h=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let R=Array.from(w.dataTransfer.files);g(R);},[g]),D=react.useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];g(R),p.current&&(p.current.value="");},[g]),N=react.useCallback(()=>{p.current?.click();},[]),C=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:N,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?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"]})]})})]}),c&&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:c})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Hi(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>v(w,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:J0(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:X0(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>C(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function Wi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:f,onSuggestAssignee:v,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=react.useState("details"),[x,D]=react.useState(false),[N,C]=react.useState({}),[w,R]=react.useState(""),[F,T]=react.useState(false),[H,A]=react.useState({});if(!t||!e)return null;let ie=react.useCallback(()=>{D(false),C({}),b("details"),R(""),A({}),a();},[a]),S=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),C({}),D(false));},[e.id,N,r]),j=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ie());},[e.id,o,ie]),le=react.useCallback(()=>{c&&w.trim()&&(c(e.id,w.trim()),R(""));},[e.id,w,c]),Le=react.useCallback(async()=>{if(v){T(true);try{let B=await v(e);A(ee=>({...ee,assignees:B}));}catch(B){console.error("Failed to suggest assignee:",B);}finally{T(false);}}},[e,v]),L=react.useCallback(async()=>{if(k){T(true);try{let B=await k(e);A(ee=>({...ee,subtasks:B}));}catch(B){console.error("Failed to generate subtasks:",B);}finally{T(false);}}},[e,k]),fe=react.useCallback(async()=>{if(g){T(true);try{let B=await g(e);A(ee=>({...ee,effort:B}));}catch(B){console.error("Failed to estimate effort:",B);}finally{T(false);}}},[e,g]),Q={...e,...N},qe=s.filter(B=>Q.assignedUserIds?.includes(B.id));return jsxRuntime.jsx(wt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:ie,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:B=>B.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:Q.priority==="URGENT"?"#EF4444":Q.priority==="HIGH"?"#F59E0B":Q.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:N.title??Q.title,onChange:B=>C({...N,title:B.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:Q.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),C({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick: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:ie,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:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:N.description??Q.description??"",onChange:B=>C({...N,description:B.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:Q.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:N.assignedUserIds??Q.assignedUserIds??[],onChange:B=>{let ee=Array.from(B.target.selectedOptions,we=>we.value);C({...N,assignedUserIds:ee});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(B=>jsxRuntime.jsx("option",{value:B.id,children:B.name},B.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:qe.length>0?qe.map(B=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:B.color},children:B.initials}),jsxRuntime.jsx("span",{children:B.name})]},B.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:N.priority??Q.priority??"",onChange:B=>C({...N,priority:B.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:Q.priority==="URGENT"?"#EF4444":Q.priority==="HIGH"?"#F59E0B":Q.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:Q.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:Q.labels&&Q.labels.length>0?Q.labels.map(B=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:B},B)):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:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:Q.startDate?new Date(Q.startDate).toISOString().split("T")[0]:"",onChange:B=>C({...N,startDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Q.startDate?new Date(Q.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:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:Q.endDate?new Date(Q.endDate).toISOString().split("T")[0]:"",onChange:B=>C({...N,endDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Q.endDate?new Date(Q.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:N.estimatedTime??Q.estimatedTime??"",onChange:B=>C({...N,estimatedTime:B.target.value?parseFloat(B.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:Q.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:Q.dependencies&&Q.dependencies.length>0?Q.dependencies.map(B=>{let ee=typeof B=="string"?B:B.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ee.slice(-4)]},ee)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:Q.createdAt?new Date(Q.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:B=>R(B.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:le,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(B=>{let ee=s.find(we=>we.id===B.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ee?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(B.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(B.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:B.content})]},B.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(B=>{let ee=s.find(we=>we.id===B.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[B.type.includes("CREATED")&&"\u2795",B.type.includes("UPDATED")&&"\u270F\uFE0F",B.type.includes("MOVED")&&"\u27A1\uFE0F",B.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",B.type.includes("COMMENT")&&"\u{1F4AC}",B.type.includes("ASSIGNED")&&"\u{1F464}",B.type.includes("PRIORITY")&&"\u{1F3AF}",B.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",B.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:ee?.name||"Unknown"})," ",B.type.replace(/_/g," ").toLowerCase(),B.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:B.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(B.timestamp).toLocaleString()})]})]},B.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Er,{cardId:e.id,attachments:i,onUpload:p?B=>p(e.id,B):void 0,onDelete:f,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Le,disabled:F||!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("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:L,disabled:F||!k,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:fe,disabled:F||!g,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"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((B,ee)=>{let we=s.find(he=>he.id===B.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[we&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:we.color},children:we.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:we?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:B.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(B.confidence*100).toFixed(0),"%"]})]})]},ee)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((B,ee)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:B.title}),B.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:B.description}),B.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",B.estimatedTime,"h"]})]},ee))]}),H.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:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.map(B=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${B.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:B.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:B.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:B.description}),B.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",B.suggestedAction]})]},B.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&u.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[l,u]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,f=window.innerWidth,v=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=p-d.bottom,y=d.top,h;return g>=s+v?h=d.bottom+v:y>=s+v?h=d.top-s-v:g>=y?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:k}},[e,o,s]);return react.useEffect(()=>{t&&u(c());},[t,c]),react.useEffect(()=>{if(!t)return;let d=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(wt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var st={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#60A5FA",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},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:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#3B82F6",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:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},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"}};var nh=["LOW","MEDIUM","HIGH","URGENT"],sh=["todo","in-progress","review","done"];function _i({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:f,availableColumns:v=[],availableLabels:k=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:D,attachments:N=[],onUploadAttachments:C,onDeleteAttachment:w}){let R=Bo(),F=x||R?.themeName||"dark",[T,H]=react.useState(e),[A,ie]=react.useState(false),[S,j]=react.useState(()=>[...e?.subtasks||[]].sort((te,Ie)=>(te.position??0)-(Ie.position??0))),[le,Le]=react.useState(false),[L,fe]=react.useState(""),[Q,qe]=react.useState(""),[B,ee]=react.useState("all"),[we,he]=react.useState(false),[We,ke]=react.useState(false),[je,ae]=react.useState(false),[G,q]=react.useState(false),[me,Ne]=react.useState(false),[Xe,U]=react.useState(false),De=react.useRef(null),Me=react.useRef(null),Ae=react.useRef(null),X=react.useRef(null),I=react.useRef(null),K=react.useRef(null),de=react.useRef(null),Se=react.useRef(null),Ke=react.useRef(null),ot=react.useRef(null),ct=react.useRef(null),Ye=react.useRef(null);react.useEffect(()=>{if(e&&!T){H({...e});let z=[...e.subtasks||[]].sort((te,Ie)=>(te.position??0)-(Ie.position??0));j(z);}else if(e&&T&&e.id!==T.id){H({...e});let z=[...e.subtasks||[]].sort((te,Ie)=>(te.position??0)-(Ie.position??0));j(z);}},[e,T]),react.useEffect(()=>{let z=te=>{let Ie=te.target;X.current&&!X.current.contains(Ie)&&he(false),I.current&&!I.current.contains(Ie)&&ke(false),K.current&&!K.current.contains(Ie)&&ae(false),de.current&&!de.current.contains(Ie)&&q(false);};if(we||We||je||G)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[we,We,je,G]),react.useEffect(()=>{if(!t)return;let z=te=>{let Ie=te.target,dt=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.isContentEditable;if(te.key==="Escape"){te.preventDefault(),we||We||je||G||me||Xe?(he(false),ke(false),ae(false),q(false),Ne(false),U(false)):dt||a();return}if(dt&&te.key!=="Escape")return;let Qe=te.metaKey||te.ctrlKey;switch(te.key.toLowerCase()){case "s":te.preventDefault(),he(true);break;case "a":te.preventDefault(),ae(true);break;case "p":te.preventDefault(),ke(true);break;case "l":te.preventDefault(),q(true);break;case "d":Qe||(te.preventDefault(),Ne(true),setTimeout(()=>Se.current?.focus(),0));break;case "e":Qe||(te.preventDefault(),U(true));break;case "i":te.preventDefault(),ie(true),setTimeout(()=>Me.current?.focus(),0);break;case "t":te.preventDefault(),Le(true);break;case "c":te.preventDefault(),Ae.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,we,We,je,G,me,Xe]);let sa=react.useCallback(z=>{let te=z.currentTarget.textContent?.trim()||"";if(T&&te!==T.title){let Ie={...T,title:te};H(Ie),r?.(T.id,{title:te});}},[T,r]),_=react.useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=T?.title||"",z.currentTarget.blur());},[T]),Y=react.useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),ie(false);},[T,e,r]),ge=react.useCallback(z=>{if(T){let te={...T,columnId:z};H(te),r?.(T.id,{columnId:z}),he(false);}},[T,r]),et=react.useCallback(z=>{if(T){let te={...T,priority:z};H(te),r?.(T.id,{priority:z}),ke(false);}},[T,r]),Ee=react.useCallback(z=>{if(T){let te=T.assignedUserIds||[],Ie=te.includes(z)?te.filter(Qe=>Qe!==z):[...te,z],dt={...T,assignedUserIds:Ie};H(dt),r?.(T.id,{assignedUserIds:Ie});}},[T,r]),Oe=react.useCallback(z=>{if(T){let te=T.labels||[],Ie=te.includes(z)?te.filter(Qe=>Qe!==z):[...te,z],dt={...T,labels:Ie};H(dt),r?.(T.id,{labels:Ie});}},[T,r]),oe=react.useCallback(z=>{if(T){let te={...T,tags:z};H(te),r?.(T.id,{tags:z});}},[T,r]),ye=react.useCallback(z=>{if(T){let te=z.target.value,Ie={...T,endDate:te};H(Ie),r?.(T.id,{endDate:te}),Ne(false);}},[T,r]),$=react.useCallback(z=>{if(T){let te={...T,estimatedTime:parseFloat(z)||0};H(te),r?.(T.id,{estimatedTime:parseFloat(z)||0});}},[T,r]),ne=react.useCallback(()=>{if(L.trim()&&T){let z={id:`subtask-${Date.now()}`,title:L.trim(),completed:false,position:S.length,createdAt:new Date},te=[...S,z];j(te),fe(""),Le(false),D?.(T.id,te);}},[L,S,T,D]),$e=react.useCallback(z=>{let te=S.map(Ie=>Ie.id===z?{...Ie,completed:!Ie.completed,updatedAt:new Date}:Ie);j(te),T&&D?.(T.id,te);},[S,T,D]),Ze=react.useCallback(z=>{let te=S.filter(Ie=>Ie.id!==z);j(te),T&&D?.(T.id,te);},[S,T,D]),at=react.useCallback(()=>{Q.trim()&&T&&u&&(u(T.id,Q.trim()),qe(""));},[Q,T,u]),Ve=react.useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),at());},[at]),ve=z=>jsxRuntime.jsx(ah__default.default,{remarkPlugins:[rh__default.default],rehypePlugins:[oh__default.default],components:{a:({node:te,...Ie})=>jsxRuntime.jsx("a",{...Ie,target:"_blank",rel:"noopener noreferrer"})},children:z}),He=l.filter(z=>B==="comments"?z.type.includes("COMMENT"):B==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let W=T||e,ce=s.filter(z=>W.assignedUserIds?.includes(z.id)),vt=S.filter(z=>z.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:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":F,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:De,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:_,children:W.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:X,children:[jsxRuntime.jsxs("button",{ref:Ke,className:"modal-v2-field",onClick:()=>he(!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("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:W.columnId||"No status"})]}),jsxRuntime.jsx(yn,{triggerRef:Ke,isOpen:we,onClose:()=>he(false),width:250,estimatedHeight:200,children:(v.length>0?v:sh.map(z=>({id:z,title:z}))).map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${W.columnId===z.id?"active":""}`,onClick:()=>ge(z.id),children:z.title},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:K,children:[jsxRuntime.jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>ae(!je),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:ce.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ce.map(z=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:z.color},title:z.name,children:z.initials},z.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(yn,{triggerRef:ot,isOpen:je,onClose:()=>ae(false),width:280,estimatedHeight:300,children:s.map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${W.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>Ee(z.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,W.assignedUserIds?.includes(z.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"})})]},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:I,children:[jsxRuntime.jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>ke(!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:W.priority||"None"})]}),jsxRuntime.jsxs(yn,{triggerRef:ct,isOpen:We,onClose:()=>ke(false),width:180,estimatedHeight:220,children:[nh.map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${W.priority===z?"active":""}`,onClick:()=>et(z),children:z},z)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>et(""),children:"None"})]})]}),g.length>0||y?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(Kr,{selectedTags:W.tags||[],availableTags:g,onChange:oe,onCreateTag:y,theme:st[F]||st.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxRuntime.jsxs("button",{ref:Ye,className:"modal-v2-field",onClick:()=>q(!G),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:W.labels&&W.labels.length>0?jsxRuntime.jsx("span",{children:W.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(yn,{triggerRef:Ye,isOpen:G,onClose:()=>q(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${W.labels?.includes(z)?"active":""}`,onClick:()=>Oe(z),children:[z,W.labels?.includes(z)&&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"})})]},z))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Ne(!me),setTimeout(()=>Se.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:W.endDate?new Date(W.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Se,type:"date",value:typeof W.endDate=="string"?W.endDate.split("T")[0]:W.endDate?(()=>{let z=new Date(W.endDate),te=z.getUTCFullYear(),Ie=String(z.getUTCMonth()+1).padStart(2,"0"),dt=String(z.getUTCDate()).padStart(2,"0");return `${te}-${Ie}-${dt}`})():"",onChange:ye,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>U(!Xe),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:W.estimatedTime?`${W.estimatedTime}h`:"Not set"})]}),Xe&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:W.estimatedTime||"",onChange:z=>$(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>U(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"})]}),A?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:W.description||"",onChange:z=>{if(T){let te={...T,description:z.target.value};H(te);}},onBlur:Y,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>ie(true),children:W.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:ve(W.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"}),S.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[vt,"/",S.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Le(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:[S.map(z=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>$e(z.id),children:z.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:z.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ze(z.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"})]})})]},z.id)),le&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:L,onChange:z=>fe(z.target.value),onKeyDown:z=>{z.key==="Enter"&&ne(),z.key==="Escape"&&(Le(false),fe(""));},onBlur:ne,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(C||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(Er,{cardId:W.id,attachments:N,onUpload:C?z=>C(W.id,z):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${B==="all"?"active":""}`,onClick:()=>ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${B==="comments"?"active":""}`,onClick:()=>ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${B==="history"?"active":""}`,onClick:()=>ee("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Ae,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Q,onChange:z=>qe(z.target.value),onKeyDown:Ve,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:at,disabled:!Q.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[He.map(z=>{let te=s.find(dt=>dt.id===z.userId);if(z.type.includes("COMMENT")){let dt=n.find(Qe=>Qe.id===z.metadata?.commentId);return dt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[te&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:te.color},children:te.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:te?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:dt.content})]})]},z.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.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:te?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)}),He.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 fh({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 Ki({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,u)=>l+u.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(fh,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Th({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 qi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Th,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Lh={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},mu=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ih({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:u,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function pu({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 Yi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||Lh[u.name]||mu[e.indexOf(u)%mu.length]})),l=n.map(u=>u.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?Ih:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(pu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.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(pu,{})}),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((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var gs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[u,i]=react.useState(false),[c,d]=react.useState(false),[p,f]=react.useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),k=x=>{r.onBulkUpdate?.(v,{priority:x}),l(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),d(false);},h=x=>{let D=new Set;e.forEach(C=>{C.labels?.forEach(w=>D.add(w));});let N=Array.from(new Set([...D,...x]));r.onBulkUpdate?.(v,{labels:N}),f(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(x),children:[jsxRuntime.jsx("span",{className:m("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:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(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(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([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:()=>f(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});gs.displayName="BulkOperationsToolbar";function Uh(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let v=a?.find(k=>k.id===f);n=`assignee-${f}`,l=v?.name||`User ${f}`,u=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,u=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Xi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Uh(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Yr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),p={...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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Yr,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Ji=[{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 Zi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=Ji.find(i=>i.value===e)||Ji[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:m("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:m("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:Ji.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:m("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var vn=[{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 Wh(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&l&&u}function yu(e={}){let{shortcuts:t=vn,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(u=>{o.current=[...o.current,u];},[]),l=react.useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return react.useEffect(()=>{function u(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Wh(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Vh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function _h(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 jh(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=_h(e),r=t?Vh(t):"";return a?`${a} + ${r}`:r}function Kh(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 Qi({shortcuts:e=vn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Kh(e);return jsxRuntime.jsxs("div",{className:m("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,u])=>u.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:u.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:jh(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var el=[{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,48 +122,48 @@
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function pl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);},u=e.reduce((i,m)=>{let l=m.category||"Other";return i[l]||(i[l]=[]),i[l].push(m),i},{});return jsxRuntime.jsxs("div",{className:d("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:d("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(u).map(([i,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:m.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.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:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function fl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,c]=react.useState("export"),[u,i]=react.useState("json"),[m,l]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,p=await lc(e,u,k);dc(p,u);},x=async k=>{let p=k.target.files?.[0];if(p){try{let v=await mc(p),b=p.name.endsWith(".json")?"json":"csv",h=uc(v,b);l(h),h.success&&r&&r(h,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:d("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:()=>c("export"),className:d("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:()=>c("import"),className:d("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(k=>jsxRuntime.jsxs("button",{onClick:()=>i(k),className:d("p-4 rounded-lg border-2 transition-all text-center",u===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,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:g,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.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"})]})]}),m&&jsxRuntime.jsxs("div",{className:d("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:d("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((k,p)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},p))})]})]})]})]})]})}var Mh=["URGENT","HIGH","MEDIUM","LOW"],Ph=[{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"}],Fh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function bl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:c,availableUsers:u=[],availableLabels:i=[],availableColumns:m=[],showQuickFilters:l=true,compact:g=false,groupBy:f="none",onGroupByChange:x}){let[k,p]=react.useState(true),v=react.useCallback(N=>{a({search:N.target.value});},[a]),b=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),h=react.useCallback(N=>{r({by:N.target.value});},[r]),y=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 ${g?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>p(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"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)"]})]}),!k&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&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"}),c&&jsxRuntime.jsx("button",{onClick:c,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let S=N.target.value;a({priorities:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Mh.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let S=N.target.value;a({assignees:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let S=N.target.value;a({labels:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:h,className:"filter-bar__select filter-bar__select--sm",children:Ph.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:N=>x(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fh.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),C&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function hl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:c,onExportGanttCSV:u}){let[i,m]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let f=x=>{l.current&&!l.current.contains(x.target)&&m(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let g=f=>{f(),m(false);};return jsxRuntime.jsxs("div",{className:d("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>g(async()=>await 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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>g(()=>u?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 yl={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:"#3B82F6",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"}},xl={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:"#2563EB",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"}},vl={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"}},Eo={dark:yl,light:xl,neutral:vl},Ns="dark";var Ds=react.createContext(void 0),zh="asakaa-theme";function Ou({children:e,defaultTheme:t=Ns,storageKey:a=zh}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,u=Eo[r];Object.entries(u.colors).forEach(([m,l])=>{l&&c.style.setProperty(`--theme-${Wh(m)}`,l);}),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(([m,l])=>{let g=u.colors[m];g&&c.style.setProperty(l,g);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Eo};return jsxRuntime.jsx(Ds.Provider,{value:n,children:e})}function Zo(){let e=react.useContext(Ds);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wh(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function kl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Zo();return e?jsxRuntime.jsxs("div",{className:d("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(Eo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:d("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 $u(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ot[e]||ot.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ot[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ot[e].bgSecondary),bgGrid:r("--theme-bg-card",ot[e].bgGrid),bgWeekend:r("--theme-bg-hover",ot[e].bgWeekend),border:r("--theme-border-primary",ot[e].border),borderLight:r("--theme-border-subtle",ot[e].borderLight),textPrimary:r("--theme-text-primary",ot[e].textPrimary),textSecondary:r("--theme-text-secondary",ot[e].textSecondary),textTertiary:r("--theme-text-tertiary",ot[e].textTertiary),accent:r("--theme-accent-primary",ot[e].accent),accentHover:r("--theme-accent-hover",ot[e].accentHover),accentLight:r("--theme-accent-primary",ot[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ot[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ot[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ot[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ot[e].dependency),dependencyHover:r("--theme-border-secondary",ot[e].dependencyHover),criticalPath:r("--theme-error",ot[e].criticalPath),criticalPathLight:r("--theme-error",ot[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ot[e].today):e==="neutral"?r("--theme-text-primary",ot[e].today):r("--theme-error",ot[e].today),todayLight:e==="light"?r("--theme-accent-primary",ot[e].todayLight):e==="neutral"?r("--theme-text-primary",ot[e].todayLight):r("--theme-error",ot[e].todayLight),milestone:r("--theme-warning",ot[e].milestone),milestoneLight:r("--theme-warning",ot[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ot[e].statusTodo),statusInProgress:r("--theme-accent-primary",ot[e].statusInProgress),statusCompleted:r("--theme-success",ot[e].statusCompleted),hoverBg:r("--theme-bg-hover",ot[e].hoverBg),focusRing:r("--theme-accent-primary",ot[e].focusRing),...ot[e].dotGrid&&{dotGrid:ot[e].dotGrid},...ot[e].glassHeader&&{glassHeader:ot[e].glassHeader},...ot[e].glassToolbar&&{glassToolbar:ot[e].glassToolbar},...ot[e].forecastHud&&{forecastHud:ot[e].forecastHud},...ot[e].neonRedGlow&&{neonRedGlow:ot[e].neonRedGlow},...ot[e].executionBarBg&&{executionBarBg:ot[e].executionBarBg}}}var Ss={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"},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"}},Hu={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"},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"}},wl={en:Ss,es:Hu};function Uu(e){return wl[e]||wl.en}function Cl(e,t){let a=Uu(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 en=react.createContext(Ss);function no(){return react.useContext(en)}function Vu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[c,u]=react.useState(false),[i,m]=react.useState(null),l=react.useRef(null),g=no();if(react.useEffect(()=>{let p=v=>{l.current&&!l.current.contains(v.target)&&u(false);};return c&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]),!(t||a||r||o||s||n))return null;let x=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),k=async(p,v)=>{if(v){m(p);try{await v();}catch(b){console.error(`Export ${p} failed:`,b);}finally{m(null),u(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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: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:x.map((p,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(p.id,p.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:v<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===p.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"})}):p.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:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function my({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-xs 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 py({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-xs 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 _u({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=no();react.useEffect(()=>{let i=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=c.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${u}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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 left-0 mt-2 w-36 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:c.map((i,m)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function ju({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),c=react.useRef(null),u=no();react.useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let f=k=>{c.current&&!c.current.contains(k.target)&&n(false);},x=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",x),c._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(g),c._cleanup&&c._cleanup();}},[s]);let i=[{value:"all",label:u.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:u.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:u.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:u.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g=>{g.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#3B82F6":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:u.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:u.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(g=>{let f=t===g.value&&!r,x=()=>g.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(g.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?g.color:"text-gray-400"} flex-shrink-0`,children:x()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:g.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},g.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:u.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function gy({value:e,onChange:t}){return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:"#000000",border:"1px solid rgba(255,255,255,0.1)"},children:[{value:"day",label:"D"},{value:"week",label:"W"},{value:"month",label:"M"}].map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(r.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:o?"#FFFFFF":"#666666",fontFamily:"'JetBrains Mono', monospace",backgroundColor:o?"rgba(255,255,255,0.1)":"transparent"},whileHover:{color:"#FFFFFF"},whileTap:{scale:.95},children:r.label},r.value)})})}function fy({theme:e}){return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||"rgba(15,15,15,0.9)",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:"#666666",fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:"PROJECT FORECAST"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:"#FFFFFF",fontFamily:"Inter, sans-serif"},children:"Expected Finish: Nov 28"}),jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:"rgba(255,46,46,0.15)",color:"#FF453A",fontFamily:"'JetBrains Mono', monospace"},children:"+12d Delay"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:"#888888",fontFamily:"Inter, sans-serif"},children:"Confidence:"}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:"#F59E0B",fontFamily:"'JetBrains Mono', monospace"},children:"62%"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:"rgba(255,255,255,0.08)"}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:"#888888",fontFamily:"Inter, sans-serif"},children:"Cost at Completion:"}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:"#FFFFFF",fontFamily:"'JetBrains Mono', monospace"},children:"$1.42M"}),jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:"rgba(255,46,46,0.15)",color:"#FF453A",fontFamily:"'JetBrains Mono', monospace"},children:"+15% Over"})]})]})]})}function Ps({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:c,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:m=false,createTaskLabel:l,onCreateTask:g,taskFilter:f="all",onTaskFilterChange:x,hideCompleted:k=false,onHideCompletedChange:p,onExportPNG:v,onExportPDF:b,onExportExcel:h,onExportCSV:y,onExportJSON:C,onExportMSProject:N}){let S=no(),w=v||b||h||y||C||N,E=!!e.glassToolbar,[L,T]=react.useState(false),z=react.useRef(null);react.useEffect(()=>{L&&z.current&&z.current.focus();},[L]);let H=[{value:"day",label:S.toolbar.day},{value:"week",label:S.toolbar.week},{value:"month",label:S.toolbar.month}],J=[{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"})}];return E?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:"#1A1A1A",border:"1px solid rgba(255,255,255,0.08)"},animate:{width:L?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T(!L),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:"#888888"},whileHover:{color:"#FFFFFF"},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),L&&jsxRuntime.jsx("input",{ref:z,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-xs pr-3 w-full",style:{color:"#FFFFFF",fontFamily:"Inter, sans-serif"},onBlur:()=>T(false),onKeyDown:D=>{D.key==="Escape"&&T(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:"rgba(255,255,255,0.08)"}}),jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:"#000000",border:"1px solid rgba(255,255,255,0.1)"},children:[jsxRuntime.jsx(framerMotion.motion.button,{className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:"rgba(255,255,255,0.1)",color:"#FFFFFF",fontFamily:"Inter, sans-serif"},children:"Execution"}),jsxRuntime.jsx(framerMotion.motion.button,{className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:"transparent",color:"#666666",fontFamily:"Inter, sans-serif"},whileHover:{color:"#AAAAAA"},children:"Oracle View"})]})]}),m&&g&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs",style:{background:"linear-gradient(135deg, #2E94FF 0%, #007AFF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(46,148,255,0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(46,148,255,0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||S.toolbar.createTask})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(gy,{value:t,onChange:a}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:"rgba(255,255,255,0.08)"}}),jsxRuntime.jsx(_u,{theme:e,value:c,onChange:u}),x&&jsxRuntime.jsx(ju,{theme:e,value:f,onChange:x,hideCompleted:k,onHideCompletedChange:p}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:"rgba(255,255,255,0.08)"}}),jsxRuntime.jsx(framerMotion.motion.button,{className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:"#888888",backgroundColor:"transparent"},whileHover:{color:"#FFFFFF",backgroundColor:"rgba(255,255,255,0.06)"},title:"Visibility",children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.motion.button,{className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:"#888888",backgroundColor:"transparent"},whileHover:{color:"#FFFFFF",backgroundColor:"rgba(255,255,255,0.06)"},title:"Share",children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),w&&jsxRuntime.jsx(Vu,{theme:e,onExportPNG:v,onExportPDF:b,onExportExcel:h,onExportCSV:y,onExportJSON:C,onExportMSProject:N}),jsxRuntime.jsxs(framerMotion.motion.button,{className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-[11px] font-medium",style:{backgroundColor:"transparent",border:"1px solid rgba(168,85,247,0.4)",color:"#A855F7",fontFamily:"Inter, sans-serif",background:"linear-gradient(135deg, rgba(168,85,247,0.1) 0%, rgba(139,92,246,0.05) 100%)"},whileHover:{borderColor:"rgba(168,85,247,0.7)",boxShadow:"0 0 12px rgba(168,85,247,0.2)"},children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Simulate Scenario"})]})]})]}),jsxRuntime.jsx(fy,{theme:e})]}):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(py,{options:H,value:t,onChange:D=>a(D),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsxRuntime.jsx(_u,{theme:e,value:c,onChange:u}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ju,{theme:e,value:f,onChange:x,hideCompleted:k,onHideCompletedChange:p})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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:l||S.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Vu,{theme:e,onExportPNG:v,onExportPDF:b,onExportExcel:h,onExportCSV:y,onExportJSON:C,onExportMSProject:N}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(my,{options:J,value:s,onChange:D=>n(D),theme:e})]})]})}function Fs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),c=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let i=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let m=u.current.getBoundingClientRect();n({x:m.left,y:m.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(Pt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.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:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function tn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[c,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,l=r.length*36+8,g=8,f=window.innerWidth,x=window.innerHeight,k=t,p=a;t+m+g>f&&(k=t-m,k<g&&(k=g)),a+l+g>x&&(p=x-l-g,p<g&&(p=g)),u({x:k,y:p});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=g=>{n.current&&!n.current.contains(g.target)&&o();},l=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m: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:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:l=>{m.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var Ut={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 Qu({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:c,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:m,onOpenTaskModal:l,enableKeyboard:g=true}){let f=react.useRef(false),x=react.useCallback(h=>{f.current=h;},[]),k=react.useCallback(h=>{let y=[],C=N=>{for(let S of N)y.push(S),S.subtasks&&S.subtasks.length>0&&S.isExpanded&&C(S.subtasks);};return C(h),y},[]),p=react.useCallback(()=>{let h=k(e);for(let y of h)if(t.has(y.id))return y;return null},[e,t,k]),v=react.useCallback((h,y)=>{let C=k(e);if(C.length===0)return;let N=p();if(!N){a(C[0].id,false);return}let S=C.findIndex(L=>L.id===N.id);if(S===-1)return;let w=h==="up"?S-1:S+1;if(w<0||w>=C.length)return;let E=C[w];a(E.id,y);},[e,p,k,a]),b=react.useCallback(h=>{if(!g)return;let y=h.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||f.current){h.key==="Escape"&&(y.blur(),f.current=false);return}let S=navigator.platform.toUpperCase().indexOf("MAC")>=0?h.metaKey:h.ctrlKey,w=Array.from(t),E=p();if(h.key==="ArrowUp"){h.preventDefault(),v("up",h.shiftKey);return}if(h.key==="ArrowDown"){h.preventDefault(),v("down",h.shiftKey);return}if(E&&(h.key==="ArrowRight"||h.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(h.preventDefault(),(h.key==="ArrowRight"&&!E.isExpanded||h.key==="ArrowLeft"&&E.isExpanded)&&m(E.id));return}if(h.altKey&&(h.key==="ArrowUp"||h.key==="ArrowDown")){w.length>0&&(h.preventDefault(),n(w,h.key==="ArrowUp"?"up":"down"));return}if(h.key==="Tab"&&!h.shiftKey){w.length>0&&(h.preventDefault(),c(w));return}if(h.key==="Tab"&&h.shiftKey){w.length>0&&(h.preventDefault(),u(w));return}if(h.key==="Enter"&&!h.shiftKey&&!S){E&&(h.preventDefault(),r(E.id,"below"));return}if(h.key==="Enter"&&h.shiftKey&&!S){E&&(h.preventDefault(),r(E.id,"above"));return}if(h.key==="Enter"&&S){E&&(h.preventDefault(),l(E.id));return}if(h.key==="F2"){E&&(h.preventDefault(),i(E.id));return}if(h.key==="Delete"||h.key==="Backspace"&&S){w.length>0&&(h.preventDefault(),o(w));return}if(h.key==="d"&&S&&!h.shiftKey){w.length>0&&(h.preventDefault(),s(w));return}},[g,t,p,v,r,o,s,n,c,u,i,m,l]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[g,b]),{setIsEditing:x}}function tm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(g=>{let f=new Set(g);return f.has(l)?f.delete(l):f.add(l),f}),r(l);},[]),n=react.useCallback((l,g)=>{if(!a){o(l);return}let f=g.indexOf(a),x=g.indexOf(l);if(f===-1||x===-1){o(l);return}let k=Math.min(f,x),p=Math.max(f,x),v=g.slice(k,p+1);t(new Set(v)),r(l);},[a,o]),c=react.useCallback((l,g,f,x)=>{x?n(l,g):f?s(l):o(l);},[o,s,n]),u=react.useCallback((l,g)=>{g?t(f=>{let x=new Set(f);return x.add(l),x}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:c,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:m}}function Ml(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Ml(t.subtasks):t.subtasks}))}function an(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((c,u)=>(c.position??0)-(u.position??0));for(let c=0;c<n.length;c++){let u={...n[c],parentId:o,level:s,position:n[c].position??c};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.id,s+1);}};return a(e),t}function As(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=As(a.subtasks,t);if(r)return r}}return null}function El(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=El(a.subtasks,t);if(r)return r}return null}function Pl(e,t){if(t.length===0)return e;let a=an(e),r=t[0],o=a.findIndex(g=>g.id===r);if(o<=0)return e;let s=a[o-1],n=(g,f)=>{let x=[];return {tasks:g.filter(p=>{if(f.has(p.id))return x.push(p),false;if(p.subtasks){let v=n(p.subtasks,f);p.subtasks=v.tasks,x.push(...v.removed);}return true}),removed:x}},c=(g,f,x)=>g.map(k=>k.id===f?{...k,subtasks:[...k.subtasks||[],...x],isExpanded:true}:k.subtasks?{...k,subtasks:c(k.subtasks,f,x)}:k),u=new Set(t),{tasks:i,removed:m}=n(e,u),l=c(i,s.id,m);return Ml(l)}function Fl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=El(a,r);if(!o)continue;let s=El(a,o.id),n=(i,m,l)=>{for(let g=0;g<i.length;g++){let f=i[g];if(f.id===m&&f.subtasks){let x=f.subtasks.findIndex(k=>k.id===l);if(x!==-1){let[k]=f.subtasks.splice(x,1);return k}}if(f.subtasks){let x=n(f.subtasks,m,l);if(x)return x}}return null},c=(i,m,l)=>{let g=i.findIndex(f=>f.id===m);if(g!==-1)return i.splice(g+1,0,l),i;for(let f of i)f.subtasks&&c(f.subtasks,m,l);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?c(s.subtasks,o.id,u):c(a,o.id,u));}return Ml(a)}function Al(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,c,u)=>{let i=n.findIndex(l=>l.id===c);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,c,u))return true;return false}let m=u==="up"?i-1:i+1;return m<0||m>=n.length?false:([n[i],n[m]]=[n[m],n[i]],n[i]={...n[i],position:i},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Ll(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 Sn(e,t){let a=[...e],r=[];for(let o of t){let s=(u,i)=>u.map((m,l)=>({...m,id:`${m.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${l}`):void 0})),n=u=>{let i=u.findIndex(f=>f.id===o);if(i===-1){for(let f of u)if(f.subtasks){let x=n(f.subtasks);if(x)return x}return null}let m=u[i],l=`${m.id}-copy-${Date.now()}`,g={...m,id:l,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,l):void 0};return u.splice(i+1,0,g),g},c=n(a);c&&r.push(c);}return {tasks:a,duplicatedTasks:r}}function am(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:"#6366F1"},c=u=>{let i=u.findIndex(l=>l.id===t);if(i===-1){for(let l of u)if(l.subtasks&&c(l.subtasks))return true;return false}let m=a==="above"?i:i+1;return u.splice(m,0,n),true};return c(r),{tasks:r,newTask:n}}function Il(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Il(r.subtasks,t,a)}:r)}function Bl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Bl(a.subtasks,t)}:a)}function Rl(e,t){let a=g=>{for(let f of g){if(f.id===t)return f;if(f.subtasks){let x=a(f.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,c=r?.endDate||s,u=g=>{for(let f of g){if(f.id===t)return (f.subtasks||[]).length;if(f.subtasks){let x=u(f.subtasks);if(x>=0)return x}}return 0},i=u(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(c),color:r?.color||"#3B82F6",position:i,parentId:t},l=g=>g.map(f=>{if(f.id===t){let x=f.subtasks||[];return {...f,subtasks:[...x,m],isExpanded:true}}return f.subtasks?{...f,subtasks:l(f.subtasks)}:f});return {tasks:l(e),newTask:m}}function rm(e,t,a,r){if(t===a)return e;let o=As(e,t);if(!o)return e;if(a){let c=(u,i)=>{if(!u.subtasks)return false;for(let m of u.subtasks)if(m.id===i||c(m,i))return true;return false};if(c(o,a))return e}let s=c=>{let u=c.filter(m=>m.id!==t),i=u.length<c.length;return u.map((m,l)=>{let g=i?{...m,position:l}:m;return g.subtasks&&g.subtasks.length>0?{...g,subtasks:s(g.subtasks)}:g})},n=s(e);if(a===null){let c=r!==void 0?r:n.length;n.splice(c,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let c=u=>u.map(i=>{if(i.id===a){let m=i.subtasks||[],l=r!==void 0?r:m.length,g=[...m];g.splice(l,0,{...o,parentId:a});let f=g.map((x,k)=>({...x,position:k}));return {...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});n=c(n);}return n}function mr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=mr(t.subtasks),r=a.reduce((c,u)=>(u.startDate&&c.starts.push(new Date(u.startDate).getTime()),u.endDate&&c.ends.push(new Date(u.endDate).getTime()),c.progresses.push(u.progress??0),c),{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((c,u)=>c+u,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function Is({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:c,onTaskToggle:u,scrollTop:i,columns:m,onToggleColumn:l,onColumnResize:g,onTaskUpdate:f,onTaskIndent:x,onTaskOutdent:k,onTaskMove:p,onMultiTaskDelete:v,onTaskDuplicate:b,onTaskCreate:h,onTaskRename:y,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:S,onTaskReparent:w,scrollContainerRef:E}){let L=react.useContext(en),[T,z]=react.useState(null),[H,J]=react.useState(null),[D,ve]=react.useState(""),de=react.useRef(null),[V,I]=react.useState(null),[Te,Q]=react.useState(0),[et,$]=react.useState(0),[ae,Re]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ke,Ze]=react.useState(null),[Ee,ze]=react.useState(null),[re,K]=react.useState(null),q=react.useRef(0),be=5,we=react.useRef(false),[Je,G]=react.useState(null),[he,je]=react.useState(false),Ie=react.useRef(null),[Ke,O]=react.useState(null),[ne,X]=react.useState(false),Me=react.useRef(null);react.useEffect(()=>{function B(_){Me.current&&!Me.current.contains(_.target)&&X(false);}if(ne)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[ne]),react.useEffect(()=>{H&&de.current&&(de.current.focus(),de.current.select());},[H]),react.useEffect(()=>{if(!V)return;let B=Pe=>{let A=Pe.clientX-Te,Z=et+A;g?.(V,Z);},_=()=>{I(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",_),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",_),document.body.style.cursor="",document.body.style.userSelect="";}},[V,Te,et,g]);let{selectedTaskIds:Ve,handleTaskClick:tt,isTaskSelected:rt}=tm(),{setIsEditing:_e}=Qu({tasks:e,selectedTaskIds:Ve,onTaskSelect:(B,_)=>{let A=an(e).map(Z=>Z.id);tt(B,A,_||false,false);},onTaskCreate:h||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:p||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:B=>{let _=an(e).find(Pe=>Pe.id===B);_&&Oe(_);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:B=>{let _=an(e).find(Pe=>Pe.id===B);_&&N&&N(_);},enableKeyboard:true}),Nt=(B,_=0,Pe="")=>{let A=[],Z=[...B].sort((ce,He)=>(ce.position??0)-(He.position??0));for(let ce=0;ce<Z.length;ce++){let He=Z[ce],ue=ce+1,it=Pe?`${Pe}.${ue}`:`${ue}.0`;if(He.wbsCode=it,A.push({task:He,level:_}),He.subtasks&&He.subtasks.length>0&&He.isExpanded){let dt=Pe?`${Pe}.${ue}`:`${ue}`;A.push(...Nt(He.subtasks,_+1,dt));}}return A},ht=Nt(e),xt=48,yt=Math.max(ht.length*a,600-xt),U=B=>!B.startDate||!B.endDate?"-":`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))}d`,Oe=B=>{J(B.id),ve(B.name),_e(true);},Qe=B=>{D.trim()&&D!==e.find(_=>_.id===B)?.name&&y?.(B,D.trim()),J(null),ve(""),_e(false);},Ne=()=>{J(null),ve(""),_e(false);},$e=(B,_)=>{_.stopPropagation(),C?.(B.id);},me=(B,_)=>{_.preventDefault(),q.current=_.clientY,Ze(B),we.current=false,je(false),G({x:_.clientX,y:_.clientY});},R=B=>{if(!ke||(Math.abs(B.clientY-q.current)>be&&!we.current&&(we.current=true,je(true)),G({x:B.clientX,y:B.clientY}),!we.current))return;if(E?.current){let ce=E.current,He=ce.getBoundingClientRect(),ue=60,it=12;Ie.current&&(cancelAnimationFrame(Ie.current),Ie.current=null);let dt=B.clientY-He.top,Dt=He.bottom-B.clientY;if(dt<ue&&ce.scrollTop>0){let Ft=Math.round(it*(1-dt/ue)),Kt=()=>{ce.scrollTop-=Ft,we.current&&ce.scrollTop>0&&(Ie.current=requestAnimationFrame(Kt));};Ie.current=requestAnimationFrame(Kt);}else if(Dt<ue&&ce.scrollTop<ce.scrollHeight-ce.clientHeight){let Ft=Math.round(it*(1-Dt/ue)),Kt=()=>{ce.scrollTop+=Ft,we.current&&ce.scrollTop<ce.scrollHeight-ce.clientHeight&&(Ie.current=requestAnimationFrame(Kt));};Ie.current=requestAnimationFrame(Kt);}}let Pe=document.querySelectorAll("[data-task-row]"),A=null,Z=null;Pe.forEach(ce=>{let He=ce.getBoundingClientRect(),ue=ce.getAttribute("data-task-row");if(ue&&ue!==ke&&B.clientY>=He.top&&B.clientY<=He.bottom){A=ue;let it=B.clientY-He.top,dt=He.height;it<dt*.25?Z="above":it>dt*.75?Z="below":Z="child";}}),ze(A),K(Z);},j=()=>{if(we.current&&ke&&Ee&&re){if(re==="child")w?.(ke,Ee);else if(re==="above"||re==="below"){let B=(Z,ce,He=null)=>{for(let ue of Z){if(ue.id===ce)return He;if(ue.subtasks){let it=B(ue.subtasks,ce,ue.id);if(it!==void 0)return it}}},_=B(e,ke,null),Pe=B(e,Ee,null),A=(Z,ce,He,ue)=>{let it=Z.findIndex(Ft=>Ft.id===ce),dt=ue?Z.findIndex(Ft=>Ft.id===He):-1,Dt=re==="below"?it+1:it;return ue&&dt!==-1&&dt<it&&(Dt-=1),Math.max(0,Dt)};if(Pe===null){let ce=A(e,Ee,ke,_===null);w?.(ke,null,ce);}else {let Z=ht.find(ce=>ce.task.id===Pe)?.task;if(Z?.subtasks){let ce=_===Pe,He=A(Z.subtasks,Ee,ke,ce);w?.(ke,Pe,He);}}}}Ie.current&&(cancelAnimationFrame(Ie.current),Ie.current=null),Ze(null),ze(null),K(null),G(null),we.current=false,je(false);};react.useEffect(()=>{if(ke)return document.addEventListener("mousemove",R),document.addEventListener("mouseup",j),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[ke,Ee,re]);let Be=(B,_,Pe)=>{let A=_.subtasks&&_.subtasks.length>0;switch(B.id){case "name":let Z=H===_.id,ce=T===_.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Pe*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ce?1:.3},onMouseDown:Fe=>me(_.id,Fe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),_.subtasks&&_.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),u?.(_.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:_.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:_.color||"#3B82F6",opacity:_.parentId?.6:1,borderColor:_.isMilestone?t.accent:"transparent",borderWidth:_.isMilestone?"2px":"0px"},title:_.isMilestone?"Milestone":_.parentId?"Subtask":"Task"})}),Z?jsxRuntime.jsx("input",{ref:de,type:"text",value:D,onChange:Fe=>ve(Fe.target.value),onKeyDown:Fe=>{Fe.key==="Enter"?Qe(_.id):Fe.key==="Escape"&&Ne();},onBlur:()=>Qe(_.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:Fe=>Fe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:_.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:_.parentId?"13px":"14px",fontWeight:_.isMilestone?600:_.parentId?400:600,letterSpacing:_.parentId?"0":"-0.01em"},title:_.name,children:[_.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:_.wbsCode}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_.name})]}),ce&&!Z&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Fe=>Fe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Fe=>$e(_,Fe),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),Oe(_);},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 ue=B.id==="startDate"?"startDate":"endDate",it=_[ue],dt=Ke?.taskId===_.id&&Ke?.field===ue,Dt=Fe=>Fe?(typeof Fe=="string"?new Date(Fe):Fe).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:Fe=>Fe.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:A?.5:1,cursor:A?"default":"pointer"},title:A?"Auto-calculated from subtasks":void 0,onClick:Fe=>{if(!A)if(dt)O(null);else {let St=Fe.currentTarget.getBoundingClientRect();O({taskId:_.id,field:ue,month:it?typeof it=="string"?new Date(it):it:new Date,position:{top:St.bottom+4,left:St.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Dt(it)}),A&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),dt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>O(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:Ke?.position.top,left:Ke?.position.left},onClick:Fe=>Fe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Fe=new Date,St=new Date(Fe);St.setDate(Fe.getDate()+1);let sa=new Date(Fe);sa.setDate(Fe.getDate()+7);let ma=new Date(Fe);return ma.setDate(Fe.getDate()+14),[{label:"Hoy",date:Fe},{label:"Ma\xF1ana",date:St},{label:"Pr\xF3xima semana",date:sa},{label:"2 semanas",date:ma}].map((oe,Xe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:nt=>nt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:nt=>nt.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(_.id,{[ue]:oe.date}),O(null);},children:oe.label},Xe))})(),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:Fe=>Fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(_.id,{[ue]:void 0}),O(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:()=>O(Fe=>Fe?{...Fe,month:new Date(Fe.month.getFullYear(),Fe.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:Ke?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>O(Fe=>Fe?{...Fe,month:new Date(Fe.month.getFullYear(),Fe.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((Fe,St)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Fe},St))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Fe=Ke?.month||new Date,St=Fe.getFullYear(),sa=Fe.getMonth(),ma=new Date(St,sa,1).getDay(),P=new Date(St,sa+1,0).getDate(),oe=new Date,Xe=[];for(let mt=ma-1;mt>=0;mt--)Xe.push({day:new Date(St,sa,-mt).getDate(),date:new Date(St,sa-1,new Date(St,sa,-mt).getDate()),isCurrentMonth:false});for(let mt=1;mt<=P;mt++)Xe.push({day:mt,date:new Date(St,sa,mt),isCurrentMonth:true});let nt=42-Xe.length;for(let mt=1;mt<=nt;mt++)Xe.push({day:mt,date:new Date(St,sa+1,mt),isCurrentMonth:false});return Xe.map((mt,Ia)=>{let ia=mt.date.toDateString()===oe.toDateString(),ha=(it?typeof it=="string"?new Date(it):it:null)?.toDateString()===mt.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:mt.isCurrentMonth?ha?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ha?"#3B82F6":"transparent",boxShadow:ia&&!ha?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(_.id,{[ue]:mt.date}),O(null);},children:mt.day},Ia)})})()})]})]})]}),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:U(_)})});case "assignees":if(A)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 Ft=r.filter(Fe=>_.assignees?.some(St=>St.name===Fe.name||St.initials===Fe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Fe=>Fe.stopPropagation(),children:jsxRuntime.jsx(wo,{assignedUsers:Ft,availableUsers:r,onChange:Fe=>{let St=Fe.map(sa=>({id:sa.id,name:sa.name,initials:sa.initials,color:sa.color}));f?.(_.id,{assignees:St.length>0?St:void 0});}})});case "status":if(A){let Fe=_.progress===100?"\u2713":_.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:Fe})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Fe=>Fe.stopPropagation(),children:jsxRuntime.jsx(Fc,{status:_.status||"todo",onChange:Fe=>{f?.(_.id,{status:Fe,progress:Fe==="completed"?100:_.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:A?.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:`${_.progress}%`,backgroundColor:_.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:[_.progress,"%"]})]});case "priority":let Kt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},nr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},La=Kt[_.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Fe=>Fe.stopPropagation(),children:jsxRuntime.jsx(vo,{priority:La,onChange:Fe=>{Fe&&f?.(_.id,{priority:nr[Fe]||"medium"});}})});default:return null}},De=B=>[{id:"hide",label:"Hide Column",icon:Ut.Hide,onClick:()=>l(B),disabled:B==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ut.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ut.SortDesc,onClick:()=>{}}],fe=B=>B.subtasks&&B.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{C?.(B.id);}},{id:"duplicate",label:L?.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{b?.([B.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{S?S(B.id,B.name):v?.([B.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{n?.(B);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{C?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{f?.(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{f?.(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{f?.(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:L?.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{b?.([B.id]);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{S?S(B.id,B.name):v?.([B.id]);}}],Ce=m.filter(B=>B.visible),ee=Ce.reduce((B,_)=>B+_.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ee},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${xt}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:Ce.map((B,_)=>{let Pe=_===Ce.length-1,A=B.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${A?"":"justify-center"}`,style:{width:`${B.width}px`,minWidth:`${B.minWidth??(A?200:60)}px`,maxWidth:`${B.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Z=>{Z.preventDefault(),Re({isOpen:true,x:Z.clientX,y:Z.clientY,type:"header",columnId:B.id});},onMouseEnter:Z=>{Z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Z=>{Z.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:B.label,children:B.label}),B.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:V===B.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation(),I(B.id),Q(Z.clientX),$(B.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"}})})]},B.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(Fs,{columns:m,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>X(!ne),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"})}),ne&&jsxRuntime.jsxs("div",{ref:Me,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:B=>B.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:()=>X(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:yt},children:ht.map(({task:B,level:_},Pe)=>{let A=rt(B.id),Z=Ee===B.id,ce=Z&&re==="above",He=Z&&re==="below",ue=Z&&re==="child",it={};return ue&&(it.backgroundColor=`${t.accent}15`,it.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":B.id,className:`flex items-center cursor-pointer group ${ke===B.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:A?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:A?t.accentLight:ue?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...it},onMouseEnter:()=>z(B.id),onMouseLeave:()=>z(null),onClick:dt=>{let Ft=an(e).map(La=>La.id),nr=navigator.platform.toUpperCase().indexOf("MAC")>=0?dt.metaKey:dt.ctrlKey;tt(B.id,Ft,nr,dt.shiftKey),s?.(B);},onDoubleClick:dt=>{dt.stopPropagation(),n?.(B);},onContextMenu:dt=>{dt.preventDefault(),Re({isOpen:true,x:dt.clientX,y:dt.clientY,type:"task",task:B}),c?.(B,dt);},whileHover:{backgroundColor:A?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}}),He&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ce.map((dt,Dt)=>{let Ft=Dt===Ce.length-1,Kt=dt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Kt?"justify-start":"justify-center"}`,style:{width:`${dt.width}px`,minWidth:`${dt.minWidth??(Kt?200:60)}px`,maxWidth:`${dt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ft?"none":`1px solid ${T===B.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Be(dt,B,Kt?_:0)},`${B.id}-${dt.id}`)})]},B.id)})}),jsxRuntime.jsx(tn,{isOpen:ae.isOpen,x:ae.x,y:ae.y,items:ae.type==="header"&&ae.columnId?De(ae.columnId):ae.type==="task"&&ae.task?fe(ae.task):[],onClose:()=>Re({...ae,isOpen:false}),theme:t}),he&&Je&&ke&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let B=ht.find(_=>_.task.id===ke)?.task;return B?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:B.name})}):null})()}),document.body)]})}function lm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,c]=react.useState(e),[u,i]=react.useState(t),[m,l]=react.useState(null),[g,f]=react.useState(null),[x,k]=react.useState(null),[p,v]=react.useState(null),[b,h]=react.useState(0),[y,C]=react.useState(0),[N,S]=react.useState(null),[w,E]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:c,ghostWidth:u,setGhostWidth:i,connectionLine:m,setConnectionLine:l,hoveredTaskId:g,setHoveredTaskId:f,activeZone:x,setActiveZone:k,draggedSegmentIndex:p,setDraggedSegmentIndex:v,draggedSegmentStartX:b,setDraggedSegmentStartX:h,segmentDragOffsetX:y,setSegmentDragOffsetX:C,hoveredSegmentIndex:N,setHoveredSegmentIndex:S,isHovered:w,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,D)=>{r("none"),l(null),f(null),c(J),i(D),C(0),v(null),h(0);}}}function Rs({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:c,onClick:u,onDoubleClick:i,onContextMenu:m,onDateChange:l,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:x,onHoverChange:k}){let p=lm(t,r),v=react.useRef(null),b=react.useRef(null),h=react.useRef(null),{dragMode:y,setDragMode:C,dragOffset:N,setDragOffset:S,ghostX:w,setGhostX:E,ghostWidth:L,setGhostWidth:T,connectionLine:z,setConnectionLine:H,hoveredTaskId:J,setHoveredTaskId:D,activeZone:ve,setActiveZone:de,draggedSegmentIndex:V,setDraggedSegmentIndex:I,draggedSegmentStartX:Te,setDraggedSegmentStartX:Q,segmentDragOffsetX:et,setSegmentDragOffsetX:$,hoveredSegmentIndex:ae,setHoveredSegmentIndex:Re,isHovered:ke,setIsHovered:Ze,isDragging:Ee,isResizing:ze,isConnecting:re,resetDragState:K}=p,q=24,be=!!o.executionBarBg,we=be?4:8,Je=!e.parentId&&e.subtasks&&e.subtasks.length>0,G=e.endDate&&e.endDate<new Date&&e.progress<100,he=e.isCriticalPath,je=o.name==="neutral"||o.today==="#1C1917",Ie=e.status==="completed"||e.progress===100,Ke={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ne=e.isCriticalPath||G?"#DC2626":e.color?e.color:e.priority&&Ke[e.priority]?Ke[e.priority]:o.taskBarPrimary,Me=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),Ve=r<50,tt=r<40;react.useEffect(()=>{if(k)if(ke&&!Ee&&!e.segments){let j=a<100;k({task:e,x:t,y:a,width:r,height:q,showBelow:j});}else k(null);},[ke,Ee,e,t,a,r,q,k]);let rt=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),_e=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Nt=j=>Math.round(j/s)*s,ht=j=>{let Be=Math.round(j/s),De=new Date(n);return De.setDate(De.getDate()+Be),De},xt=(j,Be)=>{for(let De of f){if(De.id===e.id)continue;let fe=5;if(j>=De.x-fe&&j<=De.x+De.width+fe&&Be>=De.y-fe&&Be<=De.y+De.height+fe)return De.id}return null},yt=react.useCallback((j,Be,De)=>{j.preventDefault(),j.stopPropagation();let fe=v.current?.ownerSVGElement;if(!fe)return;let Ce=fe.createSVGPoint();Ce.x=j.clientX,Ce.y=j.clientY;let ee=Ce.matrixTransform(fe.getScreenCTM()?.inverse()),B=De!==void 0?De:t,_=Be;if(!_){let Pe=ee.x-B;j.shiftKey?(_="connect",H({x:t+r,y:a+q/2})):j.ctrlKey||j.metaKey?_="move":j.altKey?_=Pe<r/2?"resize-start":"resize-end":tt?Pe<r/2?_="move":_="resize-end":Ve?Pe<=Me/2?_="resize-start":Pe>=r-Me/2?_="resize-end":_="move":Pe<=Me?_="resize-start":Pe>=r-Me?_="resize-end":_="move";}C(_),Ze(false),de(null),_==="move"?S(ee.x-B):_==="connect"?H({x:t+r,y:a+q/2}):S(0),E(B),T(r);},[t,r,a,q]),U=react.useCallback(j=>{let Be=v.current?.ownerSVGElement;if(!Be)return;let De=Be.closest(".gantt-timeline-scroll");if(!De)return;let fe=De.getBoundingClientRect(),Ce=60,ee=15,B=0;if(j.clientX<fe.left+Ce){let _=fe.left+Ce-j.clientX;B=-Math.min(ee,_/2);}else if(j.clientX>fe.right-Ce){let _=j.clientX-(fe.right-Ce);B=Math.min(ee,_/2);}return B!==0&&(De.scrollLeft+=B),B!==0},[]),Oe=react.useCallback(j=>{if(y==="none")return;h.current=j;let Be=v.current?.ownerSVGElement;if(!Be)return;if(y==="move"||y==="resize-start"||y==="resize-end"){let Ce=U(j);Ce&&!b.current?b.current=window.setInterval(()=>{h.current&&(U(h.current),Oe(h.current));},16):!Ce&&b.current&&(window.clearInterval(b.current),b.current=null);}let De=Be.createSVGPoint();De.x=j.clientX,De.y=j.clientY;let fe=De.matrixTransform(Be.getScreenCTM()?.inverse());if(y==="connect"){H({x:fe.x,y:fe.y});let Ce=xt(fe.x,fe.y);D(Ce);}else if(y==="move"){let Ce=fe.x-N,ee=Nt(Ce);E(ee),T(r);let B=Math.round((ee-t)/s);if(x?.(e.id,B,true),e.segments&&e.segments.length>0&&V!==null){let _=ee-Te;$(_);}}else if(y==="resize-start"){let Ce=fe.x,ee=Nt(Ce),B=t+r-ee;B>=s&&(E(ee),T(B));}else if(y==="resize-end"){let Ce=fe.x,B=Nt(Ce)-t;B>=s&&T(B);}},[y,t,r,s,N,e,Nt,V,Te,xt,D,H,E,T,$,x,U]),Qe=react.useCallback(()=>{if(b.current&&(window.clearInterval(b.current),b.current=null),h.current=null,y!=="none"){if(y==="connect")J&&g&&g(e,J),H(null),D(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),Be,De,fe=true;if(y==="move"){if(Be=ht(w),De=new Date(Be.getTime()+j),e.segments&&e.segments.length>0&&V!==null){let Ce=Math.round(et/s),ee=e.segments.map((A,Z)=>{if(Z===V){let ce=new Date(A.startDate),He=new Date(A.endDate);return ce.setDate(ce.getDate()+Ce),He.setDate(He.getDate()+Ce),{startDate:ce,endDate:He}}return A}),B=ee.flatMap(A=>[A.startDate,A.endDate]),_=new Date(Math.min(...B.map(A=>A.getTime()))),Pe=new Date(Math.max(...B.map(A=>A.getTime())));l?.({...e,segments:ee},_,Pe),K(t,r);return}}else y==="resize-start"?(Be=ht(w),De=e.endDate,Be>De&&(console.warn("Invalid date range: start date must be before or equal to end date"),fe=false)):y==="resize-end"?(Be=e.startDate,De=ht(w+L),De<Be&&(console.warn("Invalid date range: end date must be after or equal to start date"),fe=false)):fe=false;fe&&Be&&De&&(De.getTime()<Be.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Be,De));}x?.(e.id,0,false),K(t,r);}},[y,w,L,e,l,J,g,t,r,s,ht,et,V,K,x]);react.useEffect(()=>{if(y==="none")return;let j=De=>{Oe(De);},Be=()=>{Qe();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Be),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Be),b.current&&(window.clearInterval(b.current),b.current=null);}},[y,Oe,Qe]);let Ne=Ee&&!re?w:t,$e=Ee&&!re?L:r,me=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!Ee&&u?.(e),onDoubleClick:j=>{Ee||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),m?.(e,j);},onMouseEnter:()=>!Ee&&Ze(true),onMouseLeave:()=>{Ee||(Ze(false),de(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:q,fill:"transparent",style:{pointerEvents:"all"}}),ke&&!Ee&&!Ve&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Me,height:q,fill:ve==="resize-start"?o.accent:"transparent",opacity:ve==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>de("resize-start"),onMouseDown:j=>yt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Me,y:a,width:r-Me*2,height:q,fill:ve==="move"?o.accent:"transparent",opacity:ve==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>de("move"),onMouseDown:j=>yt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-Me,y:a,width:Me,height:q,fill:ve==="resize-end"?o.accent:"transparent",opacity:ve==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>de("resize-end"),onMouseDown:j=>yt(j,"resize-end")})]}),ke&&!Ee&&tt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:q,fill:ve==="move"?o.accent:"transparent",opacity:ve==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>de("move"),onMouseDown:j=>yt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:q,fill:ve==="resize-end"?o.accent:"transparent",opacity:ve==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>de("resize-end"),onMouseDown:j=>yt(j,"resize-end")}),ke&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+q-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ee&&!re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:L,height:q,rx:we,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&be&&Je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Ne,y:a,width:$e,height:q,rx:we,fill:"none",stroke:"rgba(255,255,255,0.15)",strokeWidth:1,"data-task-class":me,style:{cursor:"default",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ne,y:a+q-3,width:$e,height:3,rx:1.5,fill:ne,opacity:.6,style:{pointerEvents:"none"}})]}),!e.segments&&be&&!Je&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ne,y:a,width:$e,height:q,rx:we,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":me,initial:{opacity:0,scale:.95},animate:{opacity:Ee&&!re?.15:1,scale:ke&&!Ee?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>yt(j),style:{cursor:Ee?re?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&!be&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ne,y:a,width:$e,height:q,rx:we,fill:ne,"data-task-class":me,initial:{opacity:0,scale:.95},animate:{opacity:Ee&&!re?.15:e.parentId?.6:ke?.9:.8,scale:ke&&!Ee?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Je?void 0:j=>yt(j),style:{cursor:Je?"default":Ee?re?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),be&&(G||he)&&!e.segments&&jsxRuntime.jsx("rect",{x:Ne,y:a,width:$e,height:q,rx:we,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&&(be&&Je?null:jsxRuntime.jsx("rect",{x:Ne,y:a,width:Math.max($e*(e.progress/100),we*2),height:q,rx:we,fill:ne,opacity:1,style:{pointerEvents:"none"}})),be&&!e.segments&&e.progress>0&&e.progress<100&&!Je&&!Ee&&(()=>{let j=Ne+$e*(e.progress/100),Be=8,De=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:j,cy:a+q/2,r:Be,fill:De?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:j,y:a+q/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:De?.initials||De?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((j,Be)=>{let De=(j.startDate.getTime()-n.getTime())/864e5*s,Ce=(j.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-De+s,ee=Ee&&y==="move"&&V===Be,B=ae===Be,_=ee?De+et:De;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Ee&&Re(Be),onMouseLeave:()=>!Ee&&Re(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:_,y:a,width:Ce,height:q,rx:we,fill:ne,initial:{opacity:0,scale:.95},animate:{opacity:ee||e.parentId?.6:B?.9:.8,scale:B&&!Ee?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Pe=>{Pe.stopPropagation(),I(Be),Q(De),yt(Pe,void 0,De);},style:{cursor:Ee?re?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:_,y:a,width:Ce*(e.progress/100),height:q,rx:we,fill:ne,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Be}`)}),je&&(G||he)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[he&&!G&&jsxRuntime.jsx("rect",{x:Ne,y:a,width:$e,height:q,rx:we,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),G&&jsxRuntime.jsx("rect",{x:Ne,y:a,width:$e,height:q,rx:we,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$e>60&&!e.segments&&(()=>{let j=c.taskLabel(e),Be=typeof j=="string"?j:e.name,De=Be.length>Math.floor($e/8)?`${Be.substring(0,Math.floor($e/8))}...`:Be;return jsxRuntime.jsx("text",{x:Ne+12,y:a+q/2,dominantBaseline:"middle",fill:Ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ie?"line-through":"none"},children:De})})(),!Ee&&!e.segments&&e.progress>0&&e.progress<100&&(be?jsxRuntime.jsxs("text",{x:Ne+$e+6,y:a+q/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):$e>100?jsxRuntime.jsxs("text",{x:Ne+$e-12,y:a+q/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&&$e>80&&!Ee&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ne+$e-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ne+$e-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ke||ze)&&!re&&!e.segments&&!Je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ne-2,y:a,width:16,height:q,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>de("resize-start"),onMouseLeave:()=>de(null),onMouseDown:j=>{j.stopPropagation(),yt(j,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ne+4,y:a+8,width:3,height:q-16,rx:1.5,fill:ve==="resize-start"||y==="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:Ne+$e-14,y:a,width:16,height:q,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>de("resize-end"),onMouseLeave:()=>de(null),onMouseDown:j=>{j.stopPropagation(),yt(j,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ne+$e-7,y:a+8,width:3,height:q-16,rx:1.5,fill:ve==="resize-end"||y==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&!Ee&&!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+q/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>de("connect"),onMouseLeave:()=>de(null),onMouseDown:j=>{j.stopPropagation(),yt(j,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+q/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ve==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),re&&z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+q/2,x2:z.x,y2:z.y,stroke:J?o.statusCompleted:o.accent,strokeWidth:J?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:J?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:z.x,cy:z.y,r:J?8:6,fill:J?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),J&&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"})]}),(ke||Ee)&&!re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ne-1,y:a-1,width:$e+2,height:q+2,rx:we+1,fill:"none",stroke:Ee?o.accent:be?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:be?1:2,opacity:Ee||be?.6:.4,initial:{opacity:0},animate:{opacity:Ee||be?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+L,y1:0,x2:w+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&!Ee&&!e.segments&&!k&&(()=>{let De=a<100,fe=De?a+q+13:a-82-13,Ce=De?`M ${Ne+$e/2-6} ${a+q+3} L ${Ne+$e/2} ${a+q+13} L ${Ne+$e/2+6} ${a+q+3}`:`M ${Ne+$e/2-6} ${a-13} L ${Ne+$e/2} ${a-3} L ${Ne+$e/2+6} ${a-13}`,ee=fe+22,B=fe+40,_=fe+55,Pe=fe+70,A=De?fe+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:De?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:De?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ce,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ne+$e/2-120,y:fe,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:Ne+$e/2,y:ee,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:Ne+$e/2-110,y:B,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ne+$e/2-70,y:B,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:rt(e.startDate)}),jsxRuntime.jsx("text",{x:Ne+$e/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ne+$e/2-70,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:rt(e.endDate)}),jsxRuntime.jsx("text",{x:Ne+$e/2+10,y:B,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ne+$e/2+65,y:B,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:_e()}),jsxRuntime.jsx("text",{x:Ne+$e/2+10,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ne+$e/2+65,y:_,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:Ne+$e/2-110,y:Pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ne+$e/2-50,y:Pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Z=>Z.name).join(", ").substring(0,30),e.assignees.map(Z=>Z.name).join(", ").length>30?"...":""]})]}),!De&&jsxRuntime.jsx("text",{x:Ne+$e/2,y:A,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:tt?"Left: move \u2022 Right: resize":Ve?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function um({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:c,showBelow:u}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,m=i?130:82,l=13,g=u?s+c+l:s-m-l,f=u?`M ${o+n/2-6} ${s+c+3} L ${o+n/2} ${s+c+13} L ${o+n/2+6} ${s+c+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,x=g+22,k=g+40,p=g+55,v=g+70,b=g+90,h=g+105,y=g+120,C=T=>T.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let T=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${T} day${T!==1?"s":""}`},S=T=>{if(T==null||T===0)return "N/A";let z=Math.floor(T/60),H=T%60;return z===0?`${H}m`:H===0?`${z}h`:`${z}h ${H}m`},w={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:"};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:u?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:u?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:g,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:o+n/2,y:x,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?C(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?C(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(T=>T.name).join(", ").substring(0,30),r.assignees.map(T=>T.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:S(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y:h,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:S(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:S(r.soldEffortMinutes)})]})]})]})})}function An({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:c=false,onHoverChange:u,hoverOverlayOnly:i=false}){let[,m]=react.useState(false),[l,g]=react.useState(null),f=r-t,x=f>0,k=Math.abs(f)<5,p=20,v=!k&&a<=e,b,h,y=a-e,C=e+y/2;if(h=C,n==="squared")if(k)b=`M ${e} ${t} L ${a} ${r}`;else if(v){let I=e+15,Te=a-p,Q=x?t+20:t-20;h=Te,b=`M ${e} ${t} L ${I} ${t} L ${I} ${Q} L ${Te} ${Q} L ${Te} ${r} L ${a} ${r}`;}else h=a-p,b=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else b=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let N=5,S=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,w=o.dependency,E=o.dependencyHover||w,L="#f87171",T="rgba(248, 113, 113, 0.15)",z=h,H=(t+r)/2;if(l)if(k)z=Math.max(e+10,Math.min(a-10,l.x)),H=t;else if(v){let V=e+15,I=a-p,Te=x?t+20:t-20,Q=[[e,t,V,t],[V,t,V,Te],[V,Te,I,Te],[I,Te,I,r],[I,r,a,r]],et=1/0,$={x:z,y:H};for(let ae of Q){let Re=J(l.x,l.y,ae[0],ae[1],ae[2],ae[3]),ke=Math.hypot(l.x-Re.x,l.y-Re.y);ke<et&&(et=ke,$=Re);}z=$.x,H=$.y;}else {let V=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],I=1/0,Te={x:z,y:H};for(let Q of V){let et=J(l.x,l.y,Q[0],Q[1],Q[2],Q[3]),$=Math.hypot(l.x-et.x,l.y-et.y);$<I&&(I=$,Te=et);}z=Te.x,H=Te.y;}function J(V,I,Te,Q,et,$){let ae=et-Te,Re=$-Q,ke=ae*ae+Re*Re;if(ke===0)return {x:Te,y:Q};let Ze=((V-Te)*ae+(I-Q)*Re)/ke;return Ze=Math.max(0,Math.min(1,Ze)),{x:Te+Ze*ae,y:Q+Ze*Re}}let D=V=>{let I=V.currentTarget.ownerSVGElement;if(!I)return;let Te=I.getBoundingClientRect();g({x:V.clientX-Te.left,y:V.clientY-Te.top});},ve=()=>{m(false),g(null),u?.(false);},de=()=>{m(true),u?.(true);};return c?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ve,onMouseMove:D,children:[jsxRuntime.jsx("path",{d:b,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:b,fill:"none",stroke:E,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:b,fill:"none",stroke:E,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:E,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:E,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:V=>{V.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:z,cy:H,r:9,fill:T,stroke:L,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:z-3,y1:H-3,x2:z+3,y2:H+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z+3,y1:H-3,x2:z-3,y2:H+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:de,onMouseLeave:ve,onMouseMove:D,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:b,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:b,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:b,fill:"none",stroke:E,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:b,fill:"none",stroke:E,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:E,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:E,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:V=>{V.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:z,cy:H,r:9,fill:T,stroke:L,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:z-3,y1:H-3,x2:z+3,y2:H+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z+3,y1:H-3,x2:z-3,y2:H+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:de,onMouseLeave:ve,onMouseMove:D,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:b,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:b,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",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:w,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function $s({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),c=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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:u(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 Le={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,c=new Set,u=i=>{if(!n.has(i)){n.add(i),c.add(i);let m=r.get(i)||[];for(let l of m){if(!n.has(l)&&u(l))return true;if(c.has(l))return true}}return c.delete(i),false};return u(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=Le.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Le.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Le.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=Le.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(`
126
- `)},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=Le.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=Le.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)=>Le.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Le.findTaskById(e,t);return !a||!a.dependencies?[]:Le.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Le.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Le.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=Le.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=>Le.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=Le.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"]],c=s.map(u=>{let i=u.startDate&&u.endDate?Le.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?Le.formatDate(u.startDate):"N/A",u.endDate?Le.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:c,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="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=Le.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?Le.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?Le.formatDate(u.startDate):"","End Date":u.endDate?Le.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(m=>m.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Le.flattenTasks(e),o=new Map;r.forEach((g,f)=>{o.set(g.id,f+1);});let s=g=>g.toISOString().replace("Z",""),n=Le.getEarliestStartDate(e)||new Date,c=Le.getLatestEndDate(e)||new Date,u=r.map((g,f)=>{let x=o.get(g.id),k=g.startDate&&g.endDate?Le.calculateDuration(g.startDate,g.endDate):0,p=(g.dependencies||[]).filter(v=>o.has(v)).map(v=>`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function tl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxRuntime.jsxs("div",{className:m("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:m("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(u).map(([i,c])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:c.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function rl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[u,i]=react.useState("json"),[c,d]=react.useState(null),p=react.useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await jd(e,u,k);Kd(g,u);},v=async k=>{let g=k.target.files?.[0];if(g){try{let y=await Xd(g),h=g.name.endsWith(".json")?"json":"csv",b=Yd(y,h);d(b),b.success&&r&&r(b,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:m("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:m("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:m("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(k=>jsxRuntime.jsxs("button",{onClick:()=>i(k),className:m("p-4 rounded-lg border-2 transition-all text-center",u===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,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:p,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.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"})]})]}),c&&jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:m("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((k,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Zh=["URGENT","HIGH","MEDIUM","LOW"],Qh=[{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"}],eb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ol({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:f="none",onGroupByChange:v}){let[k,g]=react.useState(true),y=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),b=react.useCallback(N=>{r({by:N.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!k&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let C=N.target.value;a({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Zh.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let C=N.target.value;a({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let C=N.target.value;a({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:Qh.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.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"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:N=>v(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:eb.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function nl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:u}){let[i,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),c(false);};return jsxRuntime.jsxs("div",{className:m("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>p(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>p(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>p(()=>u?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>p(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>p(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 sl={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:"#3B82F6",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"}},il={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:"#2563EB",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"}},ll={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"}},ko={dark:sl,light:il,neutral:ll},hs="dark";var bs=react.createContext(void 0),cb="asakaa-theme";function ku({children:e,defaultTheme:t=hs,storageKey:a=cb}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,u=ko[r];Object.entries(u.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${ub(c)}`,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(([c,d])=>{let p=u.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:ko};return jsxRuntime.jsx(bs.Provider,{value:n,children:e})}function jo(){let e=react.useContext(bs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ub(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function dl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=jo();return e?jsxRuntime.jsxs("div",{className:m("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(ko).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:m("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 wu(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return st[e]||st.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",st[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",st[e].bgSecondary),bgGrid:r("--theme-bg-card",st[e].bgGrid),bgWeekend:r("--theme-bg-hover",st[e].bgWeekend),border:r("--theme-border-primary",st[e].border),borderLight:r("--theme-border-subtle",st[e].borderLight),textPrimary:r("--theme-text-primary",st[e].textPrimary),textSecondary:r("--theme-text-secondary",st[e].textSecondary),textTertiary:r("--theme-text-tertiary",st[e].textTertiary),accent:r("--theme-accent-primary",st[e].accent),accentHover:r("--theme-accent-hover",st[e].accentHover),accentLight:r("--theme-accent-primary",st[e].accentLight),taskBarPrimary:r("--theme-accent-primary",st[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",st[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",st[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",st[e].dependency),dependencyHover:r("--theme-border-secondary",st[e].dependencyHover),criticalPath:r("--theme-error",st[e].criticalPath),criticalPathLight:r("--theme-error",st[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",st[e].today):e==="neutral"?r("--theme-text-primary",st[e].today):r("--theme-error",st[e].today),todayLight:e==="light"?r("--theme-accent-primary",st[e].todayLight):e==="neutral"?r("--theme-text-primary",st[e].todayLight):r("--theme-error",st[e].todayLight),milestone:r("--theme-warning",st[e].milestone),milestoneLight:r("--theme-warning",st[e].milestoneLight),statusTodo:r("--theme-text-tertiary",st[e].statusTodo),statusInProgress:r("--theme-accent-primary",st[e].statusInProgress),statusCompleted:r("--theme-success",st[e].statusCompleted),hoverBg:r("--theme-bg-hover",st[e].hoverBg),focusRing:r("--theme-accent-primary",st[e].focusRing)}}var ys={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"},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"}},Cu={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"},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"}},cl={en:ys,es:Cu};function Tu(e){return cl[e]||cl.en}function ul(e,t){let a=Tu(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 qo=react.createContext(ys);function eo(){return react.useContext(qo)}function Ab({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,u]=react.useState(false),[i,c]=react.useState(null),d=react.useRef(null),p=eo();if(react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),k=async(g,y)=>{if(y){c(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),u(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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: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:v.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(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:y<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children: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 Lb({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-xs 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 Ib({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-xs 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 Bb({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=eo();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${u}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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 left-0 mt-2 w-36 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:l.map((i,c)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Rb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),u=eo();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},v=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:u.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:u.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:u.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:u.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":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:u.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:u.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function xs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}){let C=eo(),w=y||h||b||x||D||N,R=[{value:"day",label:C.toolbar.day},{value:"week",label:C.toolbar.week},{value:"month",label:C.toolbar.month}],F=[{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"})}];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(Ib,{options:R,value:t,onChange:T=>a(T),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsxRuntime.jsx(Bb,{theme:e,value:l,onChange:u}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Rb,{theme:e,value:f,onChange:v,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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||C.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ab,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Lb,{options:F,value:s,onChange:T=>n(T),theme:e})]})]})}function ks({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let c=u.current.getBoundingClientRect();n({x:c.left,y:c.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:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,f=window.innerWidth,v=window.innerHeight,k=t,g=a;t+c+p>f&&(k=t-c,k<p&&(k=p)),a+d+p>v&&(g=v-d-p,g<p&&(g=p)),u({x:k,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Lt={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 Lu({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let f=react.useRef(false),v=react.useCallback(b=>{f.current=b;},[]),k=react.useCallback(b=>{let x=[],D=N=>{for(let C of N)x.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&D(C.subtasks);};return D(b),x},[]),g=react.useCallback(()=>{let b=k(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,k]),y=react.useCallback((b,x)=>{let D=k(e);if(D.length===0)return;let N=g();if(!N){a(D[0].id,false);return}let C=D.findIndex(F=>F.id===N.id);if(C===-1)return;let w=b==="up"?C-1:C+1;if(w<0||w>=D.length)return;let R=D[w];a(R.id,x);},[e,g,k,a]),h=react.useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,w=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){w.length>0&&(b.preventDefault(),n(w,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){w.length>0&&(b.preventDefault(),l(w));return}if(b.key==="Tab"&&b.shiftKey){w.length>0&&(b.preventDefault(),u(w));return}if(b.key==="Enter"&&!b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&C){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),i(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&C){w.length>0&&(b.preventDefault(),o(w));return}if(b.key==="d"&&C&&!b.shiftKey){w.length>0&&(b.preventDefault(),s(w));return}},[p,t,g,y,r,o,s,n,l,u,i,c,d]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Bu(){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(p=>{let f=new Set(p);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,p)=>{if(!a){o(d);return}let f=p.indexOf(a),v=p.indexOf(d);if(f===-1||v===-1){o(d);return}let k=Math.min(f,v),g=Math.max(f,v),y=p.slice(k,g+1);t(new Set(y)),r(d);},[a,o]),l=react.useCallback((d,p,f,v)=>{v?n(d,p):f?s(d):o(d);},[o,s,n]),u=react.useCallback((d,p)=>{p?t(f=>{let v=new Set(f);return v.add(d),v}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:c}}function vl(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?vl(t.subtasks):t.subtasks}))}function Xo(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,u)=>(l.position??0)-(u.position??0));for(let l=0;l<n.length;l++){let u={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.id,s+1);}};return a(e),t}function ws(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ws(a.subtasks,t);if(r)return r}}return null}function yl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=yl(a.subtasks,t);if(r)return r}return null}function xl(e,t){if(t.length===0)return e;let a=Xo(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,f)=>{let v=[];return {tasks:p.filter(g=>{if(f.has(g.id))return v.push(g),false;if(g.subtasks){let y=n(g.subtasks,f);g.subtasks=y.tasks,v.push(...y.removed);}return true}),removed:v}},l=(p,f,v)=>p.map(k=>k.id===f?{...k,subtasks:[...k.subtasks||[],...v],isExpanded:true}:k.subtasks?{...k,subtasks:l(k.subtasks,f,v)}:k),u=new Set(t),{tasks:i,removed:c}=n(e,u),d=l(i,s.id,c);return vl(d)}function kl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=yl(a,r);if(!o)continue;let s=yl(a,o.id),n=(i,c,d)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===c&&f.subtasks){let v=f.subtasks.findIndex(k=>k.id===d);if(v!==-1){let[k]=f.subtasks.splice(v,1);return k}}if(f.subtasks){let v=n(f.subtasks,c,d);if(v)return v}}return null},l=(i,c,d)=>{let p=i.findIndex(f=>f.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?l(s.subtasks,o.id,u):l(a,o.id,u));}return vl(a)}function wl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,u)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,u))return true;return false}let c=u==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],n[i]={...n[i],position:i},n[c]={...n[c],position:c},true)};return s(r,o,a),r}function Cl(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 kn(e,t){let a=[...e],r=[];for(let o of t){let s=(u,i)=>u.map((c,d)=>({...c,id:`${c.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${d}`):void 0})),n=u=>{let i=u.findIndex(f=>f.id===o);if(i===-1){for(let f of u)if(f.subtasks){let v=n(f.subtasks);if(v)return v}return null}let c=u[i],d=`${c.id}-copy-${Date.now()}`,p={...c,id:d,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,d):void 0};return u.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Ru(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:"#6366F1"},l=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function Tl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Tl(r.subtasks,t,a)}:r)}function Nl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Nl(a.subtasks,t)}:a)}function Dl(e,t){let a=p=>{for(let f of p){if(f.id===t)return f;if(f.subtasks){let v=a(f.subtasks);if(v)return v}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,u=p=>{for(let f of p){if(f.id===t)return (f.subtasks||[]).length;if(f.subtasks){let v=u(f.subtasks);if(v>=0)return v}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6",position:i,parentId:t},d=p=>p.map(f=>{if(f.id===t){let v=f.subtasks||[];return {...f,subtasks:[...v,c],isExpanded:true}}return f.subtasks?{...f,subtasks:d(f.subtasks)}:f});return {tasks:d(e),newTask:c}}function Ou(e,t,a,r){if(t===a)return e;let o=ws(e,t);if(!o)return e;if(a){let l=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>{let u=l.filter(c=>c.id!==t),i=u.length<l.length;return u.map((c,d)=>{let p=i?{...c,position:d}:c;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let l=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];p.splice(d,0,{...o,parentId:a});let f=p.map((v,k)=>({...v,position:k}));return {...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Ts({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:f,onTaskIndent:v,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:C,onTaskReparent:w,scrollContainerRef:R}){let F=react.useContext(qo),[T,H]=react.useState(null),[A,ie]=react.useState(null),[S,j]=react.useState(""),le=react.useRef(null),[Le,L]=react.useState(null),[fe,Q]=react.useState(0),[qe,B]=react.useState(0),[ee,we]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[he,We]=react.useState(null),[ke,je]=react.useState(null),[ae,G]=react.useState(null),q=react.useRef(0),me=5,Ne=react.useRef(false),[Xe,U]=react.useState(null),[De,Me]=react.useState(false),Ae=react.useRef(null),[X,I]=react.useState(null),[K,de]=react.useState(false),Se=react.useRef(null);react.useEffect(()=>{function W(ce){Se.current&&!Se.current.contains(ce.target)&&de(false);}if(K)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[K]),react.useEffect(()=>{A&&le.current&&(le.current.focus(),le.current.select());},[A]),react.useEffect(()=>{if(!Le)return;let W=vt=>{let z=vt.clientX-fe,te=qe+z;p?.(Le,te);},ce=()=>{L(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",W),document.addEventListener("mouseup",ce),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",ce),document.body.style.cursor="",document.body.style.userSelect="";}},[Le,fe,qe,p]);let{selectedTaskIds:Ke,handleTaskClick:ot,isTaskSelected:ct}=Bu(),{setIsEditing:Ye}=Lu({tasks:e,selectedTaskIds:Ke,onTaskSelect:(W,ce)=>{let z=Xo(e).map(te=>te.id);ot(W,z,ce||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:W=>{let ce=Xo(e).find(vt=>vt.id===W);ce&&Ee(ce);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:W=>{let ce=Xo(e).find(vt=>vt.id===W);ce&&N&&N(ce);},enableKeyboard:true}),sa=(W,ce=0)=>{let vt=[],z=[...W].sort((te,Ie)=>(te.position??0)-(Ie.position??0));for(let te of z)vt.push({task:te,level:ce}),te.subtasks&&te.subtasks.length>0&&te.isExpanded&&vt.push(...sa(te.subtasks,ce+1));return vt},_=sa(e),Y=48,ge=Math.max(_.length*a,600-Y),et=W=>!W.startDate||!W.endDate?"-":`${Math.ceil((W.endDate.getTime()-W.startDate.getTime())/(1e3*60*60*24))}d`,Ee=W=>{ie(W.id),j(W.name),Ye(true);},Oe=W=>{S.trim()&&S!==e.find(ce=>ce.id===W)?.name&&x?.(W,S.trim()),ie(null),j(""),Ye(false);},oe=()=>{ie(null),j(""),Ye(false);},ye=(W,ce)=>{ce.stopPropagation(),D?.(W.id);},$=(W,ce)=>{ce.preventDefault(),q.current=ce.clientY,We(W),Ne.current=false,Me(false),U({x:ce.clientX,y:ce.clientY});},ne=W=>{if(!he||(Math.abs(W.clientY-q.current)>me&&!Ne.current&&(Ne.current=true,Me(true)),U({x:W.clientX,y:W.clientY}),!Ne.current))return;if(R?.current){let Ie=R.current,dt=Ie.getBoundingClientRect(),Qe=60,qt=12;Ae.current&&(cancelAnimationFrame(Ae.current),Ae.current=null);let ft=W.clientY-dt.top,Fa=dt.bottom-W.clientY;if(ft<Qe&&Ie.scrollTop>0){let Vt=Math.round(qt*(1-ft/Qe)),Ea=()=>{Ie.scrollTop-=Vt,Ne.current&&Ie.scrollTop>0&&(Ae.current=requestAnimationFrame(Ea));};Ae.current=requestAnimationFrame(Ea);}else if(Fa<Qe&&Ie.scrollTop<Ie.scrollHeight-Ie.clientHeight){let Vt=Math.round(qt*(1-Fa/Qe)),Ea=()=>{Ie.scrollTop+=Vt,Ne.current&&Ie.scrollTop<Ie.scrollHeight-Ie.clientHeight&&(Ae.current=requestAnimationFrame(Ea));};Ae.current=requestAnimationFrame(Ea);}}let vt=document.querySelectorAll("[data-task-row]"),z=null,te=null;vt.forEach(Ie=>{let dt=Ie.getBoundingClientRect(),Qe=Ie.getAttribute("data-task-row");if(Qe&&Qe!==he&&W.clientY>=dt.top&&W.clientY<=dt.bottom){z=Qe;let qt=W.clientY-dt.top,ft=dt.height;qt<ft*.25?te="above":qt>ft*.75?te="below":te="child";}}),je(z),G(te);},$e=()=>{if(Ne.current&&he&&ke&&ae){if(ae==="child")w?.(he,ke);else if(ae==="above"||ae==="below"){let W=(te,Ie,dt=null)=>{for(let Qe of te){if(Qe.id===Ie)return dt;if(Qe.subtasks){let qt=W(Qe.subtasks,Ie,Qe.id);if(qt!==void 0)return qt}}},ce=W(e,he,null),vt=W(e,ke,null),z=(te,Ie,dt,Qe)=>{let qt=te.findIndex(Vt=>Vt.id===Ie),ft=Qe?te.findIndex(Vt=>Vt.id===dt):-1,Fa=ae==="below"?qt+1:qt;return Qe&&ft!==-1&&ft<qt&&(Fa-=1),Math.max(0,Fa)};if(vt===null){let Ie=z(e,ke,he,ce===null);w?.(he,null,Ie);}else {let te=_.find(Ie=>Ie.task.id===vt)?.task;if(te?.subtasks){let Ie=ce===vt,dt=z(te.subtasks,ke,he,Ie);w?.(he,vt,dt);}}}}Ae.current&&(cancelAnimationFrame(Ae.current),Ae.current=null),We(null),je(null),G(null),U(null),Ne.current=false,Me(false);};react.useEffect(()=>{if(he)return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",$e),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",$e),document.body.style.cursor="",document.body.style.userSelect="";}},[he,ke,ae]);let Ze=(W,ce,vt)=>{switch(W.id){case "name":let z=A===ce.id,te=T===ce.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${vt*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:te?1:.3},onMouseDown:Fe=>$(ce.id,Fe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ce.subtasks&&ce.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),u?.(ce.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ce.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ce.color||"#3B82F6",opacity:ce.parentId?.6:1,borderColor:ce.isMilestone?t.accent:"transparent",borderWidth:ce.isMilestone?"2px":"0px"},title:ce.isMilestone?"Milestone":ce.parentId?"Subtask":"Task"})}),z?jsxRuntime.jsx("input",{ref:le,type:"text",value:S,onChange:Fe=>j(Fe.target.value),onKeyDown:Fe=>{Fe.key==="Enter"?Oe(ce.id):Fe.key==="Escape"&&oe();},onBlur:()=>Oe(ce.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:Fe=>Fe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ce.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ce.parentId?"13px":"14px",fontWeight:ce.isMilestone?600:ce.parentId?400:600,letterSpacing:ce.parentId?"0":"-0.01em"},title:ce.name,children:ce.name}),te&&!z&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Fe=>Fe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Fe=>ye(ce,Fe),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),Ee(ce);},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 dt=W.id==="startDate"?"startDate":"endDate",Qe=ce[dt],qt=X?.taskId===ce.id&&X?.field===dt,ft=Fe=>Fe?(typeof Fe=="string"?new Date(Fe):Fe).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:Fe=>Fe.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},onClick:Fe=>{if(qt)I(null);else {let Rt=Fe.currentTarget.getBoundingClientRect();I({taskId:ce.id,field:dt,month:Qe?typeof Qe=="string"?new Date(Qe):Qe:new Date,position:{top:Rt.bottom+4,left:Rt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ft(Qe)})]}),qt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>I(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:X?.position.top,left:X?.position.left},onClick:Fe=>Fe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Fe=new Date,Rt=new Date(Fe);Rt.setDate(Fe.getDate()+1);let Ot=new Date(Fe);Ot.setDate(Fe.getDate()+7);let Ar=new Date(Fe);return Ar.setDate(Fe.getDate()+14),[{label:"Hoy",date:Fe},{label:"Ma\xF1ana",date:Rt},{label:"Pr\xF3xima semana",date:Ot},{label:"2 semanas",date:Ar}].map((P,J)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:_e=>_e.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_e=>_e.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ce.id,{[dt]:P.date}),I(null);},children:P.label},J))})(),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:Fe=>Fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ce.id,{[dt]:void 0}),I(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:()=>I(Fe=>Fe?{...Fe,month:new Date(Fe.month.getFullYear(),Fe.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:X?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>I(Fe=>Fe?{...Fe,month:new Date(Fe.month.getFullYear(),Fe.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((Fe,Rt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Fe},Rt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Fe=X?.month||new Date,Rt=Fe.getFullYear(),Ot=Fe.getMonth(),Ar=new Date(Rt,Ot,1).getDay(),Ra=new Date(Rt,Ot+1,0).getDate(),P=new Date,J=[];for(let Ge=Ar-1;Ge>=0;Ge--)J.push({day:new Date(Rt,Ot,-Ge).getDate(),date:new Date(Rt,Ot-1,new Date(Rt,Ot,-Ge).getDate()),isCurrentMonth:false});for(let Ge=1;Ge<=Ra;Ge++)J.push({day:Ge,date:new Date(Rt,Ot,Ge),isCurrentMonth:true});let _e=42-J.length;for(let Ge=1;Ge<=_e;Ge++)J.push({day:Ge,date:new Date(Rt,Ot+1,Ge),isCurrentMonth:false});return J.map((Ge,Yt)=>{let Pa=Ge.date.toDateString()===P.toDateString(),Oa=(Qe?typeof Qe=="string"?new Date(Qe):Qe:null)?.toDateString()===Ge.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:Ge.isCurrentMonth?Oa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Oa?"#3B82F6":"transparent",boxShadow:Pa&&!Oa?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(ce.id,{[dt]:Ge.date}),I(null);},children:Ge.day},Yt)})})()})]})]})]}),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:et(ce)})});case "assignees":let Fa=r.filter(Fe=>ce.assignees?.some(Rt=>Rt.name===Fe.name||Rt.initials===Fe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Fe=>Fe.stopPropagation(),children:jsxRuntime.jsx(fo,{assignedUsers:Fa,availableUsers:r,onChange:Fe=>{let Rt=Fe.map(Ot=>({id:Ot.id,name:Ot.name,initials:Ot.initials,color:Ot.color}));f?.(ce.id,{assignees:Rt.length>0?Rt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Fe=>Fe.stopPropagation(),children:jsxRuntime.jsx(fc,{status:ce.status||"todo",onChange:Fe=>{f?.(ce.id,{status:Fe,progress:Fe==="completed"?100:ce.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${ce.progress}%`,backgroundColor:ce.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:[ce.progress,"%"]})]});case "priority":let Vt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ea={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Wr=Vt[ce.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Fe=>Fe.stopPropagation(),children:jsxRuntime.jsx(po,{priority:Wr,onChange:Fe=>{Fe&&f?.(ce.id,{priority:Ea[Fe]||"medium"});}})});default:return null}},at=W=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>d(W),disabled:W==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],Ve=W=>W.subtasks&&W.subtasks.length>0?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.(W.id);}},{id:"duplicate",label:F?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([W.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C(W.id,W.name):y?.([W.id]);}}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.(W);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.(W.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:F?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{f?.(W.id,{status:"todo",progress:0});},disabled:W.status==="todo"},{id:"setInProgress",label:F?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{f?.(W.id,{status:"in-progress"});},disabled:W.status==="in-progress"},{id:"markComplete",label:F?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{f?.(W.id,{status:"completed",progress:100});},disabled:W.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:F?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([W.id]);}},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C(W.id,W.name):y?.([W.id]);}}],ve=c.filter(W=>W.visible),He=ve.reduce((W,ce)=>W+ce.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:He},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Y}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:ve.map((W,ce)=>{let vt=ce===ve.length-1,z=W.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${z?"":"justify-center"}`,style:{width:`${W.width}px`,minWidth:`${W.minWidth??(z?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:vt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:te=>{te.preventDefault(),we({isOpen:true,x:te.clientX,y:te.clientY,type:"header",columnId:W.id});},onMouseEnter:te=>{te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:te=>{te.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:W.label,children:W.label}),W.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Le===W.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:te=>{te.preventDefault(),te.stopPropagation(),L(W.id),Q(te.clientX),B(W.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"}})})]},W.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(ks,{columns:c,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>de(!K),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"})}),K&&jsxRuntime.jsxs("div",{ref:Se,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:W=>W.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:()=>de(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ge},children:_.map(({task:W,level:ce},vt)=>{let z=ct(W.id),te=ke===W.id,Ie=te&&ae==="above",dt=te&&ae==="below",Qe=te&&ae==="child",qt={};return Qe&&(qt.backgroundColor=`${t.accent}15`,qt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":W.id,className:`flex items-center cursor-pointer group ${he===W.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:z?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:z?t.accentLight:Qe?`${t.accent}15`:vt%2===0?t.bgPrimary:t.bgGrid,...qt},onMouseEnter:()=>H(W.id),onMouseLeave:()=>H(null),onClick:ft=>{let Vt=Xo(e).map(Fe=>Fe.id),Wr=navigator.platform.toUpperCase().indexOf("MAC")>=0?ft.metaKey:ft.ctrlKey;ot(W.id,Vt,Wr,ft.shiftKey),s?.(W);},onDoubleClick:ft=>{ft.stopPropagation(),n?.(W);},onContextMenu:ft=>{ft.preventDefault(),we({isOpen:true,x:ft.clientX,y:ft.clientY,type:"task",task:W}),l?.(W,ft);},whileHover:{backgroundColor:z?t.accentLight:t.hoverBg},children:[Ie&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),dt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ve.map((ft,Fa)=>{let Vt=Fa===ve.length-1,Ea=ft.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ea?"justify-start":"justify-center"}`,style:{width:`${ft.width}px`,minWidth:`${ft.minWidth??(Ea?200:60)}px`,maxWidth:`${ft.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Vt?"none":`1px solid ${T===W.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ze(ft,W,Ea?ce:0)},`${W.id}-${ft.id}`)})]},W.id)})}),jsxRuntime.jsx(Yo,{isOpen:ee.isOpen,x:ee.x,y:ee.y,items:ee.type==="header"&&ee.columnId?at(ee.columnId):ee.type==="task"&&ee.task?Ve(ee.task):[],onClose:()=>we({...ee,isOpen:false}),theme:t}),De&&Xe&&he&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Xe.x+12,top:Xe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let W=_.find(ce=>ce.task.id===he)?.task;return W?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:W.name})}):null})()}),document.body)]})}function Wu(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[u,i]=react.useState(t),[c,d]=react.useState(null),[p,f]=react.useState(null),[v,k]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(0),[x,D]=react.useState(0),[N,C]=react.useState(null),[w,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:f,activeZone:v,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:C,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ie,S)=>{r("none"),d(null),f(null),l(ie),i(S),D(0),y(null),b(0);}}}function Ds({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:f=[],onDragMove:v,onHoverChange:k}){let g=Wu(t,r),y=react.useRef(null),h=react.useRef(null),b=react.useRef(null),{dragMode:x,setDragMode:D,dragOffset:N,setDragOffset:C,ghostX:w,setGhostX:R,ghostWidth:F,setGhostWidth:T,connectionLine:H,setConnectionLine:A,hoveredTaskId:ie,setHoveredTaskId:S,activeZone:j,setActiveZone:le,draggedSegmentIndex:Le,setDraggedSegmentIndex:L,draggedSegmentStartX:fe,setDraggedSegmentStartX:Q,segmentDragOffsetX:qe,setSegmentDragOffsetX:B,hoveredSegmentIndex:ee,setHoveredSegmentIndex:we,isHovered:he,setIsHovered:We,isDragging:ke,isResizing:je,isConnecting:ae,resetDragState:G}=g,q=24,me=8,Ne=e.endDate&&e.endDate<new Date&&e.progress<100,Xe=e.isCriticalPath,U=o.name==="neutral"||o.today==="#1C1917",De=e.status==="completed"||e.progress===100,Me={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},X=e.isCriticalPath||Ne?"#DC2626":e.color?e.color:e.priority&&Me[e.priority]?Me[e.priority]:o.taskBarPrimary,K=($=>$>=80?20:$>=60?15:$>=50?12:10)(r),de=r<50,Se=r<40;react.useEffect(()=>{if(k)if(he&&!ke&&!e.segments){let $=a<100;k({task:e,x:t,y:a,width:r,height:q,showBelow:$});}else k(null);},[he,ke,e,t,a,r,q,k]);let Ke=$=>$.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ot=()=>{let $=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${$} day${$!==1?"s":""}`},ct=$=>Math.round($/s)*s,Ye=$=>{let ne=Math.round($/s),$e=new Date(n);return $e.setDate($e.getDate()+ne),$e},sa=($,ne)=>{for(let $e of f){if($e.id===e.id)continue;let Ze=5;if($>=$e.x-Ze&&$<=$e.x+$e.width+Ze&&ne>=$e.y-Ze&&ne<=$e.y+$e.height+Ze)return $e.id}return null},_=react.useCallback(($,ne,$e)=>{$.preventDefault(),$.stopPropagation();let Ze=y.current?.ownerSVGElement;if(!Ze)return;let at=Ze.createSVGPoint();at.x=$.clientX,at.y=$.clientY;let Ve=at.matrixTransform(Ze.getScreenCTM()?.inverse()),ve=$e!==void 0?$e:t,He=ne;if(!He){let W=Ve.x-ve;$.shiftKey?(He="connect",A({x:t+r,y:a+q/2})):$.ctrlKey||$.metaKey?He="move":$.altKey?He=W<r/2?"resize-start":"resize-end":Se?W<r/2?He="move":He="resize-end":de?W<=K/2?He="resize-start":W>=r-K/2?He="resize-end":He="move":W<=K?He="resize-start":W>=r-K?He="resize-end":He="move";}D(He),We(false),le(null),He==="move"?C(Ve.x-ve):He==="connect"?A({x:t+r,y:a+q/2}):C(0),R(ve),T(r);},[t,r,a,q]),Y=react.useCallback($=>{let ne=y.current?.ownerSVGElement;if(!ne)return;let $e=ne.closest(".gantt-timeline-scroll");if(!$e)return;let Ze=$e.getBoundingClientRect(),at=60,Ve=15,ve=0;if($.clientX<Ze.left+at){let He=Ze.left+at-$.clientX;ve=-Math.min(Ve,He/2);}else if($.clientX>Ze.right-at){let He=$.clientX-(Ze.right-at);ve=Math.min(Ve,He/2);}return ve!==0&&($e.scrollLeft+=ve),ve!==0},[]),ge=react.useCallback($=>{if(x==="none")return;b.current=$;let ne=y.current?.ownerSVGElement;if(!ne)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let at=Y($);at&&!h.current?h.current=window.setInterval(()=>{b.current&&(Y(b.current),ge(b.current));},16):!at&&h.current&&(window.clearInterval(h.current),h.current=null);}let $e=ne.createSVGPoint();$e.x=$.clientX,$e.y=$.clientY;let Ze=$e.matrixTransform(ne.getScreenCTM()?.inverse());if(x==="connect"){A({x:Ze.x,y:Ze.y});let at=sa(Ze.x,Ze.y);S(at);}else if(x==="move"){let at=Ze.x-N,Ve=ct(at);R(Ve),T(r);let ve=Math.round((Ve-t)/s);if(v?.(e.id,ve,true),e.segments&&e.segments.length>0&&Le!==null){let He=Ve-fe;B(He);}}else if(x==="resize-start"){let at=Ze.x,Ve=ct(at),ve=t+r-Ve;ve>=s&&(R(Ve),T(ve));}else if(x==="resize-end"){let at=Ze.x,ve=ct(at)-t;ve>=s&&T(ve);}},[x,t,r,s,N,e,ct,Le,fe,sa,S,A,R,T,B,v,Y]),et=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")ie&&p&&p(e,ie),A(null),S(null);else {let $=e.endDate.getTime()-e.startDate.getTime(),ne,$e,Ze=true;if(x==="move"){if(ne=Ye(w),$e=new Date(ne.getTime()+$),e.segments&&e.segments.length>0&&Le!==null){let at=Math.round(qe/s),Ve=e.segments.map((ce,vt)=>{if(vt===Le){let z=new Date(ce.startDate),te=new Date(ce.endDate);return z.setDate(z.getDate()+at),te.setDate(te.getDate()+at),{startDate:z,endDate:te}}return ce}),ve=Ve.flatMap(ce=>[ce.startDate,ce.endDate]),He=new Date(Math.min(...ve.map(ce=>ce.getTime()))),W=new Date(Math.max(...ve.map(ce=>ce.getTime())));d?.({...e,segments:Ve},He,W),G(t,r);return}}else x==="resize-start"?(ne=Ye(w),$e=e.endDate,ne>$e&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ze=false)):x==="resize-end"?(ne=e.startDate,$e=Ye(w+F),$e<ne&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ze=false)):Ze=false;Ze&&ne&&$e&&($e.getTime()<ne.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ne,$e));}v?.(e.id,0,false),G(t,r);}},[x,w,F,e,d,ie,p,t,r,s,Ye,qe,Le,G,v]);react.useEffect(()=>{if(x==="none")return;let $=$e=>{ge($e);},ne=()=>{et();};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",ne),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",ne),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,ge,et]);let Ee=ke&&!ae?w:t,Oe=ke&&!ae?F:r,oe=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!ke&&u?.(e),onDoubleClick:$=>{ke||($.stopPropagation(),i?.(e));},onContextMenu:$=>{$.preventDefault(),c?.(e,$);},onMouseEnter:()=>!ke&&We(true),onMouseLeave:()=>{ke||(We(false),le(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:q,fill:"transparent",style:{pointerEvents:"all"}}),he&&!ke&&!de&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:K,height:q,fill:j==="resize-start"?o.accent:"transparent",opacity:j==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>le("resize-start"),onMouseDown:$=>_($,"resize-start")}),jsxRuntime.jsx("rect",{x:t+K,y:a,width:r-K*2,height:q,fill:j==="move"?o.accent:"transparent",opacity:j==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>le("move"),onMouseDown:$=>_($,"move")}),jsxRuntime.jsx("rect",{x:t+r-K,y:a,width:K,height:q,fill:j==="resize-end"?o.accent:"transparent",opacity:j==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>le("resize-end"),onMouseDown:$=>_($,"resize-end")})]}),he&&!ke&&Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:q,fill:j==="move"?o.accent:"transparent",opacity:j==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>le("move"),onMouseDown:$=>_($,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:q,fill:j==="resize-end"?o.accent:"transparent",opacity:j==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>le("resize-end"),onMouseDown:$=>_($,"resize-end")}),he&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+q-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ke&&!ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:F,height:q,rx:me,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee,y:a,width:Oe,height:q,rx:me,fill:X,"data-task-class":oe,initial:{opacity:0,scale:.95},animate:{opacity:ke&&!ae?.15:e.parentId?.6:he?.9:.8,scale:he&&!ke?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$=>_($),style:{cursor:ke?ae?"crosshair":je?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ee,y:a,width:Oe*(e.progress/100),height:q,rx:me,fill:X,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map(($,ne)=>{let $e=($.startDate.getTime()-n.getTime())/864e5*s,at=($.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-$e+s,Ve=ke&&x==="move"&&Le===ne,ve=ee===ne,He=Ve?$e+qe:$e;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ke&&we(ne),onMouseLeave:()=>!ke&&we(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:He,y:a,width:at,height:q,rx:me,fill:X,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:ve?.9:.8,scale:ve&&!ke?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:W=>{W.stopPropagation(),L(ne),Q($e),_(W,void 0,$e);},style:{cursor:ke?ae?"crosshair":je?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:He,y:a,width:at*(e.progress/100),height:q,rx:me,fill:X,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ne}`)}),U&&(Ne||Xe)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Xe&&!Ne&&jsxRuntime.jsx("rect",{x:Ee,y:a,width:Oe,height:q,rx:me,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ne&&jsxRuntime.jsx("rect",{x:Ee,y:a,width:Oe,height:q,rx:me,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Oe>60&&!e.segments&&(()=>{let $=l.taskLabel(e),ne=typeof $=="string"?$:e.name,$e=ne.length>Math.floor(Oe/8)?`${ne.substring(0,Math.floor(Oe/8))}...`:ne;return jsxRuntime.jsx("text",{x:Ee+12,y:a+q/2,dominantBaseline:"middle",fill:De?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:De?"line-through":"none"},children:$e})})(),Oe>100&&e.progress>0&&e.progress<100&&!ke&&!e.segments&&jsxRuntime.jsxs("text",{x:Ee+Oe-12,y:a+q/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,"%"]}),e.status&&Oe>80&&!ke&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ee+Oe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ee+Oe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(he||je)&&!ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ee-2,y:a,width:16,height:q,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>le("resize-start"),onMouseLeave:()=>le(null),onMouseDown:$=>{$.stopPropagation(),_($,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee+4,y:a+8,width:3,height:q-16,rx:1.5,fill:j==="resize-start"||x==="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:Ee+Oe-14,y:a,width:16,height:q,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>le("resize-end"),onMouseLeave:()=>le(null),onMouseDown:$=>{$.stopPropagation(),_($,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee+Oe-7,y:a+8,width:3,height:q-16,rx:1.5,fill:j==="resize-end"||x==="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:he&&!ke&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+q/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>le("connect"),onMouseLeave:()=>le(null),onMouseDown:$=>{$.stopPropagation(),_($,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+q/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:j==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ae&&H&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+q/2,x2:H.x,y2:H.y,stroke:ie?o.statusCompleted:o.accent,strokeWidth:ie?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ie?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:H.x,cy:H.y,r:ie?8:6,fill:ie?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ie&&jsxRuntime.jsx(framerMotion.motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(he||ke)&&!ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee-2,y:a-2,width:Oe+4,height:q+4,rx:me+2,fill:"none",stroke:ke?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ke?.6:.4,initial:{opacity:0},animate:{opacity:ke?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+F,y1:0,x2:w+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&!ke&&!e.segments&&!k&&(()=>{let $e=a<100,Ze=$e?a+q+13:a-82-13,at=$e?`M ${Ee+Oe/2-6} ${a+q+3} L ${Ee+Oe/2} ${a+q+13} L ${Ee+Oe/2+6} ${a+q+3}`:`M ${Ee+Oe/2-6} ${a-13} L ${Ee+Oe/2} ${a-3} L ${Ee+Oe/2+6} ${a-13}`,Ve=Ze+22,ve=Ze+40,He=Ze+55,W=Ze+70,ce=$e?Ze+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:$e?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:$e?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:at,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ee+Oe/2-120,y:Ze,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:Ee+Oe/2,y:Ve,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:Ee+Oe/2-110,y:ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ee+Oe/2-70,y:ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ke(e.startDate)}),jsxRuntime.jsx("text",{x:Ee+Oe/2-110,y:He,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ee+Oe/2-70,y:He,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ke(e.endDate)}),jsxRuntime.jsx("text",{x:Ee+Oe/2+10,y:ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ee+Oe/2+65,y:ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot()}),jsxRuntime.jsx("text",{x:Ee+Oe/2+10,y:He,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ee+Oe/2+65,y:He,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:Ee+Oe/2-110,y:W,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ee+Oe/2-50,y:W,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(vt=>vt.name).join(", ").substring(0,30),e.assignees.map(vt=>vt.name).join(", ").length>30?"...":""]})]}),!$e&&jsxRuntime.jsx("text",{x:Ee+Oe/2,y:ce,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Se?"Left: move \u2022 Right: resize":de?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function _u({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:u}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,p=u?s+l+d:s-c-d,f=u?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,k=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,D=T=>T.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let T=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${T} day${T!==1?"s":""}`},C=T=>{if(T==null||T===0)return "N/A";let H=Math.floor(T/60),A=T%60;return H===0?`${A}m`:A===0?`${H}h`:`${H}h ${A}m`},w={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:"};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:u?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:u?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:p,width:240,height:c,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(T=>T.name).join(", ").substring(0,30),r.assignees.map(T=>T.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:C(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.soldEffortMinutes)})]})]})]})})}function Dn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:u,hoverOverlayOnly:i=false}){let[,c]=react.useState(false),[d,p]=react.useState(null),f=r-t,v=f>0,k=Math.abs(f)<5,g=20,y=!k&&a<=e,h,b,x=a-e,D=e+x/2;if(b=D,n==="squared")if(k)h=`M ${e} ${t} L ${a} ${r}`;else if(y){let L=e+15,fe=a-g,Q=v?t+20:t-20;b=fe,h=`M ${e} ${t} L ${L} ${t} L ${L} ${Q} L ${fe} ${Q} L ${fe} ${r} L ${a} ${r}`;}else b=a-g,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${D} ${t}, ${D} ${r}, ${a} ${r}`;let N=5,C=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,w=o.dependency,R=o.dependencyHover||w,F="#f87171",T="rgba(248, 113, 113, 0.15)",H=b,A=(t+r)/2;if(d)if(k)H=Math.max(e+10,Math.min(a-10,d.x)),A=t;else if(y){let Le=e+15,L=a-g,fe=v?t+20:t-20,Q=[[e,t,Le,t],[Le,t,Le,fe],[Le,fe,L,fe],[L,fe,L,r],[L,r,a,r]],qe=1/0,B={x:H,y:A};for(let ee of Q){let we=ie(d.x,d.y,ee[0],ee[1],ee[2],ee[3]),he=Math.hypot(d.x-we.x,d.y-we.y);he<qe&&(qe=he,B=we);}H=B.x,A=B.y;}else {let Le=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],L=1/0,fe={x:H,y:A};for(let Q of Le){let qe=ie(d.x,d.y,Q[0],Q[1],Q[2],Q[3]),B=Math.hypot(d.x-qe.x,d.y-qe.y);B<L&&(L=B,fe=qe);}H=fe.x,A=fe.y;}function ie(Le,L,fe,Q,qe,B){let ee=qe-fe,we=B-Q,he=ee*ee+we*we;if(he===0)return {x:fe,y:Q};let We=((Le-fe)*ee+(L-Q)*we)/he;return We=Math.max(0,Math.min(1,We)),{x:fe+We*ee,y:Q+We*we}}let S=Le=>{let L=Le.currentTarget.ownerSVGElement;if(!L)return;let fe=L.getBoundingClientRect();p({x:Le.clientX-fe.left,y:Le.clientY-fe.top});},j=()=>{c(false),p(null),u?.(false);},le=()=>{c(true),u?.(true);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:j,onMouseMove:S,children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:R,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Le=>{Le.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:H,cy:A,r:9,fill:T,stroke:F,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:H-3,y1:A-3,x2:H+3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+3,y1:A-3,x2:H-3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:le,onMouseLeave:j,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:R,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Le=>{Le.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:H,cy:A,r:9,fill:T,stroke:F,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:H-3,y1:A-3,x2:H+3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+3,y1:A-3,x2:H-3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:le,onMouseLeave:j,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:h,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",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:w,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Es({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:u(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 Te={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,u=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&u(d))return true;if(l.has(d))return true}}return l.delete(i),false};return u(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=Te.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Te.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Te.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=Te.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(`
126
+ `)},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=Te.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=Te.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)=>Te.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Te.findTaskById(e,t);return !a||!a.dependencies?[]:Te.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Te.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Te.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=Te.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=>Te.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=Te.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(u=>{let i=u.startDate&&u.endDate?Te.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?Te.formatDate(u.startDate):"N/A",u.endDate?Te.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=Te.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?Te.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?Te.formatDate(u.startDate):"","End Date":u.endDate?Te.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(c=>c.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Te.flattenTasks(e),o=new Map;r.forEach((p,f)=>{o.set(p.id,f+1);});let s=p=>p.toISOString().replace("Z",""),n=Te.getEarliestStartDate(e)||new Date,l=Te.getLatestEndDate(e)||new Date,u=r.map((p,f)=>{let v=o.get(p.id),k=p.startDate&&p.endDate?Te.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(y=>o.has(y)).map(y=>`
127
127
  <PredecessorLink>
128
- <PredecessorUID>${o.get(v)}</PredecessorUID>
128
+ <PredecessorUID>${o.get(y)}</PredecessorUID>
129
129
  <Type>1</Type>
130
130
  <CrossProject>0</CrossProject>
131
131
  <LinkLag>0</LinkLag>
132
132
  <LagFormat>7</LagFormat>
133
133
  </PredecessorLink>`).join("");return `
134
134
  <Task>
135
- <UID>${x}</UID>
135
+ <UID>${v}</UID>
136
136
  <ID>${f+1}</ID>
137
- <Name>${g.name.replace(/[<>&'"]/g,v=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[v]||v)}</Name>
137
+ <Name>${p.name.replace(/[<>&'"]/g,y=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[y]||y)}</Name>
138
138
  <Type>0</Type>
139
139
  <IsNull>0</IsNull>
140
140
  <CreateDate>${s(new Date)}</CreateDate>
141
141
  <WBS>${f+1}</WBS>
142
142
  <OutlineNumber>${f+1}</OutlineNumber>
143
- <OutlineLevel>${g.level||0}</OutlineLevel>
143
+ <OutlineLevel>${p.level||0}</OutlineLevel>
144
144
  <Priority>500</Priority>
145
- <Start>${g.startDate?s(g.startDate):""}</Start>
146
- <Finish>${g.endDate?s(g.endDate):""}</Finish>
145
+ <Start>${p.startDate?s(p.startDate):""}</Start>
146
+ <Finish>${p.endDate?s(p.endDate):""}</Finish>
147
147
  <Duration>PT${k*8}H0M0S</Duration>
148
148
  <DurationFormat>7</DurationFormat>
149
149
  <Work>PT${k*8}H0M0S</Work>
150
- <Stop>${g.endDate?s(g.endDate):""}</Stop>
151
- <Resume>${g.startDate?s(g.startDate):""}</Resume>
150
+ <Stop>${p.endDate?s(p.endDate):""}</Stop>
151
+ <Resume>${p.startDate?s(p.startDate):""}</Resume>
152
152
  <ResumeValid>0</ResumeValid>
153
153
  <EffortDriven>1</EffortDriven>
154
154
  <Recurring>0</Recurring>
155
155
  <OverAllocated>0</OverAllocated>
156
156
  <Estimated>0</Estimated>
157
- <Milestone>${g.isMilestone?"1":"0"}</Milestone>
158
- <Summary>${g.subtasks&&g.subtasks.length>0?"1":"0"}</Summary>
159
- <Critical>${g.isCriticalPath?"1":"0"}</Critical>
157
+ <Milestone>${p.isMilestone?"1":"0"}</Milestone>
158
+ <Summary>${p.subtasks&&p.subtasks.length>0?"1":"0"}</Summary>
159
+ <Critical>${p.isCriticalPath?"1":"0"}</Critical>
160
160
  <IsSubproject>0</IsSubproject>
161
161
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
162
162
  <ExternalTask>0</ExternalTask>
163
- <EarlyStart>${g.startDate?s(g.startDate):""}</EarlyStart>
164
- <EarlyFinish>${g.endDate?s(g.endDate):""}</EarlyFinish>
165
- <LateStart>${g.startDate?s(g.startDate):""}</LateStart>
166
- <LateFinish>${g.endDate?s(g.endDate):""}</LateFinish>
163
+ <EarlyStart>${p.startDate?s(p.startDate):""}</EarlyStart>
164
+ <EarlyFinish>${p.endDate?s(p.endDate):""}</EarlyFinish>
165
+ <LateStart>${p.startDate?s(p.startDate):""}</LateStart>
166
+ <LateFinish>${p.endDate?s(p.endDate):""}</LateFinish>
167
167
  <StartVariance>0</StartVariance>
168
168
  <FinishVariance>0</FinishVariance>
169
169
  <WorkVariance>0</WorkVariance>
@@ -171,22 +171,22 @@
171
171
  <TotalSlack>0</TotalSlack>
172
172
  <FixedCost>0</FixedCost>
173
173
  <FixedCostAccrual>3</FixedCostAccrual>
174
- <PercentComplete>${g.progress}</PercentComplete>
175
- <PercentWorkComplete>${g.progress}</PercentWorkComplete>
174
+ <PercentComplete>${p.progress}</PercentComplete>
175
+ <PercentWorkComplete>${p.progress}</PercentWorkComplete>
176
176
  <Cost>0</Cost>
177
177
  <OvertimeCost>0</OvertimeCost>
178
178
  <OvertimeWork>PT0H0M0S</OvertimeWork>
179
- <ActualStart>${g.progress>0&&g.startDate?s(g.startDate):""}</ActualStart>
180
- <ActualFinish>${g.progress===100&&g.endDate?s(g.endDate):""}</ActualFinish>
181
- <ActualDuration>PT${Math.round(k*g.progress/100)*8}H0M0S</ActualDuration>
179
+ <ActualStart>${p.progress>0&&p.startDate?s(p.startDate):""}</ActualStart>
180
+ <ActualFinish>${p.progress===100&&p.endDate?s(p.endDate):""}</ActualFinish>
181
+ <ActualDuration>PT${Math.round(k*p.progress/100)*8}H0M0S</ActualDuration>
182
182
  <ActualCost>0</ActualCost>
183
183
  <ActualOvertimeCost>0</ActualOvertimeCost>
184
- <ActualWork>PT${Math.round(k*g.progress/100)*8}H0M0S</ActualWork>
184
+ <ActualWork>PT${Math.round(k*p.progress/100)*8}H0M0S</ActualWork>
185
185
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
186
186
  <RegularWork>PT${k*8}H0M0S</RegularWork>
187
- <RemainingDuration>PT${Math.round(k*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
187
+ <RemainingDuration>PT${Math.round(k*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
188
188
  <RemainingCost>0</RemainingCost>
189
- <RemainingWork>PT${Math.round(k*(100-g.progress)/100)*8}H0M0S</RemainingWork>
189
+ <RemainingWork>PT${Math.round(k*(100-p.progress)/100)*8}H0M0S</RemainingWork>
190
190
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
191
191
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
192
192
  <ACWP>0</ACWP>
@@ -205,17 +205,17 @@
205
205
  <PhysicalPercentComplete>0</PhysicalPercentComplete>
206
206
  <EarnedValueMethod>0</EarnedValueMethod>
207
207
  <IsPublished>1</IsPublished>
208
- <CommitmentType>0</CommitmentType>${p}
208
+ <CommitmentType>0</CommitmentType>${g}
209
209
  </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
210
210
  <Project xmlns="http://schemas.microsoft.com/project">
211
211
  <SaveVersion>14</SaveVersion>
212
- <Name>${t.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Name>
213
- <Title>${t.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Title>
212
+ <Name>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Name>
213
+ <Title>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Title>
214
214
  <CreationDate>${s(new Date)}</CreationDate>
215
215
  <LastSaved>${s(new Date)}</LastSaved>
216
216
  <ScheduleFromStart>1</ScheduleFromStart>
217
217
  <StartDate>${s(n)}</StartDate>
218
- <FinishDate>${s(c)}</FinishDate>
218
+ <FinishDate>${s(l)}</FinishDate>
219
219
  <FYStartDate>1</FYStartDate>
220
220
  <CriticalSlackLimit>0</CriticalSlackLimit>
221
221
  <CurrencyDigits>2</CurrencyDigits>
@@ -353,9 +353,9 @@
353
353
  </Calendars>
354
354
  <Tasks>${u}
355
355
  </Tasks>
356
- </Project>`,m=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(m),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=Le.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let m=i.startDate&&i.endDate?Le.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let x=t.find(k=>k.id===f);if(x){o(x);let k=r.get(f)?.ef||0;l=Math.max(l,k);}}let g=l+m;r.set(i.id,{es:l,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,c=i=>{if(n.has(i.id))return;let m=i.startDate&&i.endDate?Le.calculateDuration(i.startDate,i.endDate):0,l=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),g=s;if(l.length>0)for(let x of l){c(x);let k=n.get(x.id)?.ls||0;g=Math.min(g,k);}let f=g-m;n.set(i.id,{ls:f,lf:g});};a.forEach(c);let u=[];for(let i of a){let m=r.get(i.id),l=n.get(i.id);if(m&&l){let g=l.ls-m.es;Math.abs(g)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=Le.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Le.calculateCriticalPath(e).includes(t))return 0;let o=Le.getDependentTasks(e,t);if(o.length===0){let c=Le.getLatestEndDate(e);if(!c)return null;let u=Le.calculateDuration(a.endDate,c);return Math.max(0,u)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,u)=>c-u)[0];if(!s)return null;let n=Le.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Le.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Le.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Le.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let c=Le.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=Le.calculateEndDate(u,c),m=l=>l.map(g=>g.id===n.id?{...g,startDate:u,endDate:i}:g.subtasks?{...g,subtasks:m(g.subtasks)}:g);s=m(s),s=Le.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,c)=>{if(a===0)return [];let u=[],i=o.getTime(),m=1e3*60*60*24,l=Le.findTaskById(e,t);if(!l||!l.endDate)return [];let g=(f,x,k=new Set)=>{if(k.has(f))return;k.add(f);let p=Le.getDependentTasks(e,f);for(let v of p){if(!v.startDate||!v.endDate)continue;let b=r.findIndex(T=>T.id===v.id);if(b===-1)continue;let h=v.startDate.getTime(),C=(v.endDate.getTime()-h)/m,S=(h-i)/m*s,w=S+x*s,E=Math.max(C*s,s),L=c+b*n+12;u.push({taskId:v.id,taskName:v.name,originalX:S,previewX:w,width:E,y:L,rowIndex:b,daysDelta:x,color:v.color}),g(v.id,x,k);}};return g(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Le.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 c=new Date(o.endDate);c.setDate(c.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:c}],i=m=>m.map(l=>l.id===o.id?{...l,endDate:c,segments:u}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function Us({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:c="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:m,onTaskDblClick:l,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:k}){let v=no(),[b,h]=react.useState([]),[y,C]=react.useState(null),[N,S]=react.useState(null),w=react.useRef(false),[E,L]=react.useState(new Set),[T,z]=react.useState(null),H=react.useCallback(K=>{if(N&&!w.current){let q=K.target,be=false;for(;q&&q!==K.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){be=true;break}q=q.parentElement;}be||S(null);}},[N]),J=react.useCallback(K=>{C(K);},[]),D=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ve=r==="day"?60:r==="week"?20:8,de=D*ve*n,V=K=>{let q=new Date(Date.UTC(K.getFullYear(),K.getMonth(),K.getDate())),be=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-be);let we=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-we.getTime())/864e5+1)/7)},I=K=>{let q=K.getDay();return q===0||q===6},Te=react.useCallback(K=>{let q=Math.round(K/(ve*n)),be=new Date(o);return be.setDate(be.getDate()+q),be},[o,ve,n]),Q=react.useCallback((K,q)=>{if(q.startDate&&q.endDate)return;let be=K.currentTarget.ownerSVGElement;if(!be)return;let we=be.createSVGPoint();we.x=K.clientX,we.y=K.clientY;let Je=we.matrixTransform(be.getScreenCTM()?.inverse()),G=Te(Je.x),he=new Date(G);he.setDate(he.getDate()+1),z(null),f?.(q,G,he);},[Te,f]),et=react.useCallback((K,q,be)=>{let we=K.currentTarget.ownerSVGElement;if(!we)return;let Je=we.createSVGPoint();Je.x=K.clientX,Je.y=K.clientY;let G=Je.matrixTransform(we.getScreenCTM()?.inverse()),he=Te(G.x),Ie=Math.round(G.x/(ve*n))*ve*n;z({taskId:q.id,x:Ie,y:be*a+a/2,date:he});},[Te,ve,n,a]),$=react.useCallback(()=>{z(null);},[]),ae=react.useMemo(()=>{let K=Je=>Je.map(G=>{if(G.subtasks&&G.subtasks.length>0){let he=K(G.subtasks),je=he.filter(Ie=>Ie.startDate&&Ie.endDate);if(je.length>0){let Ie=je.map(X=>X.startDate.getTime()),Ke=je.map(X=>X.endDate.getTime()),O=new Date(Math.min(...Ie)),ne=new Date(Math.max(...Ke));return {...G,subtasks:he,startDate:O,endDate:ne}}return {...G,subtasks:he}}return G}),q=(Je,G=[])=>{let he=[...Je].sort((je,Ie)=>(je.position??0)-(Ie.position??0));for(let je of he)G.push(je),je.subtasks&&je.subtasks.length>0&&(je.isExpanded===void 0||je.isExpanded)&&q(je.subtasks,G);return G},be=K(e);return q(be)},[e]),Re=react.useCallback(K=>{if(!K.startDate||!K.endDate)return {x:0,width:0};let q=K.startDate.getTime(),be=K.endDate.getTime(),we=o.getTime(),Je=(q-we)/(1e3*60*60*24),G=(be-q)/(1e3*60*60*24),he=Je*ve*n,je=Math.max(ve*n,40),Ie=Math.max(G*ve*n,je);return {x:he,width:Ie}},[o,ve,n]),ke=react.useMemo(()=>ae.filter(K=>K.startDate&&K.endDate).map(K=>{let{x:q,width:be}=Re(K),Je=ae.findIndex(G=>G.id===K.id)*a+14;return {id:K.id,x:q,y:Je,width:be,height:24}}),[ae,Re]),Ze=react.useCallback((K,q,be)=>{if(!be||q===0){h([]);return}let we=Le.calculateCascadePreview(e,K,q,ae,o,ve*n,a,48);h(we);},[e,ae,o,ve,n,a,48]),Ee=react.useMemo(()=>{let K=[],q=new Date(o);for(;q<=s;){let Je=(q.getTime()-o.getTime())/864e5*ve*n;if(r==="day")K.push({date:new Date(q),label:q.toLocaleDateString(c,{day:"numeric",month:"short"}),x:Je}),q.setDate(q.getDate()+1);else if(r==="week"){let G=V(q);K.push({date:new Date(q),label:`${v.labels.week} ${G}`,x:Je}),q.setDate(q.getDate()+7);}else K.push({date:new Date(q),label:q.toLocaleDateString(c,{month:"short",year:"numeric"}),x:Je}),q.setMonth(q.getMonth()+1);}return K},[o,s,r,ve,n,c,v.labels.week]),ze=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ve*n,[o,ve,n]),re=Math.max(ae.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(de,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(de,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),Ee.map((K,q)=>jsxRuntime.jsxs("g",{children:[q>0&&jsxRuntime.jsx("line",{x1:K.x,y1:0,x2:K.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:K.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:K.label})]},`header-${q}`)),ze>=0&&ze<=de&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:ze,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:ze,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${ze-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:"TODAY"})]})]})]})}),jsxRuntime.jsxs("svg",{width:Math.max(de,1e3),height:re,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:H,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:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(-45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"10",stroke:"rgba(255,255,255,0.015)",strokeWidth:"5"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(de,1e3),height:re,fill:t.bgPrimary}),Ee.map((K,q)=>{let be=Ee[q+1]?.x||de,we=I(K.date);return jsxRuntime.jsxs("g",{children:[we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:K.x,y:0,width:be-K.x,height:ae.length*a,fill:t.neonRedGlow?"rgba(17,17,17,0.4)":t.bgWeekend,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("rect",{x:K.x,y:0,width:be-K.x,height:ae.length*a,fill:"url(#weekend-hatch)",opacity:1})]}),q>0&&jsxRuntime.jsx("line",{x1:K.x,y1:0,x2:K.x,y2:ae.length*a,stroke:t.borderLight,strokeWidth:1,opacity:t.neonRedGlow?1:.1})]},q)}),ae.map((K,q)=>{let be=K.startDate&&K.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:q*a,width:de,height:a,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${K.id}`),!be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:q*a,width:de,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:we=>Q(we,K),onMouseMove:we=>et(we,K,q),onMouseLeave:()=>{$();}},`clickable-${K.id}`),T&&T.taskId===K.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:T.x,y1:q*a+4,x2:T.x,y2:q*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:T.x,cy:T.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:T.x,cy:T.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${q*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:T.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!T||T.taskId!==K.id)&&jsxRuntime.jsx("text",{x:ze>0?ze:100,y:q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${K.id}`)]})]},`row-group-${K.id}`)}),ae.map((K,q)=>{if(!K.startDate||!K.endDate)return null;let{x:be,width:we}=Re(K),Je=q*a+14,G=K.subtasks&&K.subtasks.length>0&&!K.isMilestone;if(K.isMilestone)return jsxRuntime.jsx($s,{task:K,x:be+we/2,y:Je+12,theme:t,onClick:m},K.id);if(G){let je=Je+10,Ie=5,Ke=t.taskBarPrimary,O=we*(K.progress/100);return jsxRuntime.jsxs("g",{onClick:()=>m?.(K),onContextMenu:ne=>{ne.preventDefault(),ne.stopPropagation(),g?.(K,ne);},onMouseEnter:()=>{J({task:K,x:be,y:je,width:we,height:8,showBelow:je<100});},onMouseLeave:()=>J(null),style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:be,y:Je,width:we,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:be,y:je,width:we,height:8,fill:Ke,opacity:.35,rx:2}),K.progress>0&&jsxRuntime.jsx("rect",{x:be,y:je,width:O,height:8,fill:Ke,opacity:1,rx:2,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${be} ${je} L ${be+Ie} ${je} L ${be} ${je+8+Ie} Z`,fill:Ke,opacity:.9}),jsxRuntime.jsx("path",{d:`M ${be+we-Ie} ${je} L ${be+we} ${je} L ${be+we} ${je+8+Ie} Z`,fill:Ke,opacity:.9}),we>60&&jsxRuntime.jsx("text",{x:be+12,y:je+8/2,dominantBaseline:"middle",fill:t.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:K.name.length>Math.floor(we/8)?`${K.name.substring(0,Math.floor(we/8))}...`:K.name})]},K.id)}return jsxRuntime.jsx(Rs,{task:K,x:be,y:Je,width:we,theme:t,dayWidth:ve*n,startDate:o,templates:u,onClick:m,onDoubleClick:l,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:ke,onDragMove:Ze,onHoverChange:J},K.id)}),ae.map((K,q)=>!K.dependencies||K.dependencies.length===0||!K.startDate||!K.endDate?null:K.dependencies.map(be=>{let we=ae.find(X=>X.id===be);if(!we||!we.startDate||!we.endDate)return null;let Je=ae.findIndex(X=>X.id===be),G=Re(we),he=Re(K),je=G.x+G.width,Ie=Je*a+26,Ke=he.x,O=q*a+26,ne=`dep-${be}-${K.id}`;return E.has(ne)?null:jsxRuntime.jsx(An,{x1:je,y1:Ie,x2:Ke,y2:O,theme:t,lineStyle:i,onDelete:()=>k?.(K.id,be),onHoverChange:X=>{w.current=X,X&&S({key:ne,fromId:be,toId:K.id,exitX:je,exitY:Ie,enterX:Ke,enterY:O});}},ne)})),b.map(K=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:K.previewX,y:K.y-48,width:K.width,height:32,rx:8,fill:K.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(K.daysDelta)>0&&jsxRuntime.jsx("text",{x:K.previewX+K.width/2,y:K.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:K.daysDelta>0?`+${K.daysDelta}d`:`${K.daysDelta}d`})]},`cascade-preview-${K.taskId}`)),N&&jsxRuntime.jsx(An,{x1:N.exitX,y1:N.exitY,x2:N.enterX,y2:N.enterY,theme:t,lineStyle:i,onDelete:()=>{let K=N.key;S(null),w.current=false,L(q=>new Set(q).add(K)),k?.(N.toId,N.fromId);},hoverOverlayOnly:true,onHoverChange:K=>{w.current=K,K||S(null);}},`${N.key}-hover-overlay`),ze>=0&&ze<=de&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:ze,y1:0,x2:ze,y2:re,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:ze,y1:0,x2:ze,y2:re,stroke:t.today,strokeWidth:1,opacity:1})]}),y&&jsxRuntime.jsx(um,{tooltipData:y,theme:t,locale:c==="es"?"es":"en"})]})]})}var ox=['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"'],gm=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),nx=()=>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"})}),sx=()=>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"})}),ix=()=>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"})}),lx=()=>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 Gs({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:c,onDependencyDelete:u}){let[i,m]=react.useState(false),[l,g]=react.useState(false),[f,x]=react.useState([]),[k,p]=react.useState(""),[v,b]=react.useState(false),[h,y]=react.useState(true),[C,N]=react.useState(""),[S,w]=react.useState(-1),[E,L]=react.useState(false),[T,z]=react.useState(0),H=react.useRef(null),J=react.useRef(null),D=react.useRef(null),ve=react.useRef(null),{enabled:de=true,placeholder:V='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:Te,suggestions:Q=ox,maxHistory:et=50,persistHistory:$,mentionableUsers:ae=[]}=a,Re=$?.storageKey||"gantt-ai-history",ke=$?.maxMessages??5,Ze=ae.filter(G=>{if(!C)return true;let he=C.toLowerCase();return G.name.toLowerCase().includes(he)||G.email&&G.email.toLowerCase().includes(he)}).slice(0,5),Ee=react.useCallback(G=>{if(p(G),ae.length===0)return;let he=H.current;if(!he)return;let je=he.selectionStart||G.length,Ie=G.slice(0,je),Ke=Ie.lastIndexOf("@");if(Ke>=0&&((Ke>0?Ie[Ke-1]:" ")===" "||Ke===0)){let ne=Ie.slice(Ke+1);if(ne.length<=40){N(ne),w(Ke),L(true),z(0);return}}L(false),N(""),w(-1);},[ae.length]),ze=react.useCallback(G=>{let he=k.slice(0,S),je=k.slice(S+1+C.length),Ie=`${he}@${G.name} ${je}`;p(Ie),L(false),N(""),w(-1),setTimeout(()=>H.current?.focus(),0);},[k,S,C]),re=react.useCallback(G=>{if(!E||Ze.length===0)return false;if(G.key==="ArrowDown")return G.preventDefault(),z(he=>he<Ze.length-1?he+1:0),true;if(G.key==="ArrowUp")return G.preventDefault(),z(he=>he>0?he-1:Ze.length-1),true;if(G.key==="Enter"||G.key==="Tab"){G.preventDefault();let he=Ze[T];return he&&ze(he),true}return G.key==="Escape"?(L(false),true):false},[E,Ze,T,ze]);react.useEffect(()=>{if($?.enabled)try{let G=localStorage.getItem(Re);if(G){let je=JSON.parse(G).map(Ie=>({...Ie,timestamp:new Date(Ie.timestamp)}));x(je.slice(-ke));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[$?.enabled,Re,ke]),react.useEffect(()=>{if($?.enabled&&f.length>0)try{let G=f.filter(he=>!he.isLoading).slice(-ke);localStorage.setItem(Re,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[f,$?.enabled,Re,ke]),react.useEffect(()=>{J.current&&J.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!l&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,l]);let K=react.useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&c?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&u?.(G.taskId,G.dependencyFrom);break}},[o,s,n,c,u]),q=react.useCallback(async G=>{if(!G.trim()||v)return;let he={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};x(Ie=>[...Ie.slice(-(et-1)),he]),p(""),y(false),b(true);let je={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(Ie=>[...Ie,je]);try{if(Te){let Ie=await Te(G,e);x(Ke=>{let O=Ke.filter(X=>!X.isLoading),ne={id:`assistant-${Date.now()}`,role:"assistant",content:Ie.message,timestamp:new Date,command:Ie};return [...O,ne]}),K(Ie);}else x(Ie=>[...Ie.filter(O=>!O.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(Ie){x(Ke=>[...Ke.filter(ne=>!ne.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Ie instanceof Error?Ie.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[v,et,Te,e,K]),be=G=>{G.preventDefault(),q(k);},we=G=>{p(G),H.current?.focus();};if(react.useEffect(()=>{let G=he=>{(he.metaKey||he.ctrlKey)&&he.key==="k"&&(he.preventDefault(),m(je=>!je),i||g(false)),he.key==="Escape"&&i&&m(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),react.useEffect(()=>{if(!i)return;let G=je=>{let Ie=je.target;D.current&&!D.current.contains(Ie)&&m(false);},he=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(he),document.removeEventListener("mousedown",G);}},[i]),!de)return null;let Je={"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(Pt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${Je[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsxRuntime.jsx(gm,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:D,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Je[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(gm,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ix,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(sx,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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:[f.length===0&&h&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Q.slice(0,4).map((G,he)=>jsxRuntime.jsx("button",{onClick:()=>we(G),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:G.length>30?G.slice(0,30)+"...":G},he))})]}),f.map(G=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsxRuntime.jsx(lx,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsxRuntime.jsx("div",{ref:J})]}),jsxRuntime.jsxs("form",{onSubmit:G=>{if(E&&Ze.length>0){G.preventDefault();return}be(G);},className:"p-3 border-t relative",style:{borderColor:t.border},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&Ze.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ve,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:t.bgSecondary,border:`1px solid ${t.border}`,boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.25)"},children:Ze.map((G,he)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>ze(G),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:he===T?"rgba(59, 130, 246, 0.15)":"transparent",color:t.textPrimary},onMouseEnter:()=>z(he),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:"linear-gradient(135deg, #3B82F6 0%, #6366F1 100%)",color:"white"},children:G.name.split(" ").map(je=>je[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:G.name}),G.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:t.textSecondary},children:G.email})]})]},G.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:k,onChange:G=>Ee(G.target.value),onKeyDown:G=>{re(G);},placeholder:V,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(nx,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function fm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,m=true)=>{r(l=>{let g=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:g};if(!m)return {...l,present:g};let f=[...l.past,l.present];return f.length>t&&f.shift(),{past:f,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let m=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:m,future:[i.present,...i.future]}});},[]),c=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let m=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:m,future:l}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function bm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=c?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!c&&u&&n.key==="y"){n.preventDefault(),t();return}if(c&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var mx={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Le.formatDate(e.startDate)} - ${Le.formatDate(e.endDate)}`);let a=Le.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=>Le.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function hm(e){return {...mx,...e}}var vx=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},vm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:c="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:m=[],templates:l,enableAutoCriticalPath:g=true,persistExpandedState:f,persistFilter:x,clearFiltersKey:k,aiAssistant:p,locale:v="en",customTranslations:b,showCreateTaskButton:h=false,createTaskLabel:y,onCreateTask:C,taskFilter:N,onTaskFilterChange:S,onThemeChange:w,onTaskClick:E,onTaskDblClick:L,onTaskContextMenu:T,onTaskUpdate:z,onProgressChange:H,onTaskEdit:J,onTaskAddSubtask:D,onTaskMarkIncomplete:ve,onTaskSetInProgress:de,onDependencyCreate:V,onDependencyDelete:I,onBeforeTaskAdd:Te,onAfterTaskAdd:Q,onBeforeTaskUpdate:et,onAfterTaskUpdate:$,onBeforeTaskDelete:ae,onAfterTaskDelete:Re,permissions:ke}=a,Ee=react.useContext(Ds)?.theme,[ze,re]=react.useState(Ee||s||"dark"),[K,q]=react.useState(n),[be,we]=react.useState(c),[Je,G]=react.useState(1),he=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[je,Ie]=react.useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let Y=JSON.parse(F);if(Y.taskFilter)return Y.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Ke=N??je,O=S??Ie,[ne,X]=react.useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let Y=JSON.parse(F);if(typeof Y.hideCompleted=="boolean")return Y.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=he();if(M)try{let F={taskFilter:Ke,hideCompleted:ne};localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[Ke,ne,he]);let Me=react.useRef(k);react.useEffect(()=>{if(Me.current!==k&&k!==void 0){Ie("all"),X(false);let M=he();if(M)try{localStorage.removeItem(M);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}Me.current=k;},[k,he]);let[Ve,tt]=react.useState(0),[rt,_e]=react.useState(false),[Nt,ht]=react.useState(null),[xt,yt]=react.useState({isOpen:false,x:0,y:0,task:null}),[U,Oe]=react.useState(null),[Qe,Ne]=react.useState(null);react.useEffect(()=>{Ee&&Ee!==ze&&re(Ee);},[Ee]),react.useEffect(()=>{s&&s!==ze&&re(s);},[s]);let $e=react.useCallback(M=>{re(M),w?.(M);},[w]),{state:me,setState:R,undo:j,redo:Be,canUndo:De,canRedo:fe,clearHistory:Ce}=fm(t,50),ee=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),B=react.useRef(new Map),_=react.useRef(false);if(!_.current&&f){_.current=true;let M=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(M);if(F){let Y=JSON.parse(F);Array.isArray(Y)&&(B.current=new Map(Y));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Pe=react.useCallback(()=>{let M=ee();if(M)try{let F=Array.from(B.current.entries());localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[ee]),A=react.useRef(0),Z=react.useRef(false);react.useEffect(()=>{if(A.current>0){A.current-=1;return}let M=Y=>{let le=new Map;for(let ye of Y){let Ae=ye.id;le.get(Ae)||le.set(Ae,ye);}return Array.from(le.values())},F=Y=>Y.map(le=>{let ye=B.current.get(le.id),Ae=ye!==void 0?{...le,isExpanded:ye}:le;if(Ae.subtasks?.length){let Et=M(Ae.subtasks);return {...Ae,subtasks:F(Et)}}return Ae});if(B.current.size>0)R(mr(F(t)));else {let Y=le=>le.map(ye=>ye.subtasks?.length?{...ye,subtasks:M(Y(ye.subtasks))}:ye);R(mr(Y(t)));}},[t,R]);let ce=react.useRef(t),He=react.useRef(true);react.useEffect(()=>{if(He.current){He.current=false,ce.current=me;return}if(Z.current){Z.current=false,ce.current=me;return}if(!r)return;let M=JSON.stringify(ce.current),F=JSON.stringify(me);M!==F&&(ce.current=me,r(me));},[me,r]);let ue=react.useMemo(()=>Cl(v,b),[v,b]),it=react.useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[dt,Dt]=react.useState(()=>it(ue));react.useEffect(()=>{Dt(M=>M.map(F=>({...F,label:ue.columns[F.id==="name"?"taskName":F.id]||F.label})));},[ue]);let Ft=react.useMemo(()=>dt.filter(F=>F.visible).reduce((F,Y)=>F+Y.width,0),[dt]),Kt=react.useRef(dt.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=dt.filter(le=>le.visible),F=M.map(le=>le.id).join(","),Y=Kt.current;if(F!==Y){let le=M.some(Ae=>Ae.id!=="name"),ye=Y.includes(",");le?!ye&&le&&ht(null):ht(null),Kt.current=F;}},[dt]);let nr=60,La=.6,Fe=react.useMemo(()=>{let F=Ft+nr,Y=typeof window<"u"?window.innerWidth*La:800,le=Math.max(F,Y);return Nt!==null?Math.max(200,Math.min(Nt,le)):Math.max(200,F)},[Nt,Ft]),St=react.useRef(null),sa=react.useRef(null),ma=react.useRef(null),P=react.useRef(null),oe=react.useMemo(()=>$u(ze),[ze]),Xe=react.useMemo(()=>({theme:oe,themeName:ze}),[oe,ze]),nt=react.useMemo(()=>hm(l),[l]),mt=react.useMemo(()=>{if(!g)return me;let M=Le.calculateCriticalPath(me),F=Y=>Y.map(le=>({...le,isCriticalPath:M.includes(le.id),subtasks:le.subtasks?F(le.subtasks):void 0}));return F(me)},[me,g]),Ia=react.useMemo(()=>{if(Ke==="all"&&!ne)return mt;let M=F=>{let Y=[];for(let le of F){let ye=le.subtasks?.length?M(le.subtasks):void 0,Ae=false;if(ne)Ae=le.progress<100;else switch(Ke){case "all":Ae=true;break;case "incomplete":Ae=le.progress<100;break;case "in_progress":Ae=le.progress>0&&le.progress<100;break;case "completed":Ae=le.progress===100;break}(Ae||ye&&ye.length>0)&&Y.push({...le,subtasks:ye});}return Y};return M(mt)},[mt,Ke,ne]),ia=vx(be);bm({undo:j,redo:Be,canUndo:De,canRedo:fe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>Le.findTaskById(me,M),addTask:(M,F)=>{R(Y=>{if(!F)return [...Y,{...M,level:0}];let le=ye=>ye.map(Ae=>Ae.id===F?{...Ae,subtasks:[...Ae.subtasks||[],{...M,parentId:F,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:le(Ae.subtasks)}:Ae);return le(Y)});},updateTask:(M,F)=>{R(Y=>{let le=ye=>ye.map(Ae=>Ae.id===M?{...Ae,...F}:Ae.subtasks?{...Ae,subtasks:le(Ae.subtasks)}:Ae);return le(Y)});},deleteTask:M=>{R(F=>{let Y=le=>le.filter(ye=>ye.id===M?false:(ye.subtasks&&(ye.subtasks=Y(ye.subtasks)),true));return Y(F)});},deleteTasks:M=>{R(F=>Ll(F,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let F=Le.findTaskById(me,M);F&&a.onTaskDuplicate(F);}else R(F=>Sn(F,[M]).tasks);},splitTask:(M,F,Y=3)=>{R(le=>Le.splitTask(le,M,F,Y));},calculateEndDate:Le.calculateEndDate,calculateDuration:Le.calculateDuration,validateDependency:(M,F)=>!Le.validateDependencies(me,M,F),getAllTasks:()=>Le.flattenTasks(me),getTasksByStatus:M=>Le.flattenTasks(me).filter(F=>F.status===M),getTasksByParent:M=>M?Le.findTaskById(me,M)?.subtasks||[]:me.filter(Y=>!Y.parentId),getCriticalPath:()=>Le.flattenTasks(me).filter(M=>M.isCriticalPath),indentTask:M=>{R(F=>mr(Pl(F,[M])));},outdentTask:M=>{R(F=>mr(Fl(F,[M])));},moveTask:(M,F)=>{R(Y=>Al(Y,[M],F));},createSubtask:async M=>{let{tasks:F,newTask:Y}=Rl(me,M);if(Te){let le=Te({...Y,parentId:M});if((le instanceof Promise?await le:le)===false)return}R(mr(F)),Q&&Q({...Y,parentId:M});},scrollToTask:M=>{let Y=Le.flattenTasks(me).findIndex(le=>le.id===M);if(Y!==-1&&St.current){let le=Y*ia;St.current.scrollTo({top:le,behavior:"smooth"}),ma.current&&ma.current.scrollTo({top:le,behavior:"smooth"});}},highlightTask:(M,F=2e3)=>{},expandTask:M=>{R(F=>{let Y=le=>le.map(ye=>ye.id===M?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(F)});},collapseTask:M=>{R(F=>{let Y=le=>le.map(ye=>ye.id===M?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(F)});},expandAll:()=>{R(M=>{let F=Y=>Y.map(le=>({...le,isExpanded:true,subtasks:le.subtasks?F(le.subtasks):void 0}));return F(M)});},collapseAll:()=>{R(M=>{let F=Y=>Y.map(le=>({...le,isExpanded:false,subtasks:le.subtasks?F(le.subtasks):void 0}));return F(M)});},undo:j,redo:Be,canUndo:()=>De,canRedo:()=>fe,clearHistory:Ce,exportToPNG:async()=>{if(!P.current||!St.current||!ma.current)throw new Error("Gantt container not found");let M=P.current,F=St.current.querySelector(".gantt-grid-scroll"),Y=ma.current,le=F?.scrollTop||0,ye=Y.scrollTop,Ae=M.style.overflow,Et=M.style.height;try{let st=F?.querySelector(".gantt-taskgrid-content"),Ca=Y.querySelector("svg"),Mt=st?.scrollHeight||F?.scrollHeight||600,Ta=Ca?.getBoundingClientRect().height||Y.scrollHeight,ho=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Mt,Ta)+20;F&&(F.scrollTop=0),Y.scrollTop=0,M.style.overflow="visible",M.style.height=`${ho}px`,await new Promise(Yr=>setTimeout(Yr,100));let Mr=await xm__default.default(M,{backgroundColor:oe.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Yr=>{let zo=window.getComputedStyle(Yr),yo=parseInt(zo.zIndex,10);return !isNaN(yo)&&yo>=50||zo.position==="fixed"}});return new Promise((Yr,zo)=>{Mr.toBlob(yo=>{yo?Yr(yo):zo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=Ae,M.style.height=Et,F&&(F.scrollTop=le),Y.scrollTop=ye;}},exportToPDF:async M=>{await Le.exportToPDF(me,M);},exportToExcel:async M=>{await Le.exportToExcel(me,M);},exportToJSON:()=>Le.exportToJSON(me),exportToCSV:()=>Le.exportToCSV(me),importFromJSON:M=>{let F=Le.importFromJSON(M);R(F);},getTasks:()=>me,refresh:()=>{R(M=>[...M]);},clearAll:()=>{R([]);}}),[me,j,Be,De,fe,Ce,oe,ia]);let sr=react.useCallback(M=>{Dt(F=>F.map(Y=>Y.id===M?{...Y,visible:!Y.visible}:Y));},[]),ha=react.useCallback((M,F)=>{Dt(Y=>Y.map(le=>{if(le.id!==M)return le;let ye=le.minWidth??100,Ae=le.maxWidth??800,Et=Math.max(ye,Math.min(Ae,F));return {...le,width:Et}}));},[]),Ha=react.useCallback(M=>{R(F=>{let Y=Bl(F,M),le=ye=>{for(let Ae of ye){if(Ae.id===M){B.current.set(M,Ae.isExpanded??true);return}Ae.subtasks?.length&&le(Ae.subtasks);}};return le(Y),Pe(),Y}),a.onTaskToggleExpand?.(M);},[a,Pe]),Er=react.useCallback((M,F)=>{if(et&&et(M,F)===false)return;let le=Le.findTaskById(me,M)?.progress,ye=Et=>Et.map(st=>st.id===M?{...st,...F}:st.subtasks?{...st,subtasks:ye(st.subtasks)}:st);R(ye(me));let Ae=Le.findTaskById(ye(me),M);Ae&&(z?.(Ae),$?.(Ae),F.progress!==void 0&&le!==void 0&&F.progress!==le&&H?.(M,le,F.progress));},[me,z,et,$,H]),qg=react.useCallback(M=>{M.length!==0&&(A.current+=1,Z.current=true,R(F=>mr(Pl(F,M))),a.onTaskIndent?.(M[0]));},[a]),Xg=react.useCallback(M=>{M.length!==0&&(A.current+=1,Z.current=true,R(F=>mr(Fl(F,M))),a.onTaskOutdent?.(M[0]));},[a]),Jg=react.useCallback((M,F,Y)=>{A.current+=1,Z.current=true,R(le=>mr(rm(le,M,F,Y))),a.onTaskReparent?.(M,F,Y);},[a]),Zg=react.useCallback((M,F)=>{M.length!==0&&(A.current+=1,Z.current=true,R(Y=>Al(Y,M,F)),a.onTaskMove?.(M[0],F));},[a]),bi=react.useCallback(async M=>{let F=[];for(let Y of M)ae&&await Promise.resolve(ae(Y))===false||F.push(Y);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(R(Y=>mr(Ll(Y,F))),F.forEach(Y=>a.onTaskDelete?.(Y))),Re&&F.forEach(Y=>Re(Y)));},[a,ae,Re]),Qg=react.useCallback(M=>{a.onTaskDuplicate?M.forEach(F=>{let Y=Le.findTaskById(me,F);Y&&a.onTaskDuplicate(Y);}):R(F=>Sn(F,M).tasks);},[a,me]),e0=react.useCallback((M,F)=>{R(Y=>{let{tasks:le,newTask:ye}=am(Y,M,F);return Te&&Te(ye)===false?Y:(a.onTaskCreate?.(ye.parentId,ye.position||0),Q?.(ye),le)});},[a,Te,Q]),t0=react.useCallback((M,F)=>{R(Y=>Il(Y,M,F)),a.onTaskRename?.(M,F);},[a]),hi=react.useCallback(M=>{let{onTaskAddSubtask:F}=a;if(F){let Y=As(me,M);if(Y){F(Y);return}}R(Y=>{let{tasks:le}=Rl(Y,M);return a.onTaskCreate?.(M,0),le});},[a,me]),a0=react.useCallback((M,F,Y)=>{let le=!M.startDate&&!M.endDate,ye=M.startDate?Math.round((F.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Ae=Ca=>Ca.map(Mt=>Mt.id===M.id?{...Mt,startDate:F,endDate:Y,...M.segments&&{segments:M.segments}}:Mt.subtasks?{...Mt,subtasks:Ae(Mt.subtasks)}:Mt),Et=Ae(me);Et=Le.autoScheduleDependents(Et,M.id,ye),Et=mr(Et),R(Et);let st={...M,startDate:F,endDate:Y};le&&a?.onTaskDateChange?a.onTaskDateChange(M,F,Y):z?.(st);},[me,z,a]),r0=react.useCallback((M,F)=>{T?.(M,F),yt({isOpen:true,x:F.clientX,y:F.clientY,task:M});},[T]),o0=react.useCallback((M,F)=>{let Y=Le.splitTask(me,M.id,F);R(Y),yt({isOpen:false,x:0,y:0,task:null});},[me]),qd=react.useCallback(M=>{let F=Le.findTaskById(me,M.id)||M;L?.(F),J||Oe(F);},[me,L,J]),Xd=react.useCallback((M,F,Y)=>{let le=new Map,ye=Mt=>{Mt.forEach(Ta=>{Ta.dependencies&&le.set(Ta.id,Ta.dependencies),Ta.subtasks&&ye(Ta.subtasks);});};ye(Y);let Ae=le.get(F)||[];le.set(F,[...Ae,M]);let Et=new Set,st=new Set,Ca=Mt=>{if(!Et.has(Mt)){Et.add(Mt),st.add(Mt);let Ta=le.get(Mt)||[];for(let ir of Ta){if(!Et.has(ir)&&Ca(ir))return true;if(st.has(ir))return true}}return st.delete(Mt),false};return Ca(F)},[]),Jd=react.useCallback((M,F)=>{if(Xd(M.id,F,me)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
356
+ </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Te.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(k=>k.id===f);if(v){o(v);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(d.length>0)for(let v of d){l(v);let k=n.get(v.id)?.ls||0;p=Math.min(p,k);}let f=p-c;n.set(i.id,{ls:f,lf:p});};a.forEach(l);let u=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=Te.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Te.calculateCriticalPath(e).includes(t))return 0;let o=Te.getDependentTasks(e,t);if(o.length===0){let l=Te.getLatestEndDate(e);if(!l)return null;let u=Te.calculateDuration(a.endDate,l);return Math.max(0,u)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,u)=>l-u)[0];if(!s)return null;let n=Te.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Te.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Te.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Te.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=Te.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=Te.calculateEndDate(u,l),c=d=>d.map(p=>p.id===n.id?{...p,startDate:u,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=Te.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,d=Te.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(f,v,k=new Set)=>{if(k.has(f))return;k.add(f);let g=Te.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(T=>T.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),D=(y.endDate.getTime()-b)/c,C=(b-i)/c*s,w=C+v*s,R=Math.max(D*s,s),F=l+h*n+12;u.push({taskId:y.id,taskName:y.name,originalX:C,previewX:w,width:R,y:F,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,k);}};return p(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Te.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ms({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:k}){let y=eo(),[h,b]=react.useState([]),[x,D]=react.useState(null),[N,C]=react.useState(null),w=react.useRef(false),[R,F]=react.useState(new Set),[T,H]=react.useState(null),A=react.useCallback(G=>{if(N&&!w.current){let q=G.target,me=false;for(;q&&q!==G.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){me=true;break}q=q.parentElement;}me||C(null);}},[N]),ie=react.useCallback(G=>{D(G);},[]),S=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),j=r==="day"?60:r==="week"?20:8,le=S*j*n,Le=G=>{let q=new Date(Date.UTC(G.getFullYear(),G.getMonth(),G.getDate())),me=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-me);let Ne=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-Ne.getTime())/864e5+1)/7)},L=G=>{let q=G.getDay();return q===0||q===6},fe=react.useCallback(G=>{let q=Math.round(G/(j*n)),me=new Date(o);return me.setDate(me.getDate()+q),me},[o,j,n]),Q=react.useCallback((G,q)=>{if(q.startDate&&q.endDate)return;let me=G.currentTarget.ownerSVGElement;if(!me)return;let Ne=me.createSVGPoint();Ne.x=G.clientX,Ne.y=G.clientY;let Xe=Ne.matrixTransform(me.getScreenCTM()?.inverse()),U=fe(Xe.x),De=new Date(U);De.setDate(De.getDate()+1),H(null),f?.(q,U,De);},[fe,f]),qe=react.useCallback((G,q,me)=>{let Ne=G.currentTarget.ownerSVGElement;if(!Ne)return;let Xe=Ne.createSVGPoint();Xe.x=G.clientX,Xe.y=G.clientY;let U=Xe.matrixTransform(Ne.getScreenCTM()?.inverse()),De=fe(U.x),Ae=Math.round(U.x/(j*n))*j*n;H({taskId:q.id,x:Ae,y:me*a+a/2,date:De});},[fe,j,n,a]),B=react.useCallback(()=>{H(null);},[]),ee=react.useMemo(()=>{let G=Xe=>Xe.map(U=>{if(U.subtasks&&U.subtasks.length>0){let De=G(U.subtasks),Me=De.filter(Ae=>Ae.startDate&&Ae.endDate);if(Me.length>0){let Ae=Me.map(de=>de.startDate.getTime()),X=Me.map(de=>de.endDate.getTime()),I=new Date(Math.min(...Ae)),K=new Date(Math.max(...X));return {...U,subtasks:De,startDate:I,endDate:K}}return {...U,subtasks:De}}return U}),q=(Xe,U=[])=>{let De=[...Xe].sort((Me,Ae)=>(Me.position??0)-(Ae.position??0));for(let Me of De)U.push(Me),Me.subtasks&&Me.subtasks.length>0&&(Me.isExpanded===void 0||Me.isExpanded)&&q(Me.subtasks,U);return U},me=G(e);return q(me)},[e]),we=react.useCallback(G=>{if(!G.startDate||!G.endDate)return {x:0,width:0};let q=G.startDate.getTime(),me=G.endDate.getTime(),Ne=o.getTime(),Xe=(q-Ne)/(1e3*60*60*24),U=(me-q)/(1e3*60*60*24),De=Xe*j*n,Me=Math.max(j*n,40),Ae=Math.max(U*j*n,Me);return {x:De,width:Ae}},[o,j,n]),he=react.useMemo(()=>ee.filter(G=>G.startDate&&G.endDate).map(G=>{let{x:q,width:me}=we(G),Xe=ee.findIndex(U=>U.id===G.id)*a+14;return {id:G.id,x:q,y:Xe,width:me,height:24}}),[ee,we]),We=react.useCallback((G,q,me)=>{if(!me||q===0){b([]);return}let Ne=Te.calculateCascadePreview(e,G,q,ee,o,j*n,a,48);b(Ne);},[e,ee,o,j,n,a,48]),ke=react.useMemo(()=>{let G=[],q=new Date(o);for(;q<=s;){let Xe=(q.getTime()-o.getTime())/864e5*j*n;if(r==="day")G.push({date:new Date(q),label:q.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Xe}),q.setDate(q.getDate()+1);else if(r==="week"){let U=Le(q);G.push({date:new Date(q),label:`${y.labels.week} ${U}`,x:Xe}),q.setDate(q.getDate()+7);}else G.push({date:new Date(q),label:q.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Xe}),q.setMonth(q.getMonth()+1);}return G},[o,s,r,j,n,l,y.labels.week]),je=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*j*n,[o,j,n]),ae=Math.max(ee.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(le,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(le,1e3),height:48,fill:t.bgGrid}),ke.map((G,q)=>jsxRuntime.jsxs("g",{children:[q>0&&jsxRuntime.jsx("line",{x1:G.x,y1:0,x2:G.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:G.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:G.label})]},`header-${q}`)),je>=0&&je<=le&&jsxRuntime.jsx("circle",{cx:je,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(le,1e3),height:ae,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:A,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("rect",{x:0,y:0,width:Math.max(le,1e3),height:ae,fill:t.bgPrimary}),ke.map((G,q)=>{let me=ke[q+1]?.x||le,Ne=L(G.date);return jsxRuntime.jsxs("g",{children:[Ne&&jsxRuntime.jsx("rect",{x:G.x,y:0,width:me-G.x,height:ee.length*a,fill:t.bgWeekend,opacity:1}),q>0&&jsxRuntime.jsx("line",{x1:G.x,y1:0,x2:G.x,y2:ee.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},q)}),ee.map((G,q)=>{let me=G.startDate&&G.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:q*a,width:le,height:a,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${G.id}`),!me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:q*a,width:le,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ne=>Q(Ne,G),onMouseMove:Ne=>qe(Ne,G,q),onMouseLeave:()=>{B();}},`clickable-${G.id}`),T&&T.taskId===G.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:T.x,y1:q*a+4,x2:T.x,y2:q*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:T.x,cy:T.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:T.x,cy:T.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${q*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:T.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!T||T.taskId!==G.id)&&jsxRuntime.jsx("text",{x:je>0?je:100,y:q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${G.id}`)]})]},`row-group-${G.id}`)}),ee.map((G,q)=>{if(!G.startDate||!G.endDate)return null;let{x:me,width:Ne}=we(G),Xe=q*a+14,U=G.subtasks&&G.subtasks.length>0&&!G.isMilestone;if(G.isMilestone)return jsxRuntime.jsx(Es,{task:G,x:me+Ne/2,y:Xe+12,theme:t,onClick:c},G.id);if(U){let Me=Xe+10,Ae=5,X=t.taskBarPrimary,I=Ne*(G.progress/100);return jsxRuntime.jsxs("g",{onClick:()=>c?.(G),onContextMenu:K=>{K.preventDefault(),K.stopPropagation(),p?.(G,K);},onMouseEnter:()=>{ie({task:G,x:me,y:Me,width:Ne,height:8,showBelow:Me<100});},onMouseLeave:()=>ie(null),style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:me,y:Xe,width:Ne,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:me,y:Me,width:Ne,height:8,fill:X,opacity:.35,rx:2}),G.progress>0&&jsxRuntime.jsx("rect",{x:me,y:Me,width:I,height:8,fill:X,opacity:1,rx:2,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${me} ${Me} L ${me+Ae} ${Me} L ${me} ${Me+8+Ae} Z`,fill:X,opacity:.9}),jsxRuntime.jsx("path",{d:`M ${me+Ne-Ae} ${Me} L ${me+Ne} ${Me} L ${me+Ne} ${Me+8+Ae} Z`,fill:X,opacity:.9}),Ne>60&&jsxRuntime.jsx("text",{x:me+12,y:Me+8/2,dominantBaseline:"middle",fill:t.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:G.name.length>Math.floor(Ne/8)?`${G.name.substring(0,Math.floor(Ne/8))}...`:G.name})]},G.id)}return jsxRuntime.jsx(Ds,{task:G,x:me,y:Xe,width:Ne,theme:t,dayWidth:j*n,startDate:o,templates:u,onClick:c,onDoubleClick:d,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:he,onDragMove:We,onHoverChange:ie},G.id)}),ee.map((G,q)=>!G.dependencies||G.dependencies.length===0||!G.startDate||!G.endDate?null:G.dependencies.map(me=>{let Ne=ee.find(de=>de.id===me);if(!Ne||!Ne.startDate||!Ne.endDate)return null;let Xe=ee.findIndex(de=>de.id===me),U=we(Ne),De=we(G),Me=U.x+U.width,Ae=Xe*a+26,X=De.x,I=q*a+26,K=`dep-${me}-${G.id}`;return R.has(K)?null:jsxRuntime.jsx(Dn,{x1:Me,y1:Ae,x2:X,y2:I,theme:t,lineStyle:i,onDelete:()=>k?.(G.id,me),onHoverChange:de=>{w.current=de,de&&C({key:K,fromId:me,toId:G.id,exitX:Me,exitY:Ae,enterX:X,enterY:I});}},K)})),h.map(G=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:G.previewX,y:G.y-48,width:G.width,height:32,rx:8,fill:G.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(G.daysDelta)>0&&jsxRuntime.jsx("text",{x:G.previewX+G.width/2,y:G.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:G.daysDelta>0?`+${G.daysDelta}d`:`${G.daysDelta}d`})]},`cascade-preview-${G.taskId}`)),N&&jsxRuntime.jsx(Dn,{x1:N.exitX,y1:N.exitY,x2:N.enterX,y2:N.enterY,theme:t,lineStyle:i,onDelete:()=>{let G=N.key;C(null),w.current=false,F(q=>new Set(q).add(G)),k?.(N.toId,N.fromId);},hoverOverlayOnly:true,onHoverChange:G=>{w.current=G,G||C(null);}},`${N.key}-hover-overlay`),je>=0&&je<=le&&jsxRuntime.jsx("line",{x1:je,y1:0,x2:je,y2:ae,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsxRuntime.jsx(_u,{tooltipData:x,theme:t,locale:l==="es"?"es":"en"})]})]})}var Dy=['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"'],Ku=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),Sy=()=>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"})}),Ey=()=>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"})}),Py=()=>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"})}),My=()=>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 Ls({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:u}){let[i,c]=react.useState(false),[d,p]=react.useState(false),[f,v]=react.useState([]),[k,g]=react.useState(""),[y,h]=react.useState(false),[b,x]=react.useState(true),[D,N]=react.useState(""),[C,w]=react.useState(-1),[R,F]=react.useState(false),[T,H]=react.useState(0),A=react.useRef(null),ie=react.useRef(null),S=react.useRef(null),j=react.useRef(null),{enabled:le=true,placeholder:Le='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:L="bottom-right",onCommand:fe,suggestions:Q=Dy,maxHistory:qe=50,persistHistory:B,mentionableUsers:ee=[]}=a,we=B?.storageKey||"gantt-ai-history",he=B?.maxMessages??5,We=ee.filter(U=>{if(!D)return true;let De=D.toLowerCase();return U.name.toLowerCase().includes(De)||U.email&&U.email.toLowerCase().includes(De)}).slice(0,5),ke=react.useCallback(U=>{if(g(U),ee.length===0)return;let De=A.current;if(!De)return;let Me=De.selectionStart||U.length,Ae=U.slice(0,Me),X=Ae.lastIndexOf("@");if(X>=0&&((X>0?Ae[X-1]:" ")===" "||X===0)){let K=Ae.slice(X+1);if(K.length<=40){N(K),w(X),F(true),H(0);return}}F(false),N(""),w(-1);},[ee.length]),je=react.useCallback(U=>{let De=k.slice(0,C),Me=k.slice(C+1+D.length),Ae=`${De}@${U.name} ${Me}`;g(Ae),F(false),N(""),w(-1),setTimeout(()=>A.current?.focus(),0);},[k,C,D]),ae=react.useCallback(U=>{if(!R||We.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),H(De=>De<We.length-1?De+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),H(De=>De>0?De-1:We.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let De=We[T];return De&&je(De),true}return U.key==="Escape"?(F(false),true):false},[R,We,T,je]);react.useEffect(()=>{if(B?.enabled)try{let U=localStorage.getItem(we);if(U){let Me=JSON.parse(U).map(Ae=>({...Ae,timestamp:new Date(Ae.timestamp)}));v(Me.slice(-he));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[B?.enabled,we,he]),react.useEffect(()=>{if(B?.enabled&&f.length>0)try{let U=f.filter(De=>!De.isLoading).slice(-he);localStorage.setItem(we,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[f,B?.enabled,we,he]),react.useEffect(()=>{ie.current&&ie.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&A.current&&setTimeout(()=>A.current?.focus(),100);},[i,d]);let G=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&u?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,u]),q=react.useCallback(async U=>{if(!U.trim()||y)return;let De={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};v(Ae=>[...Ae.slice(-(qe-1)),De]),g(""),x(false),h(true);let Me={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(Ae=>[...Ae,Me]);try{if(fe){let Ae=await fe(U,e);v(X=>{let I=X.filter(de=>!de.isLoading),K={id:`assistant-${Date.now()}`,role:"assistant",content:Ae.message,timestamp:new Date,command:Ae};return [...I,K]}),G(Ae);}else v(Ae=>[...Ae.filter(I=>!I.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(Ae){v(X=>[...X.filter(K=>!K.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Ae instanceof Error?Ae.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,qe,fe,e,G]),me=U=>{U.preventDefault(),q(k);},Ne=U=>{g(U),A.current?.focus();};if(react.useEffect(()=>{let U=De=>{(De.metaKey||De.ctrlKey)&&De.key==="k"&&(De.preventDefault(),c(Me=>!Me),i||p(false)),De.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),react.useEffect(()=>{if(!i)return;let U=Me=>{let Ae=Me.target;S.current&&!S.current.contains(Ae)&&c(false);},De=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(De),document.removeEventListener("mousedown",U);}},[i]),!le)return null;let Xe={"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:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${Xe[L]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsxRuntime.jsx(Ku,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:S,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 ${Xe[L]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Ku,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Py,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ey,{})})]})]}),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:[f.length===0&&b&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Q.slice(0,4).map((U,De)=>jsxRuntime.jsx("button",{onClick:()=>Ne(U),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:U.length>30?U.slice(0,30)+"...":U},De))})]}),f.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsxRuntime.jsx(My,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:ie})]}),jsxRuntime.jsxs("form",{onSubmit:U=>{if(R&&We.length>0){U.preventDefault();return}me(U);},className:"p-3 border-t relative",style:{borderColor:t.border},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&We.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:t.bgSecondary,border:`1px solid ${t.border}`,boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.25)"},children:We.map((U,De)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>je(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:De===T?"rgba(59, 130, 246, 0.15)":"transparent",color:t.textPrimary},onMouseEnter:()=>H(De),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:"linear-gradient(135deg, #3B82F6 0%, #6366F1 100%)",color:"white"},children:U.name.split(" ").map(Me=>Me[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:t.textSecondary},children:U.email})]})]},U.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:A,type:"text",value:k,onChange:U=>ke(U.target.value),onKeyDown:U=>{ae(U);},placeholder:Le,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Sy,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function qu(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)return {...d,present:p};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function Yu({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=l?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&u&&n.key==="y"){n.preventDefault(),t();return}if(l&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Iy={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Te.formatDate(e.startDate)} - ${Te.formatDate(e.endDate)}`);let a=Te.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=>Te.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Xu(e){return {...Iy,...e}}var Wy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Qu=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:k,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:D,taskFilter:N,onTaskFilterChange:C,onThemeChange:w,onTaskClick:R,onTaskDblClick:F,onTaskContextMenu:T,onTaskUpdate:H,onProgressChange:A,onTaskEdit:ie,onTaskAddSubtask:S,onTaskMarkIncomplete:j,onTaskSetInProgress:le,onDependencyCreate:Le,onDependencyDelete:L,onBeforeTaskAdd:fe,onAfterTaskAdd:Q,onBeforeTaskUpdate:qe,onAfterTaskUpdate:B,onBeforeTaskDelete:ee,onAfterTaskDelete:we,permissions:he}=a,ke=react.useContext(bs)?.theme,[je,ae]=react.useState(ke||s||"dark"),[G,q]=react.useState(n),[me,Ne]=react.useState(l),[Xe,U]=react.useState(1),De=react.useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[Me,Ae]=react.useState(()=>{if(!v)return "all";try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let V=JSON.parse(M);if(V.taskFilter)return V.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),X=N??Me,I=C??Ae,[K,de]=react.useState(()=>{if(!v)return false;try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let V=JSON.parse(M);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=De();if(E)try{let M={taskFilter:X,hideCompleted:K};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[X,K,De]);let Se=react.useRef(k);react.useEffect(()=>{if(Se.current!==k&&k!==void 0){Ae("all"),de(false);let E=De();if(E)try{localStorage.removeItem(E);}catch(M){console.warn("[GanttBoard] Error clearing filter state from localStorage:",M);}}Se.current=k;},[k,De]);let[Ke,ot]=react.useState(0),[ct,Ye]=react.useState(false),[sa,_]=react.useState(null),[Y,ge]=react.useState({isOpen:false,x:0,y:0,task:null}),[et,Ee]=react.useState(null),[Oe,oe]=react.useState(null);react.useEffect(()=>{ke&&ke!==je&&ae(ke);},[ke]),react.useEffect(()=>{s&&s!==je&&ae(s);},[s]);let ye=react.useCallback(E=>{ae(E),w?.(E);},[w]),{state:$,setState:ne,undo:$e,redo:Ze,canUndo:at,canRedo:Ve,clearHistory:ve}=qu(t,50),He=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),W=react.useRef(new Map),ce=react.useRef(false);if(!ce.current&&f){ce.current=true;let E=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let V=JSON.parse(M);Array.isArray(V)&&(W.current=new Map(V));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let vt=react.useCallback(()=>{let E=He();if(E)try{let M=Array.from(W.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[He]),z=react.useRef(0),te=react.useRef(false);react.useEffect(()=>{if(z.current>0){z.current-=1;return}let E=V=>{let se=new Map;for(let pe of V){let Ce=pe.id;se.get(Ce)||se.set(Ce,pe);}return Array.from(se.values())},M=V=>V.map(se=>{let pe=W.current.get(se.id),Ce=pe!==void 0?{...se,isExpanded:pe}:se;if(Ce.subtasks?.length){let Tt=E(Ce.subtasks);return {...Ce,subtasks:M(Tt)}}return Ce});if(W.current.size>0)ne(M(t));else {let V=se=>se.map(pe=>pe.subtasks?.length?{...pe,subtasks:E(V(pe.subtasks))}:pe);ne(V(t));}},[t,ne]);let Ie=react.useRef(t),dt=react.useRef(true);react.useEffect(()=>{if(dt.current){dt.current=false,Ie.current=$;return}if(te.current){te.current=false,Ie.current=$;return}if(!r)return;let E=JSON.stringify(Ie.current),M=JSON.stringify($);E!==M&&(Ie.current=$,r($));},[$,r]);let Qe=react.useMemo(()=>ul(y,h),[y,h]),qt=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}],[]),[ft,Fa]=react.useState(()=>qt(Qe));react.useEffect(()=>{Fa(E=>E.map(M=>({...M,label:Qe.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Qe]);let Vt=react.useMemo(()=>ft.filter(M=>M.visible).reduce((M,V)=>M+V.width,0),[ft]),Ea=react.useRef(ft.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=ft.filter(se=>se.visible),M=E.map(se=>se.id).join(","),V=Ea.current;if(M!==V){let se=E.some(Ce=>Ce.id!=="name"),pe=V.includes(",");se?!pe&&se&&_(null):_(null),Ea.current=M;}},[ft]);let Wr=60,Fe=.6,Rt=react.useMemo(()=>{let M=Vt+Wr,V=typeof window<"u"?window.innerWidth*Fe:800,se=Math.max(M,V);return sa!==null?Math.max(200,Math.min(sa,se)):Math.max(200,M)},[sa,Vt]),Ot=react.useRef(null),Ar=react.useRef(null),Ra=react.useRef(null),P=react.useRef(null),J=react.useMemo(()=>wu(je),[je]),_e=react.useMemo(()=>({theme:J,themeName:je}),[J,je]),Ge=react.useMemo(()=>Xu(d),[d]),Yt=react.useMemo(()=>{if(!p)return $;let E=Te.calculateCriticalPath($),M=V=>V.map(se=>({...se,isCriticalPath:E.includes(se.id),subtasks:se.subtasks?M(se.subtasks):void 0}));return M($)},[$,p]),Pa=react.useMemo(()=>{if(X==="all"&&!K)return Yt;let E=M=>{let V=[];for(let se of M){let pe=se.subtasks?.length?E(se.subtasks):void 0,Ce=false;if(K)Ce=se.progress<100;else switch(X){case "all":Ce=true;break;case "incomplete":Ce=se.progress<100;break;case "in_progress":Ce=se.progress>0&&se.progress<100;break;case "completed":Ce=se.progress===100;break}(Ce||pe&&pe.length>0)&&V.push({...se,subtasks:pe});}return V};return E(Yt)},[Yt,X,K]),ia=Wy(me);Yu({undo:$e,redo:Ze,canUndo:at,canRedo:Ve,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>Te.findTaskById($,E),addTask:(E,M)=>{ne(V=>{if(!M)return [...V,{...E,level:0}];let se=pe=>pe.map(Ce=>Ce.id===M?{...Ce,subtasks:[...Ce.subtasks||[],{...E,parentId:M,level:(Ce.level||0)+1}],isExpanded:true}:Ce.subtasks?{...Ce,subtasks:se(Ce.subtasks)}:Ce);return se(V)});},updateTask:(E,M)=>{ne(V=>{let se=pe=>pe.map(Ce=>Ce.id===E?{...Ce,...M}:Ce.subtasks?{...Ce,subtasks:se(Ce.subtasks)}:Ce);return se(V)});},deleteTask:E=>{ne(M=>{let V=se=>se.filter(pe=>pe.id===E?false:(pe.subtasks&&(pe.subtasks=V(pe.subtasks)),true));return V(M)});},deleteTasks:E=>{ne(M=>Cl(M,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let M=Te.findTaskById($,E);M&&a.onTaskDuplicate(M);}else ne(M=>kn(M,[E]).tasks);},splitTask:(E,M,V=3)=>{ne(se=>Te.splitTask(se,E,M,V));},calculateEndDate:Te.calculateEndDate,calculateDuration:Te.calculateDuration,validateDependency:(E,M)=>!Te.validateDependencies($,E,M),getAllTasks:()=>Te.flattenTasks($),getTasksByStatus:E=>Te.flattenTasks($).filter(M=>M.status===E),getTasksByParent:E=>E?Te.findTaskById($,E)?.subtasks||[]:$.filter(V=>!V.parentId),getCriticalPath:()=>Te.flattenTasks($).filter(E=>E.isCriticalPath),indentTask:E=>{ne(M=>xl(M,[E]));},outdentTask:E=>{ne(M=>kl(M,[E]));},moveTask:(E,M)=>{ne(V=>wl(V,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:V}=Dl($,E);if(fe){let se=fe({...V,parentId:E});if((se instanceof Promise?await se:se)===false)return}ne(M),Q&&Q({...V,parentId:E});},scrollToTask:E=>{let V=Te.flattenTasks($).findIndex(se=>se.id===E);if(V!==-1&&Ot.current){let se=V*ia;Ot.current.scrollTo({top:se,behavior:"smooth"}),Ra.current&&Ra.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{ne(M=>{let V=se=>se.map(pe=>pe.id===E?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:V(pe.subtasks)}:pe);return V(M)});},collapseTask:E=>{ne(M=>{let V=se=>se.map(pe=>pe.id===E?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:V(pe.subtasks)}:pe);return V(M)});},expandAll:()=>{ne(E=>{let M=V=>V.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?M(se.subtasks):void 0}));return M(E)});},collapseAll:()=>{ne(E=>{let M=V=>V.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?M(se.subtasks):void 0}));return M(E)});},undo:$e,redo:Ze,canUndo:()=>at,canRedo:()=>Ve,clearHistory:ve,exportToPNG:async()=>{if(!P.current||!Ot.current||!Ra.current)throw new Error("Gantt container not found");let E=P.current,M=Ot.current.querySelector(".gantt-grid-scroll"),V=Ra.current,se=M?.scrollTop||0,pe=V.scrollTop,Ce=E.style.overflow,Tt=E.style.height;try{let rt=M?.querySelector(".gantt-taskgrid-content"),ha=V.querySelector("svg"),kt=rt?.scrollHeight||M?.scrollHeight||600,ba=ha?.getBoundingClientRect().height||V.scrollHeight,co=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(kt,ba)+20;M&&(M.scrollTop=0),V.scrollTop=0,E.style.overflow="visible",E.style.height=`${co}px`,await new Promise(Gr=>setTimeout(Gr,100));let Cr=await Zu__default.default(E,{backgroundColor:J.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Gr=>{let Io=window.getComputedStyle(Gr),uo=parseInt(Io.zIndex,10);return !isNaN(uo)&&uo>=50||Io.position==="fixed"}});return new Promise((Gr,Io)=>{Cr.toBlob(uo=>{uo?Gr(uo):Io(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=Ce,E.style.height=Tt,M&&(M.scrollTop=se),V.scrollTop=pe;}},exportToPDF:async E=>{await Te.exportToPDF($,E);},exportToExcel:async E=>{await Te.exportToExcel($,E);},exportToJSON:()=>Te.exportToJSON($),exportToCSV:()=>Te.exportToCSV($),importFromJSON:E=>{let M=Te.importFromJSON(E);ne(M);},getTasks:()=>$,refresh:()=>{ne(E=>[...E]);},clearAll:()=>{ne([]);}}),[$,$e,Ze,at,Ve,ve,J,ia]);let Oa=react.useCallback(E=>{Fa(M=>M.map(V=>V.id===E?{...V,visible:!V.visible}:V));},[]),Aa=react.useCallback((E,M)=>{Fa(V=>V.map(se=>{if(se.id!==E)return se;let pe=se.minWidth??100,Ce=se.maxWidth??800,Tt=Math.max(pe,Math.min(Ce,M));return {...se,width:Tt}}));},[]),$a=react.useCallback(E=>{ne(M=>{let V=Nl(M,E),se=pe=>{for(let Ce of pe){if(Ce.id===E){W.current.set(E,Ce.isExpanded??true);return}Ce.subtasks?.length&&se(Ce.subtasks);}};return se(V),vt(),V}),a.onTaskToggleExpand?.(E);},[a,vt]),wr=react.useCallback((E,M)=>{if(qe&&qe(E,M)===false)return;let se=Te.findTaskById($,E)?.progress,pe=Tt=>Tt.map(rt=>rt.id===E?{...rt,...M}:rt.subtasks?{...rt,subtasks:pe(rt.subtasks)}:rt);ne(pe($));let Ce=Te.findTaskById(pe($),E);Ce&&(H?.(Ce),B?.(Ce),M.progress!==void 0&&se!==void 0&&M.progress!==se&&A?.(E,se,M.progress));},[$,H,qe,B,A]),yg=react.useCallback(E=>{E.length!==0&&(z.current+=1,te.current=true,ne(M=>xl(M,E)),a.onTaskIndent?.(E[0]));},[a]),vg=react.useCallback(E=>{E.length!==0&&(z.current+=1,te.current=true,ne(M=>kl(M,E)),a.onTaskOutdent?.(E[0]));},[a]),xg=react.useCallback((E,M,V)=>{z.current+=1,te.current=true,ne(se=>Ou(se,E,M,V)),a.onTaskReparent?.(E,M,V);},[a]),kg=react.useCallback((E,M)=>{E.length!==0&&(z.current+=1,te.current=true,ne(V=>wl(V,E,M)),a.onTaskMove?.(E[0],M));},[a]),oi=react.useCallback(async E=>{let M=[];for(let V of E)ee&&await Promise.resolve(ee(V))===false||M.push(V);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(ne(V=>Cl(V,M)),M.forEach(V=>a.onTaskDelete?.(V))),we&&M.forEach(V=>we(V)));},[a,ee,we]),wg=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(M=>{let V=Te.findTaskById($,M);V&&a.onTaskDuplicate(V);}):ne(M=>kn(M,E).tasks);},[a,$]),Cg=react.useCallback((E,M)=>{ne(V=>{let{tasks:se,newTask:pe}=Ru(V,E,M);return fe&&fe(pe)===false?V:(a.onTaskCreate?.(pe.parentId,pe.position||0),Q?.(pe),se)});},[a,fe,Q]),Tg=react.useCallback((E,M)=>{ne(V=>Tl(V,E,M)),a.onTaskRename?.(E,M);},[a]),ni=react.useCallback(E=>{let{onTaskAddSubtask:M}=a;if(M){let V=ws($,E);if(V){M(V);return}}ne(V=>{let{tasks:se}=Dl(V,E);return a.onTaskCreate?.(E,0),se});},[a,$]),Ng=react.useCallback((E,M,V)=>{let se=!E.startDate&&!E.endDate,pe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,Ce=ha=>ha.map(kt=>kt.id===E.id?{...kt,startDate:M,endDate:V,...E.segments&&{segments:E.segments}}:kt.subtasks?{...kt,subtasks:Ce(kt.subtasks)}:kt),Tt=Ce($);Tt=Te.autoScheduleDependents(Tt,E.id,pe),ne(Tt);let rt={...E,startDate:M,endDate:V};se&&a?.onTaskDateChange?a.onTaskDateChange(E,M,V):H?.(rt);},[$,H,a]),Dg=react.useCallback((E,M)=>{T?.(E,M),ge({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[T]),Sg=react.useCallback((E,M)=>{let V=Te.splitTask($,E.id,M);ne(V),ge({isOpen:false,x:0,y:0,task:null});},[$]),Ld=react.useCallback(E=>{let M=Te.findTaskById($,E.id)||E;F?.(M),ie||Ee(M);},[$,F,ie]),Id=react.useCallback((E,M,V)=>{let se=new Map,pe=kt=>{kt.forEach(ba=>{ba.dependencies&&se.set(ba.id,ba.dependencies),ba.subtasks&&pe(ba.subtasks);});};pe(V);let Ce=se.get(M)||[];se.set(M,[...Ce,E]);let Tt=new Set,rt=new Set,ha=kt=>{if(!Tt.has(kt)){Tt.add(kt),rt.add(kt);let ba=se.get(kt)||[];for(let ar of ba){if(!Tt.has(ar)&&ha(ar))return true;if(rt.has(ar))return true}}return rt.delete(kt),false};return ha(M)},[]),Bd=react.useCallback((E,M)=>{if(Id(E.id,M,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
357
357
 
358
- Task dependencies must flow in one direction only.`);return}let Y=le=>le.map(ye=>{if(ye.id===F){let Ae=ye.dependencies||[];if(!Ae.includes(M.id))return {...ye,dependencies:[...Ae,M.id]}}return ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye});R(Y(me)),V?.(M.id,F);},[me,V,Xd]),Zd=react.useCallback((M,F)=>{let Y=le=>le.map(ye=>{if(ye.id===M&&ye.dependencies){let Ae=ye.dependencies.filter(Et=>Et!==F);return {...ye,dependencies:Ae}}return ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye});R(Y(me)),I?.(M,F);},[me,I]),{startDate:Zn,endDate:n0}=react.useMemo(()=>{let M=me.filter(Ae=>Ae.startDate&&Ae.endDate);if(M.length===0){let Ae=new Date,Et=new Date(Ae);Et.setDate(Et.getDate()-30);let st=new Date(Ae);return st.setDate(st.getDate()+60),{startDate:Et,endDate:st}}let F=M.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),Y=new Date(Math.min(...F.map(Ae=>Ae.getTime()))),le=new Date(Math.max(...F.map(Ae=>Ae.getTime()))),ye=K==="day"?7:K==="week"?14:30;return Y.setDate(Y.getDate()-ye),le.setDate(le.getDate()+ye),{startDate:Y,endDate:le}},[me,K]),s0=react.useCallback(async()=>{if(!P.current||!St.current||!ma.current)return;await new Promise(ho=>setTimeout(ho,200));let M=P.current,F=St.current.querySelector(".gantt-grid-scroll"),Y=ma.current,le=F?.scrollTop||0,ye=F?.scrollLeft||0,Ae=Y.scrollTop,Et=Y.scrollLeft,st=M.style.overflow,Ca=M.style.height,Mt=F?.style.overflow||"",Ta=Y.style.overflow,ir=M.style.width,Uo=Y.style.width;try{let ho=F?.querySelector(".gantt-taskgrid-content"),Mr=Y.querySelector("svg"),Yr=Mr?.getAttribute("height")?parseInt(Mr.getAttribute("height"),10):Mr?.getBoundingClientRect().height||0,zo=ho?.scrollHeight||F?.scrollHeight||600,yo=Math.max(Yr,Y.scrollHeight),tc=Mr?.getAttribute("width")?parseInt(Mr.getAttribute("width"),10):Mr?.getBoundingClientRect().width||Y.scrollWidth,g0=M.querySelector('[class*="h-12"]')?.offsetHeight||48,xi=Math.max(zo,yo,Yr),vi=g0+xi+50,ki=(F?.offsetWidth||300)+tc+10;F&&(F.scrollTop=0,F.scrollLeft=0),Y.scrollTop=0,Y.scrollLeft=0,M.style.overflow="visible",M.style.height=`${vi}px`,M.style.width=`${ki}px`,F&&(F.style.overflow="visible",F.style.height=`${xi+50}px`),Y.style.overflow="visible",Y.style.height=`${xi+50}px`,Y.style.width=`${tc+10}px`,await new Promise(Ci=>setTimeout(Ci,150));let f0=await xm__default.default(M,{backgroundColor:oe.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ki,height:vi,windowWidth:ki+100,windowHeight:vi+100,scrollX:0,scrollY:0,ignoreElements:Ci=>{let ac=window.getComputedStyle(Ci),rc=parseInt(ac.zIndex,10);return !isNaN(rc)&&rc>=50||ac.position==="fixed"}}),wi=document.createElement("a");wi.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,wi.href=f0.toDataURL("image/png"),wi.click();}finally{M.style.overflow=st,M.style.height=Ca,M.style.width=ir,F&&(F.style.overflow=Mt,F.style.height="",F.scrollTop=le,F.scrollLeft=ye),Y.style.overflow=Ta,Y.style.height="",Y.style.width=Uo,Y.scrollTop=Ae,Y.scrollLeft=Et;}},[oe]),i0=react.useCallback(async()=>{await Le.exportToPDF(me);},[me]),l0=react.useCallback(async()=>{await Le.exportToExcel(me);},[me]),d0=react.useCallback(()=>{let M=Le.exportToCSV(me),F=new Blob([M],{type:"text/csv;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL(F),Y.download="gantt-chart.csv",Y.click(),URL.revokeObjectURL(Y.href);},[me]),c0=react.useCallback(()=>{let M=Le.exportToJSON(me),F=new Blob([M],{type:"application/json;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL(F),Y.download="gantt-chart.json",Y.click(),URL.revokeObjectURL(Y.href);},[me]),u0=react.useCallback(()=>{Le.exportToMSProject(me,"Gantt Project","project.xml");},[me]),m0=M=>{M.preventDefault(),_e(true);},Ho=react.useRef(false),[yi,Qd]=react.useState(false),cn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=ma.current,F=St.current?.querySelector(".gantt-grid-scroll");if(!M||!F)return;let Y=()=>{if(Ho.current)return;Ho.current=true;let st=M.scrollTop;tt(st),F.scrollTop=st,requestAnimationFrame(()=>{Ho.current=false;});},le=()=>{if(Ho.current)return;Ho.current=true;let st=F.scrollTop;tt(st),M.scrollTop=st,requestAnimationFrame(()=>{Ho.current=false;});},ye=st=>{if(rt&&F){let Mt=F.parentElement?.getBoundingClientRect()?.left||0,Ta=st.clientX-Mt,ir=200,Uo=Ft+nr,ho=window.innerWidth*La,Mr=Math.max(Uo,ho);Ta>=ir&&Ta<=Mr&&ht(Ta);}if(yi&&M){let Ca=st.clientX-cn.current.x,Mt=st.clientY-cn.current.y;M.scrollLeft=cn.current.scrollLeft-Ca,M.scrollTop=cn.current.scrollTop-Mt;}},Ae=()=>{_e(false),Qd(false);},Et=st=>{if(st.button!==0)return;let Ca=st.target;Ca.closest("[data-task-bar]")||Ca.closest("[data-dependency-line]")||Ca.closest("button")||Ca.closest('[role="button"]')||Ca.tagName==="rect"&&Ca.getAttribute("data-clickable")==="true"||(Qd(true),cn.current={x:st.clientX,y:st.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},st.preventDefault());};return M.addEventListener("scroll",Y),F.addEventListener("scroll",le),M.addEventListener("mousedown",Et),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ae),()=>{M.removeEventListener("scroll",Y),F.removeEventListener("scroll",le),M.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ae);}},[rt,yi,Ft]);let ec=react.useRef(false),p0=react.useRef(null);return react.useLayoutEffect(()=>{if(ec.current||me.length===0||!ma.current)return;ec.current=true,p0.current=Zn;let M=ma.current,F=new Date,Y=K==="day"?60:K==="week"?20:8,le=(F.getTime()-Zn.getTime())/(1e3*60*60*24),ye=M.clientWidth,Et=le*Y*Je-ye/2;le>=0&&ye>0&&(M.scrollLeft=Math.max(0,Et));},[me.length,Zn,K,Je]),jsxRuntime.jsx(en.Provider,{value:ue,children:jsxRuntime.jsx(Ei.Provider,{value:Xe,children:jsxRuntime.jsxs("div",{ref:P,className:"flex flex-col h-full w-full",style:{backgroundColor:oe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...oe.dotGrid&&{backgroundImage:`radial-gradient(circle, ${oe.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Ps,{theme:oe,timeScale:K,onTimeScaleChange:q,zoom:Je,onZoomChange:G,currentTheme:ze,onThemeChange:$e,rowDensity:be,onRowDensityChange:we,showThemeSelector:u,showCreateTaskButton:h&&ke?.canCreateTask!==false&&!ke?.canCreateSubtaskOnly,createTaskLabel:y,onCreateTask:C,taskFilter:Ke,onTaskFilterChange:O,hideCompleted:ne,onHideCompletedChange:X,onExportPNG:i?s0:void 0,onExportPDF:i?i0:void 0,onExportExcel:i?l0:void 0,onExportCSV:i?d0:void 0,onExportJSON:i?c0:void 0,onExportMSProject:i?u0:void 0}),jsxRuntime.jsxs("div",{ref:St,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:sa,className:"gantt-grid-scroll flex-shrink-0",style:{width:Fe,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Is,{tasks:Ia,theme:oe,rowHeight:ia,availableUsers:m,templates:nt,onTaskClick:E,onTaskDblClick:qd,onTaskContextMenu:T,onTaskToggle:Ha,scrollTop:Ve,columns:dt,onToggleColumn:sr,onColumnResize:ha,onTaskUpdate:Er,onTaskIndent:qg,onTaskOutdent:Xg,onTaskMove:Zg,onMultiTaskDelete:bi,onTaskDuplicate:Qg,onTaskCreate:e0,onTaskRename:t0,onCreateSubtask:hi,onOpenTaskModal:E?M=>E(M):void 0,onDeleteRequest:(M,F)=>Ne({taskId:M,taskName:F}),onTaskReparent:Jg,scrollContainerRef:sa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:oe.border,zIndex:15},onMouseDown:m0}),jsxRuntime.jsx("div",{ref:ma,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:yi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Us,{tasks:Ia,theme:oe,rowHeight:ia,timeScale:K,startDate:Zn,endDate:n0,zoom:Je,locale:v,templates:nt,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:E,onTaskDblClick:qd,onTaskContextMenu:r0,onTaskDateChange:a0,onDependencyCreate:Jd,onDependencyDelete:Zd})})]}),xt.task&&jsxRuntime.jsx(tn,{isOpen:xt.isOpen,x:xt.x,y:xt.y,theme:oe,onClose:()=>yt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=xt.task;if(!M)return [];let F=Le.findTaskById(me,M.id)||M,Y=F.subtasks&&F.subtasks.length>0,le=ke?.canCreateTask!==false,ye=ke?.canDeleteTask!==false;if(Y){let Mt=[],Ta=ke?.canDuplicateTask!==false;return le&&Mt.push({id:"addSubtask",label:ue.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{D?D(F):hi(F.id);}}),Ta&&Mt.push({id:"duplicate",label:ue.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):R(ir=>Sn(ir,[F.id]).tasks),yt({isOpen:false,x:0,y:0,task:null});}}),ye&&(Mt.length>0&&Mt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Mt.push({id:"delete",label:ue.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{Ne({taskId:F.id,taskName:F.name});}})),Mt}let Ae=ke?.canUpdateTask!==false,Et=ke?.canDuplicateTask!==false,st=[];return Ae&&st.push({id:"edit",label:ue.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{J?J(F):Oe(F);}}),le&&st.push({id:"addSubtask",label:ue.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{D?D(F):hi(F.id);}}),st.length>0&&Ae&&st.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(st.push({id:"markIncomplete",label:ue.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{ve?ve(F):Er(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),st.push({id:"setInProgress",label:ue.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{de?de(F):Er(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),st.push({id:"markComplete",label:ue.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{Er(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(Et||Ae&&F.startDate&&F.endDate)&&st.length>0&&st.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Et&&st.push({id:"duplicate",label:ue.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):R(Mt=>Sn(Mt,[F.id]).tasks),yt({isOpen:false,x:0,y:0,task:null});}}),Ae&&F.startDate&&F.endDate&&st.push({id:"split",label:ue.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{let Mt=F.startDate.getTime(),Ta=F.endDate.getTime(),ir=Mt+(Ta-Mt)/2,Uo=new Date(ir);o0(F,Uo);}}),ye&&(st.length>0&&st.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),st.push({id:"delete",label:ue.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{Ne({taskId:F.id,taskName:F.name});}})),st})()}),jsxRuntime.jsx(zr,{task:U,isOpen:!!U,onClose:()=>Oe(null),onTaskUpdate:M=>{U&&(Er(U.id,M),Oe(null));},theme:ze==="light"?"light":"dark",locale:v==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Qe&&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:()=>Ne(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:oe.bgSecondary,border:`1px solid ${oe.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${oe.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:oe.textPrimary,fontFamily:"Inter, sans-serif"},children:[ue.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:oe.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:oe.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:oe.textPrimary},children:['"',Qe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:oe.bgPrimary,borderTop:`1px solid ${oe.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ne(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:oe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=oe.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{bi([Qe.taskId]),Ne(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),p?.enabled&&jsxRuntime.jsx(Gs,{tasks:me,theme:oe,config:p,onTasksUpdate:R,onTaskUpdate:Er,onTaskCreate:M=>{R(F=>[...F,M]);},onTaskDelete:M=>{bi([M]);},onDependencyCreate:(M,F)=>{let Y=Le.findTaskById(me,M);Y&&Jd(Y,F);},onDependencyDelete:Zd})]})})})});function Fx(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 Ax(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 c=parseInt(a[1],10),u=parseInt(a[2],10);return c*60+u}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 Hl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ul=[{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 Tm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:c=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:m=[],onCreateTag:l,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:x}){let k=[...Hl,...i.filter(O=>!Hl.some(ne=>ne.id===O.id))],p=ot[u]||ot.dark,[v,b]=react.useState(false),[h,y]=react.useState(false),[C,N]=react.useState(false),[S,w]=react.useState(false),[E,L]=react.useState({top:0,left:0}),[T,z]=react.useState(null),[H,J]=react.useState(new Date),[D,ve]=react.useState({top:0,left:0}),[de,V]=react.useState(false),[I,Te]=react.useState([]),[Q,et]=react.useState(false),[$,ae]=react.useState(""),Re=react.useRef(null),ke=react.useRef(null),Ze=react.useRef(null),Ee=react.useRef(null),ze=react.useRef(null),[re,K]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[q,be]=react.useState({});react.useEffect(()=>{a?(K({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&V(true)):(K({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),V(false),Te([]));},[a,e]),react.useEffect(()=>{let O=ne=>{Re.current&&!Re.current.contains(ne.target)&&b(false),ke.current&&!ke.current.contains(ne.target)&&y(false),Ze.current&&!Ze.current.contains(ne.target)&&N(false),Ee.current&&!Ee.current.contains(ne.target)&&w(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let we=()=>{let O={};return re.name.trim()||(O.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),be(O),Object.keys(O).length===0},Je=async O=>{if(O.preventDefault(),!!we())try{let ne=c==="create"&&I.length>0?{...re,pendingFiles:I}:re;await s(ne),Te([]),t();}catch(ne){console.error("Error submitting task:",ne);}},G=(O,ne)=>{K(X=>{let Me={...X,[O]:ne};if(O==="status"){let Ve=ne;Ve==="todo"?Me.progress=0:Ve==="in-progress"?(X.progress===0||X.progress===100)&&(Me.progress=50):Ve==="completed"||Ve==="closed"?Me.progress=100:(Ve==="in-review"||Ve==="review")&&(Me.progress=75);}if(O==="progress"){let Ve=typeof ne=="number"?ne:parseInt(ne,10);Ve===100&&X.status!=="completed"?Me.status="completed":Ve>0&&Ve<100&&X.status==="todo"?Me.status="in-progress":Ve===0&&X.status!=="todo"&&(Me.status="todo");}return Me}),q[O]&&be(X=>{let Me={...X};return delete Me[O],Me});},he=k.find(O=>O.id===re.status)??Hl[0],je=Ul.find(O=>O.id===re.priority)??Ul[1],Ie=To.find(O=>O.value===re.color)??To[0],Ke={backgroundColor:p.bgSecondary,border:`1px solid ${p.borderLight}`,color:p.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden","data-theme":u,style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${p.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:he.color||p.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:p.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:p.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=p.hoverBg,O.currentTarget.style.color=p.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=p.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Je,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:re.name,onChange:O=>G("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:p.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),q.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"}),q.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:re.description||"",onChange:O=>G("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:p.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${p.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Re,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&b(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ke,borderColor:he.color,backgroundColor:`${he.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:he.color}}),jsxRuntime.jsx("span",{style:{color:he.color},children:he.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:he.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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 shadow-xl overflow-hidden",style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},children:k.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{G("status",O.id),b(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,re.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:p.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&y(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:je.color}}),jsxRuntime.jsx("span",{children:je.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},children:Ul.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{G("priority",O.id),y(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,re.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:p.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((O,ne)=>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:O.color||p.accent,borderColor:p.bgSecondary},children:O.initials},ne))}),re.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:p.textTertiary},children:["+",re.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:p.textTertiary}}),jsxRuntime.jsx("span",{style:{color:p.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},children:o.map(O=>{let ne=re.assignees?.some(X=>X.name===O.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:p.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{let X=ne?(re.assignees||[]).filter(Me=>Me.name!==O.name):[...re.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Me=>Me[0]).join("").toUpperCase().slice(0,2),color:p.accent}];G("assignees",X);},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:p.accent},children:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ne&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:p.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:Ee,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(S)w(false);else {if(Ee.current){let O=Ee.current.getBoundingClientRect(),ne=window.innerHeight,X=120,Ve=ne-O.bottom<X?O.top-X-8:O.bottom+8;L({top:Ve,left:O.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.color}}),jsxRuntime.jsx("span",{children:Ie.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(Pt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(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:`${E.top}px`,left:`${E.left}px`,zIndex:99999,backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:To.slice(0,18).map(O=>{let ne=re.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:X=>{X.preventDefault(),X.stopPropagation(),G("color",O.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:ne?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),m.length>0||l?jsxRuntime.jsx(Zr,{selectedTags:re.tags||[],availableTags:m,onChange:O=>G("tags",O),onCreateTag:l,theme:p,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:p.textTertiary}}),jsxRuntime.jsxs("div",{ref:ze,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(T==="start")z(null);else {if(ze.current){let O=ze.current.getBoundingClientRect(),ne=window.innerHeight,X=320,Ve=ne-O.bottom<X?O.top-X-8:O.bottom+8;ve({top:Ve,left:O.left});}z("start"),J(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ke,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:p.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(T==="end")z(null);else {if(ze.current){let O=ze.current.getBoundingClientRect(),ne=window.innerHeight,X=320,Ve=ne-O.bottom<X?O.top-X-8:O.bottom+8;ve({top:Ve,left:O.left});}z("end"),J(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ke,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(Pt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>z(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:`${D.top}px`,left:`${D.left}px`,zIndex:99999,backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${p.border}`},children:[(()=>{let O=new Date,ne=new Date(O);ne.setDate(O.getDate()+1);let X=new Date(O);X.setDate(O.getDate()+7);let Me=new Date(O);return Me.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:X},{label:"2 semanas",date:Me}].map((tt,rt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:p.textPrimary},onMouseEnter:_e=>_e.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:_e=>_e.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(G("startDate",tt.date),(!re.endDate||tt.date>re.endDate)&&G("endDate",tt.date),z("end")):(G("endDate",tt.date),(!re.startDate||tt.date<re.startDate)&&G("startDate",tt.date),z(null));},children:tt.label},rt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${p.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:O=>O.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{G("startDate",void 0),G("endDate",void 0),z(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:()=>J(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:p.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:p.textPrimary},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>J(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:p.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,ne)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:p.textTertiary},children:O},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=H.getFullYear(),ne=H.getMonth(),X=new Date(O,ne,1).getDay(),Me=new Date(O,ne+1,0).getDate(),Ve=new Date,tt=[];for(let _e=X-1;_e>=0;_e--)tt.push({day:new Date(O,ne,-_e).getDate(),date:new Date(O,ne-1,new Date(O,ne,-_e).getDate()),isCurrentMonth:false});for(let _e=1;_e<=Me;_e++)tt.push({day:_e,date:new Date(O,ne,_e),isCurrentMonth:true});let rt=42-tt.length;for(let _e=1;_e<=rt;_e++)tt.push({day:_e,date:new Date(O,ne+1,_e),isCurrentMonth:false});return tt.map((_e,Nt)=>{let ht=_e.date.toDateString()===Ve.toDateString(),xt=re.startDate?.toDateString()===_e.date.toDateString(),yt=re.endDate?.toDateString()===_e.date.toDateString(),U=re.startDate&&re.endDate&&_e.date>=re.startDate&&_e.date<=re.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:_e.isCurrentMonth?xt||yt?"#FFF":p.textPrimary:p.textTertiary,backgroundColor:xt?"#3B82F6":yt?"#7C3AED":U?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ht&&!xt&&!yt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(G("startDate",_e.date),re.endDate&&_e.date>re.endDate&&G("endDate",_e.date),z("end")):(G("endDate",_e.date),re.startDate&&_e.date<re.startDate&&G("startDate",_e.date),z(null));},children:_e.day},Nt)})})()})]})]})]})})]}),q.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:q.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:p.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:re.progress,onChange:O=>G("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:p.bgSecondary,accentColor:re.progress<30?"#EF4444":re.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:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},children:[re.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>V(!de),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:p.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${de?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:p.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:p.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:re.effortMinutes?Fx(re.effortMinutes):"",onChange:O=>{let ne=Ax(O.target.value);G("effortMinutes",ne);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:p.bgSecondary,color:p.textPrimary,border:`1px solid ${p.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:p.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||g.length>0||c==="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:p.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:p.textTertiary},children:["Adjuntos ",c==="create"?I.length>0&&`(${I.length})`:g.length>0&&`(${g.length})`]})]}),c==="create"?jsxRuntime.jsx(Br,{cardId:"pending",attachments:I.map((O,ne)=>({id:`pending-${ne}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>Te(ne=>[...ne,...O]),onDelete:O=>{let ne=parseInt(O.replace("pending-",""),10);Te(X=>X.filter((Me,Ve)=>Ve!==ne));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Br,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?O=>f(a.id,O):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),c==="create"&&I.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:p.textTertiary},children:[I.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 hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:re.isMilestone,onChange:O=>G("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:p.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:p.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:p.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),re.dependencies&&re.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(O=>{let ne=r.find(X=>X.id===O);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${p.accent}20`,color:p.accent},children:[ne?.name||O.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let X=(re.dependencies||[]).filter(Me=>Me!==O);G("dependencies",X);},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"})})]},O)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{et(!Q),ae("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:p.bgSecondary,color:p.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:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{et(false),ae("");}}),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 shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${p.border}`},children:jsxRuntime.jsx("input",{type:"text",value:$,onChange:O=>ae(O.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:p.bgSecondary,color:p.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(O=>O.id!==a?.id).filter(O=>$===""||O.name.toLowerCase().includes($.toLowerCase())).map(O=>{let ne=re.dependencies?.includes(O.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let X=re.dependencies||[],Me;ne?Me=X.filter(Ve=>Ve!==O.id):Me=[...X,O.id],G("dependencies",Me);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ne?`${p.accent}10`:"transparent"},onMouseEnter:X=>{ne||(X.currentTarget.style.backgroundColor=p.hoverBg);},onMouseLeave:X=>{X.currentTarget.style.backgroundColor=ne?`${p.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:ne?p.accent:"transparent",borderColor:ne?p.accent:p.borderLight},children:ne&&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:p.textPrimary},children:O.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:p.textTertiary},children:O.id.slice(0,8)})]})]},O.id)}),r.filter(O=>O.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:p.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 ${p.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:p.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:p.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.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:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Nm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
358
+ Task dependencies must flow in one direction only.`);return}let V=se=>se.map(pe=>{if(pe.id===M){let Ce=pe.dependencies||[];if(!Ce.includes(E.id))return {...pe,dependencies:[...Ce,E.id]}}return pe.subtasks?{...pe,subtasks:V(pe.subtasks)}:pe});ne(V($)),Le?.(E.id,M);},[$,Le,Id]),Rd=react.useCallback((E,M)=>{let V=se=>se.map(pe=>{if(pe.id===E&&pe.dependencies){let Ce=pe.dependencies.filter(Tt=>Tt!==M);return {...pe,dependencies:Ce}}return pe.subtasks?{...pe,subtasks:V(pe.subtasks)}:pe});ne(V($)),L?.(E,M);},[$,L]),{startDate:Gn,endDate:Eg}=react.useMemo(()=>{let E=$.filter(Ce=>Ce.startDate&&Ce.endDate);if(E.length===0){let Ce=new Date,Tt=new Date(Ce);Tt.setDate(Tt.getDate()-30);let rt=new Date(Ce);return rt.setDate(rt.getDate()+60),{startDate:Tt,endDate:rt}}let M=E.flatMap(Ce=>[Ce.startDate,Ce.endDate]).filter(Ce=>Ce!==void 0),V=new Date(Math.min(...M.map(Ce=>Ce.getTime()))),se=new Date(Math.max(...M.map(Ce=>Ce.getTime()))),pe=G==="day"?7:G==="week"?14:30;return V.setDate(V.getDate()-pe),se.setDate(se.getDate()+pe),{startDate:V,endDate:se}},[$,G]),Pg=react.useCallback(async()=>{if(!P.current||!Ot.current||!Ra.current)return;await new Promise(co=>setTimeout(co,200));let E=P.current,M=Ot.current.querySelector(".gantt-grid-scroll"),V=Ra.current,se=M?.scrollTop||0,pe=M?.scrollLeft||0,Ce=V.scrollTop,Tt=V.scrollLeft,rt=E.style.overflow,ha=E.style.height,kt=M?.style.overflow||"",ba=V.style.overflow,ar=E.style.width,Lo=V.style.width;try{let co=M?.querySelector(".gantt-taskgrid-content"),Cr=V.querySelector("svg"),Gr=Cr?.getAttribute("height")?parseInt(Cr.getAttribute("height"),10):Cr?.getBoundingClientRect().height||0,Io=co?.scrollHeight||M?.scrollHeight||600,uo=Math.max(Gr,V.scrollHeight),Ud=Cr?.getAttribute("width")?parseInt(Cr.getAttribute("width"),10):Cr?.getBoundingClientRect().width||V.scrollWidth,Og=E.querySelector('[class*="h-12"]')?.offsetHeight||48,ii=Math.max(Io,uo,Gr),li=Og+ii+50,di=(M?.offsetWidth||300)+Ud+10;M&&(M.scrollTop=0,M.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,E.style.overflow="visible",E.style.height=`${li}px`,E.style.width=`${di}px`,M&&(M.style.overflow="visible",M.style.height=`${ii+50}px`),V.style.overflow="visible",V.style.height=`${ii+50}px`,V.style.width=`${Ud+10}px`,await new Promise(ui=>setTimeout(ui,150));let $g=await Zu__default.default(E,{backgroundColor:J.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:di,height:li,windowWidth:di+100,windowHeight:li+100,scrollX:0,scrollY:0,ignoreElements:ui=>{let zd=window.getComputedStyle(ui),Hd=parseInt(zd.zIndex,10);return !isNaN(Hd)&&Hd>=50||zd.position==="fixed"}}),ci=document.createElement("a");ci.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ci.href=$g.toDataURL("image/png"),ci.click();}finally{E.style.overflow=rt,E.style.height=ha,E.style.width=ar,M&&(M.style.overflow=kt,M.style.height="",M.scrollTop=se,M.scrollLeft=pe),V.style.overflow=ba,V.style.height="",V.style.width=Lo,V.scrollTop=Ce,V.scrollLeft=Tt;}},[J]),Mg=react.useCallback(async()=>{await Te.exportToPDF($);},[$]),Fg=react.useCallback(async()=>{await Te.exportToExcel($);},[$]),Ag=react.useCallback(()=>{let E=Te.exportToCSV($),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(M),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[$]),Lg=react.useCallback(()=>{let E=Te.exportToJSON($),M=new Blob([E],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(M),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[$]),Ig=react.useCallback(()=>{Te.exportToMSProject($,"Gantt Project","project.xml");},[$]),Bg=E=>{E.preventDefault(),Ye(true);},Ao=react.useRef(false),[si,Od]=react.useState(false),on=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Ra.current,M=Ot.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let V=()=>{if(Ao.current)return;Ao.current=true;let rt=E.scrollTop;ot(rt),M.scrollTop=rt,requestAnimationFrame(()=>{Ao.current=false;});},se=()=>{if(Ao.current)return;Ao.current=true;let rt=M.scrollTop;ot(rt),E.scrollTop=rt,requestAnimationFrame(()=>{Ao.current=false;});},pe=rt=>{if(ct&&M){let kt=M.parentElement?.getBoundingClientRect()?.left||0,ba=rt.clientX-kt,ar=200,Lo=Vt+Wr,co=window.innerWidth*Fe,Cr=Math.max(Lo,co);ba>=ar&&ba<=Cr&&_(ba);}if(si&&E){let ha=rt.clientX-on.current.x,kt=rt.clientY-on.current.y;E.scrollLeft=on.current.scrollLeft-ha,E.scrollTop=on.current.scrollTop-kt;}},Ce=()=>{Ye(false),Od(false);},Tt=rt=>{if(rt.button!==0)return;let ha=rt.target;ha.closest("[data-task-bar]")||ha.closest("[data-dependency-line]")||ha.closest("button")||ha.closest('[role="button"]')||ha.tagName==="rect"&&ha.getAttribute("data-clickable")==="true"||(Od(true),on.current={x:rt.clientX,y:rt.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},rt.preventDefault());};return E.addEventListener("scroll",V),M.addEventListener("scroll",se),E.addEventListener("mousedown",Tt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",Ce),()=>{E.removeEventListener("scroll",V),M.removeEventListener("scroll",se),E.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",Ce);}},[ct,si,Vt]);let $d=react.useRef(false),Rg=react.useRef(null);return react.useLayoutEffect(()=>{if($d.current||$.length===0||!Ra.current)return;$d.current=true,Rg.current=Gn;let E=Ra.current,M=new Date,V=G==="day"?60:G==="week"?20:8,se=(M.getTime()-Gn.getTime())/(1e3*60*60*24),pe=E.clientWidth,Tt=se*V*Xe-pe/2;se>=0&&pe>0&&(E.scrollLeft=Math.max(0,Tt));},[$.length,Gn,G,Xe]),jsxRuntime.jsx(qo.Provider,{value:Qe,children:jsxRuntime.jsx(hi.Provider,{value:_e,children:jsxRuntime.jsxs("div",{ref:P,className:"flex flex-col h-full w-full",style:{backgroundColor:J.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(xs,{theme:J,timeScale:G,onTimeScaleChange:q,zoom:Xe,onZoomChange:U,currentTheme:je,onThemeChange:ye,rowDensity:me,onRowDensityChange:Ne,showThemeSelector:u,showCreateTaskButton:b&&he?.canCreateTask!==false&&!he?.canCreateSubtaskOnly,createTaskLabel:x,onCreateTask:D,taskFilter:X,onTaskFilterChange:I,hideCompleted:K,onHideCompletedChange:de,onExportPNG:i?Pg:void 0,onExportPDF:i?Mg:void 0,onExportExcel:i?Fg:void 0,onExportCSV:i?Ag:void 0,onExportJSON:i?Lg:void 0,onExportMSProject:i?Ig:void 0}),jsxRuntime.jsxs("div",{ref:Ot,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Ar,className:"gantt-grid-scroll flex-shrink-0",style:{width:Rt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Ts,{tasks:Pa,theme:J,rowHeight:ia,availableUsers:c,templates:Ge,onTaskClick:R,onTaskDblClick:Ld,onTaskContextMenu:T,onTaskToggle:$a,scrollTop:Ke,columns:ft,onToggleColumn:Oa,onColumnResize:Aa,onTaskUpdate:wr,onTaskIndent:yg,onTaskOutdent:vg,onTaskMove:kg,onMultiTaskDelete:oi,onTaskDuplicate:wg,onTaskCreate:Cg,onTaskRename:Tg,onCreateSubtask:ni,onOpenTaskModal:R?E=>R(E):void 0,onDeleteRequest:(E,M)=>oe({taskId:E,taskName:M}),onTaskReparent:xg,scrollContainerRef:Ar})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:J.border,zIndex:15},onMouseDown:Bg}),jsxRuntime.jsx("div",{ref:Ra,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:si?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ms,{tasks:Pa,theme:J,rowHeight:ia,timeScale:G,startDate:Gn,endDate:Eg,zoom:Xe,locale:y,templates:Ge,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:R,onTaskDblClick:Ld,onTaskContextMenu:Dg,onTaskDateChange:Ng,onDependencyCreate:Bd,onDependencyDelete:Rd})})]}),Y.task&&jsxRuntime.jsx(Yo,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:J,onClose:()=>ge({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Y.task;if(!E)return [];let M=Te.findTaskById($,E.id)||E,V=M.subtasks&&M.subtasks.length>0,se=he?.canCreateTask!==false,pe=he?.canDeleteTask!==false;if(V){let kt=[],ba=he?.canDuplicateTask!==false;return se&&kt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ni(M.id);}}),ba&&kt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):ne(ar=>kn(ar,[M.id]).tasks),ge({isOpen:false,x:0,y:0,task:null});}}),pe&&(kt.length>0&&kt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),kt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{oe({taskId:M.id,taskName:M.name});}})),kt}let Ce=he?.canUpdateTask!==false,Tt=he?.canDuplicateTask!==false,rt=[];return Ce&&rt.push({id:"edit",label:Qe.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{ie?ie(M):Ee(M);}}),se&&rt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ni(M.id);}}),rt.length>0&&Ce&&rt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ce&&(rt.push({id:"markIncomplete",label:Qe.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{j?j(M):wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"}),rt.push({id:"setInProgress",label:Qe.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{le?le(M):wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"}),rt.push({id:"markComplete",label:Qe.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"})),(Tt||Ce&&M.startDate&&M.endDate)&&rt.length>0&&rt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Tt&&rt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):ne(kt=>kn(kt,[M.id]).tasks),ge({isOpen:false,x:0,y:0,task:null});}}),Ce&&M.startDate&&M.endDate&&rt.push({id:"split",label:Qe.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{let kt=M.startDate.getTime(),ba=M.endDate.getTime(),ar=kt+(ba-kt)/2,Lo=new Date(ar);Sg(M,Lo);}}),pe&&(rt.length>0&&rt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),rt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{oe({taskId:M.id,taskName:M.name});}})),rt})()}),jsxRuntime.jsx(Br,{task:et,isOpen:!!et,onClose:()=>Ee(null),onTaskUpdate:E=>{et&&(wr(et.id,E),Ee(null));},theme:je==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Oe&&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:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:J.bgSecondary,border:`1px solid ${J.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${J.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:J.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:J.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:J.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:J.textPrimary},children:['"',Oe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:J.bgPrimary,borderTop:`1px solid ${J.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>oe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:J.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=J.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{oi([Oe.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: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"]})]})]})})}),g?.enabled&&jsxRuntime.jsx(Ls,{tasks:$,theme:J,config:g,onTasksUpdate:ne,onTaskUpdate:wr,onTaskCreate:E=>{ne(M=>[...M,E]);},onTaskDelete:E=>{oi([E]);},onDependencyCreate:(E,M)=>{let V=Te.findTaskById($,E);V&&Bd(V,M);},onDependencyDelete:Rd})]})})})});function Qy(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 ev(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}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 Pl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ml=[{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 rm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:f,onDeleteAttachment:v}){let k=[...Pl,...i.filter(I=>!Pl.some(K=>K.id===I.id))],g=st[u]||st.dark,[y,h]=react.useState(false),[b,x]=react.useState(false),[D,N]=react.useState(false),[C,w]=react.useState(false),[R,F]=react.useState({top:0,left:0}),[T,H]=react.useState(null),[A,ie]=react.useState(new Date),[S,j]=react.useState({top:0,left:0}),[le,Le]=react.useState(false),[L,fe]=react.useState([]),[Q,qe]=react.useState(false),[B,ee]=react.useState(""),we=react.useRef(null),he=react.useRef(null),We=react.useRef(null),ke=react.useRef(null),je=react.useRef(null),[ae,G]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[q,me]=react.useState({});react.useEffect(()=>{a?(G({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Le(true)):(G({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Le(false),fe([]));},[a,e]),react.useEffect(()=>{let I=K=>{we.current&&!we.current.contains(K.target)&&h(false),he.current&&!he.current.contains(K.target)&&x(false),We.current&&!We.current.contains(K.target)&&N(false),ke.current&&!ke.current.contains(K.target)&&w(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let Ne=()=>{let I={};return ae.name.trim()||(I.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(I.endDate="La fecha de fin debe ser posterior a la de inicio"),me(I),Object.keys(I).length===0},Xe=async I=>{if(I.preventDefault(),!!Ne())try{let K=l==="create"&&L.length>0?{...ae,pendingFiles:L}:ae;await s(K),fe([]),t();}catch(K){console.error("Error submitting task:",K);}},U=(I,K)=>{G(de=>{let Se={...de,[I]:K};if(I==="status"){let Ke=K;Ke==="todo"?Se.progress=0:Ke==="in-progress"?(de.progress===0||de.progress===100)&&(Se.progress=50):Ke==="completed"||Ke==="closed"?Se.progress=100:(Ke==="in-review"||Ke==="review")&&(Se.progress=75);}if(I==="progress"){let Ke=typeof K=="number"?K:parseInt(K,10);Ke===100&&de.status!=="completed"?Se.status="completed":Ke>0&&Ke<100&&de.status==="todo"?Se.status="in-progress":Ke===0&&de.status!=="todo"&&(Se.status="todo");}return Se}),q[I]&&me(de=>{let Se={...de};return delete Se[I],Se});},De=k.find(I=>I.id===ae.status)??Pl[0],Me=Ml.find(I=>I.id===ae.priority)??Ml[1],Ae=bo.find(I=>I.value===ae.color)??bo[0],X={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden","data-theme":u,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:De.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.hoverBg,I.currentTarget.style.color=g.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Xe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ae.name,onChange:I=>U("name",I.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),q.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"}),q.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:I=>U("description",I.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:we,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...X,borderColor:De.color,backgroundColor:`${De.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:De.color}}),jsxRuntime.jsx("span",{style:{color:De.color},children:De.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:De.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{U("status",I.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:I.color}}),I.title,ae.status===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),jsxRuntime.jsxs("div",{ref:he,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:X,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Me.color}}),jsxRuntime.jsx("span",{children:Me.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ml.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{U("priority",I.id),x(false);},children:[jsxRuntime.jsx("span",{children:I.icon}),I.label,ae.priority===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:We,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:X,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((I,K)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:I.color||g.accent,borderColor:g.bgSecondary},children:I.initials},K))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&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 shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(I=>{let K=ae.assignees?.some(de=>de.name===I.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:g.textPrimary},onMouseEnter:de=>de.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{let de=K?(ae.assignees||[]).filter(Se=>Se.name!==I.name):[...ae.assignees||[],{name:I.name,avatar:I.avatar,initials:I.name.split(" ").map(Se=>Se[0]).join("").toUpperCase().slice(0,2),color:g.accent}];U("assignees",de);},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:g.accent},children:I.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:I.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},I.id)})})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)w(false);else {if(ke.current){let I=ke.current.getBoundingClientRect(),K=window.innerHeight,de=120,Ke=K-I.bottom<de?I.top-de-8:I.bottom+8;F({top:Ke,left:I.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:X,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Ae.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(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:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:I=>I.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(I=>{let K=ae.color===I.value;return jsxRuntime.jsx("button",{type:"button",onClick:de=>{de.preventDefault(),de.stopPropagation(),U("color",I.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:I.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:I.value,outline:K?`2px solid ${I.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},I.value)})})})})]})})]}),c.length>0||d?jsxRuntime.jsx(Kr,{selectedTags:ae.tags||[],availableTags:c,onChange:I=>U("tags",I),onCreateTag:d,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:je,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(T==="start")H(null);else {if(je.current){let I=je.current.getBoundingClientRect(),K=window.innerHeight,de=320,Ke=K-I.bottom<de?I.top-de-8:I.bottom+8;j({top:Ke,left:I.left});}H("start"),ie(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...X,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:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(T==="end")H(null);else {if(je.current){let I=je.current.getBoundingClientRect(),K=window.innerHeight,de=320,Ke=K-I.bottom<de?I.top-de-8:I.bottom+8;j({top:Ke,left:I.left});}H("end"),ie(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...X,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:T&&jsxRuntime.jsxs(wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(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:`${S.top}px`,left:`${S.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let I=new Date,K=new Date(I);K.setDate(I.getDate()+1);let de=new Date(I);de.setDate(I.getDate()+7);let Se=new Date(I);return Se.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:de},{label:"2 semanas",date:Se}].map((ot,ct)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Ye=>Ye.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Ye=>Ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(U("startDate",ot.date),(!ae.endDate||ot.date>ae.endDate)&&U("endDate",ot.date),H("end")):(U("endDate",ot.date),(!ae.startDate||ot.date<ae.startDate)&&U("startDate",ot.date),H(null));},children:ot.label},ct))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.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:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{U("startDate",void 0),U("endDate",void 0),H(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:()=>ie(new Date(A.getFullYear(),A.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:A.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ie(new Date(A.getFullYear(),A.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((I,K)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:I},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=A.getFullYear(),K=A.getMonth(),de=new Date(I,K,1).getDay(),Se=new Date(I,K+1,0).getDate(),Ke=new Date,ot=[];for(let Ye=de-1;Ye>=0;Ye--)ot.push({day:new Date(I,K,-Ye).getDate(),date:new Date(I,K-1,new Date(I,K,-Ye).getDate()),isCurrentMonth:false});for(let Ye=1;Ye<=Se;Ye++)ot.push({day:Ye,date:new Date(I,K,Ye),isCurrentMonth:true});let ct=42-ot.length;for(let Ye=1;Ye<=ct;Ye++)ot.push({day:Ye,date:new Date(I,K+1,Ye),isCurrentMonth:false});return ot.map((Ye,sa)=>{let _=Ye.date.toDateString()===Ke.toDateString(),Y=ae.startDate?.toDateString()===Ye.date.toDateString(),ge=ae.endDate?.toDateString()===Ye.date.toDateString(),et=ae.startDate&&ae.endDate&&Ye.date>=ae.startDate&&Ye.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:Ye.isCurrentMonth?Y||ge?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:Y?"#3B82F6":ge?"#7C3AED":et?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:_&&!Y&&!ge?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(U("startDate",Ye.date),ae.endDate&&Ye.date>ae.endDate&&U("endDate",Ye.date),H("end")):(U("endDate",Ye.date),ae.startDate&&Ye.date<ae.startDate&&U("startDate",Ye.date),H(null));},children:Ye.day},sa)})})()})]})]})]})})]}),q.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:q.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.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:I=>U("progress",parseInt(I.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.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"},children:[ae.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Le(!le),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${le?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&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:g.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:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?Qy(ae.effortMinutes):"",onChange:I=>{let K=ev(I.target.value);U("effortMinutes",K);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||p.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.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:g.textTertiary},children:["Adjuntos ",l==="create"?L.length>0&&`(${L.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsxRuntime.jsx(Er,{cardId:"pending",attachments:L.map((I,K)=>({id:`pending-${K}`,cardId:"pending",name:I.name,size:I.size,type:I.type,url:URL.createObjectURL(I),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:I=>fe(K=>[...K,...I]),onDelete:I=>{let K=parseInt(I.replace("pending-",""),10);fe(de=>de.filter((Se,Ke)=>Ke!==K));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Er,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?I=>f(a.id,I):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&L.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[L.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 hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:I=>U("isMilestone",I.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.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:g.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(I=>{let K=r.find(de=>de.id===I);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[K?.name||I.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let de=(ae.dependencies||[]).filter(Se=>Se!==I);U("dependencies",de);},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"})})]},I)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{qe(!Q),ee("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.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:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{qe(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 shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:B,onChange:I=>ee(I.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(I=>I.id!==a?.id).filter(I=>B===""||I.name.toLowerCase().includes(B.toLowerCase())).map(I=>{let K=ae.dependencies?.includes(I.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let de=ae.dependencies||[],Se;K?Se=de.filter(Ke=>Ke!==I.id):Se=[...de,I.id],U("dependencies",Se);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${g.accent}10`:"transparent"},onMouseEnter:de=>{K||(de.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:de=>{de.currentTarget.style.backgroundColor=K?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:K?g.accent:"transparent",borderColor:K?g.accent:g.borderLight},children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:I.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:I.id.slice(0,8)})]})]},I.id)}),r.filter(I=>I.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.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 ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:I=>!n&&(I.currentTarget.style.opacity="0.9"),onMouseLeave:I=>!n&&(I.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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var om=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
359
359
 
360
360
  AVAILABLE COMMANDS:
361
361
  1. move_task - Move a task to a different date
@@ -396,39 +396,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
396
396
 
397
397
  Always try to match task names case-insensitively and handle partial matches.
398
398
  If you can't find a task by name, search through the provided task list.
399
- If ambiguous, ask for clarification in the message field.`;function Dm(e){return `CURRENT TASKS:
400
- ${Sm(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(`
399
+ If ambiguous, ask for clarification in the message field.`;function nm(e){return `CURRENT TASKS:
400
+ ${sm(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(`
401
401
  `)}
402
402
 
403
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Sm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Kr(e,t){let a=Sm(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(c=>{let u=c.name.toLowerCase();return n.every(i=>u.includes(i))})}function zl(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}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 f={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(f!==void 0){let x=new Date(r),k=x.getDay(),p=f-k;return p<=0&&(p+=7),x.setDate(x.getDate()+p),x}}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 g=parseInt(s[1],10),f=s[2].toLowerCase(),x=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?x.setDate(x.getDate()+g):f==="week"||f==="semana"||f==="semanas"?x.setDate(x.getDate()+g*7):(f==="month"||f==="mes"||f==="meses")&&x.setMonth(x.getMonth()+g),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let g=parseInt(c[1],10),f=parseInt(c[2],10)-1,x=parseInt(c[3],10);return new Date(x,f,g)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),f=u[i[2].toLowerCase()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(x,f,g)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let g=m[l[1].toLowerCase()],f=parseInt(l[2],10),x=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,f)}return null}function Wl(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 Gl(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 Em(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 Mm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),m=r[2].trim(),l=Kr(t,i),g=zl(m);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(g);return x.setDate(x.getDate()+f),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:g,endDate:x},message:`Moved "${l.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),m=o[2].trim(),l=Kr(t,i),g=Wl(m);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let f=new Date(l.endDate);return f.setDate(f.getDate()+g),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:f},message:`Extended "${l.name}" by ${g} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),m=s[2].trim(),l=Kr(t,i),g=Gl(m);return l?g===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:g},message:`Set "${l.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),m=n[2].trim(),l=Kr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:m},message:`Renamed "${l.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),m=c[2].trim(),l=Kr(t,i),g=Kr(t,m);return l?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:l.id,dependencyTo:g.id,message:`Linked "${l.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),m=Kr(t,i);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Pm(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 Lx(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 Ix(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function js(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let l=a.find(g=>g.id===m);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>js(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},c=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||c&&u&&Math.abs(u.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:u,progress:e.progress||0,status:Lx(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Fm(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:Ix(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Am(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>js(r,e,t))}var Vl={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:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},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"}},_l={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:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},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"}},Ks={en:Vl,es:_l};function jl(e){return Ks[e]||Ks.en}function Ys(e,t){let a=jl(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 Kl=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#007BFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#32D74B]"}];function Lm(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 Im({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let f=x=>{c.current&&!c.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let u=Lm(e),i=Kl[0],m=Kl.find(f=>f.value===u)??i,l=m.icon,g=f=>{switch(Lm(f)){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(l,{className:d("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:d("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:g(e)})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:d("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(l,{className:d("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:d("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:g(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("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:Kl.map(f=>{let x=f.icon;return jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:d("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",u===f.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(x,{className:d("w-4 h-4",f.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:g(f.value)})]},f.value)})})]})}var Yl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Rm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let m=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let u=Yl.find(m=>m.value===e)??Yl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:d("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:d("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("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:Yl.map(m=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(m.value),n(false);},className:d("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===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-2 h-2 rounded-full",m.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[i]})]},m.value))})]})}function Js(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Zs(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 Qx(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:lucideReact.AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function Hm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[c,u]=react.useState(false),[i,m]=react.useState(""),l=react.useRef(null);react.useEffect(()=>{let p=v=>{l.current&&!l.current.contains(v.target)&&(u(false),m(""));};return c&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]);let g=t.filter(p=>p.name.toLowerCase().includes(i.toLowerCase())||p.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...g].sort((p,v)=>{let b={light:0,moderate:1,heavy:2,overloaded:3},h=p.workload?.level??"light",y=v.workload?.level??"light";return b[h]-b[y]}):g,x=p=>e.some(v=>v.name===p),k=p=>{if(a)if(x(p.name))a(e.filter(v=>v.name!==p.name));else {let v={name:p.name,initials:Js(p.name),color:p.color||Zs(p.name).replace("bg-","").replace("-500",""),avatar:p.avatarUrl};a([...e,v]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:d("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((p,v)=>jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!p.avatar&&Zs(p.name)),style:p.color&&!p.avatar?{backgroundColor:p.color}:void 0,title:p.name,children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,className:"w-full h-full rounded-full object-cover"}):p.initials||Js(p.name)},`${p.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:d("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:l,className:"relative",children:[jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),u(!c);},className:d("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:d("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:d("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((p,v)=>jsxRuntime.jsx("div",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!p.avatar&&Zs(p.name)),style:p.color&&!p.avatar?{backgroundColor:p.color}:void 0,children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,className:"w-full h-full rounded-full object-cover"}):p.initials||Js(p.name)},`${p.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:d("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),c&&jsxRuntime.jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:[n&&jsxRuntime.jsxs("div",{className:d("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-white/60 border-[#222]":"text-gray-500 border-gray-200"),children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:p=>m(p.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:d("w-full px-3 py-1.5 text-sm rounded border outline-none",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"),onClick:p=>p.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(p=>{let v=Qx(p.workload,r);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),k(p);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",p.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:v?.tooltip,children:[jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!p.avatarUrl&&Zs(p.name)),children:p.avatarUrl?jsxRuntime.jsx("img",{src:p.avatarUrl,alt:p.name,className:"w-full h-full rounded-full object-cover"}):Js(p.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:p.name}),p.email&&jsxRuntime.jsx("div",{className:d("text-xs",r?"text-white/30":"text-gray-400"),children:p.email})]}),n&&v&&jsxRuntime.jsxs("div",{className:d("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",v.color),children:[v.icon&&jsxRuntime.jsx(v.icon,{className:"w-3 h-3"}),v.label]}),x(p.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},p.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((p,v)=>jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/[0.05] text-white":"bg-gray-100 text-gray-700"),children:[p.name,jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(h=>h.name!==p.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${p.name}-${v}`))})]})]})}function Wm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:c=false,placeholder:u}){let[i,m]=react.useState(false),[l,g]=react.useState(o),[f,x]=react.useState(()=>{let S=o==="start"?e:t;if(S){let w=S instanceof Date?S:new Date(S);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),k=react.useRef(null),p=e?e instanceof Date?e:new Date(e):null,v=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let S=w=>{k.current&&!k.current.contains(w.target)&&m(false);};return i&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),react.useEffect(()=>{i&&g(r?o:"start");},[i,r,o]);let b=S=>S?S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",h=react.useCallback(()=>{let S=f.getFullYear(),w=f.getMonth(),E=new Date(S,w,1),T=new Date(S,w+1,0).getDate(),z=E.getDay(),H=[],D=new Date(S,w,0).getDate();for(let de=z-1;de>=0;de--)H.push({date:new Date(S,w-1,D-de),isCurrentMonth:false});for(let de=1;de<=T;de++)H.push({date:new Date(S,w,de),isCurrentMonth:true});let ve=42-H.length;for(let de=1;de<=ve;de++)H.push({date:new Date(S,w+1,de),isCurrentMonth:false});return H},[f]),y=S=>{if(r)o==="start"?a(S,v||void 0):a(p||void 0,S),m(false);else if(l==="start"){let w=v&&S>v?S:v;a(S,w||void 0),g("end");}else {let w=p&&S<p?S:p;a(w||void 0,S),m(false);}},C=()=>{let S=new Date,w=new Date(S);w.setDate(S.getDate()+1);let E=new Date(S);E.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let L=new Date(S);L.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let T=new Date(S);T.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let z=new Date(S);z.setDate(S.getDate()+14);let H=new Date(S);return H.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:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:L,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:z,display:z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let S=r&&o==="start"?p:v;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:d("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm",s?"text-white/60":"text-gray-500"),children:b(S)})]})}let N=r&&o==="start"?p:v;return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:S=>{S.stopPropagation(),m(!i);let w=o==="start"?p:v;w&&x(new Date(w.getFullYear(),w.getMonth(),1));},className:d("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:d("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm",s?"text-white/60":"text-gray-500"),children:b(N)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxRuntime.jsxs("div",{className:d("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:d("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((S,w)=>jsxRuntime.jsxs("button",{className:d("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:()=>y(S.date),children:[jsxRuntime.jsx("span",{children:S.label}),jsxRuntime.jsx("span",{className:d("text-xs",s?"text-white/30":"text-gray-400"),children:S.display})]},w)),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,v||void 0):a(p||void 0,void 0):a(void 0,void 0),m(false);},className:d("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:d("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="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:d("font-medium",s?"text-white":"text-gray-900"),children:f.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:()=>x(new Date),className:d("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:()=>x(new Date(f.getFullYear(),f.getMonth()-1)),className:d("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(f.getFullYear(),f.getMonth()+1)),className:d("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("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:d("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:h().map((S,w)=>{let E=S.date.toDateString()===new Date().toDateString(),L=p?.toDateString()===S.date.toDateString(),T=v?.toDateString()===S.date.toDateString(),z=L||T,H=!r&&p&&v&&S.date>=p&&S.date<=v;return jsxRuntime.jsx("button",{onClick:()=>y(new Date(S.date)),className:d("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"),E&&"ring-2 ring-[#007BFF]",L&&"bg-[#007BFF] text-white",T&&!L&&"bg-[#7C3AED] text-white",H&&!z&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!z&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:S.date.getDate()},w)})})]})]})]})]})}function Qs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:c}){let u=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Wm,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:c||null,onChange:(g,f)=>{t&&t(s==="start"?g:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function sn(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 ei(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[c,u]=react.useState(false),i=react.useRef(e),m=react.useRef([]);return react.useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,g=e,f=g-l,x=r/o;u(true);for(let k=1;k<=o;k++){let p=setTimeout(()=>{let v=k/o,b=1-Math.pow(1-v,3),h=Math.round(l+f*b);n(h),k===o&&(u(false),n(g));},x*k);m.current.push(p);}return i.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:c}}function Gm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,c]=react.useState(0),u=react.useRef(null),i=react.useRef(null),m=react.useCallback(f=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(f),c(0);let x=Date.now();i.current=setInterval(()=>{let k=Date.now()-x,p=Math.min(k/a*100,100);c(p);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),c(0);},a);},[a,e]),l=react.useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),c(0),r?.();},[r]);return react.useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:l}}function jm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:c}=sn(),{displayValue:u,isAnimating:i}=ei(e,{enabled:o,duration:300,steps:6}),m=g=>{if(r||!t)return;g.stopPropagation();let f=g.currentTarget.getBoundingClientRect(),x=g.clientX-f.left,k=Math.round(x/f.width*100),p=Math.max(0,Math.min(100,k));p!==e&&(t(p),s&&c());},l=u??e;return jsxRuntime.jsxs("div",{className:d("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsxRuntime.jsx("div",{onClick:m,className:d("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:d("h-full rounded-full transition-[width]",l===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxRuntime.jsxs("span",{className:d("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function qm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[c,u]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{u(e);},[e]);let m=()=>{c!==e&&t?.(c),n(false);},l=g=>{g.key==="Enter"?m():g.key==="Escape"&&(u(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:d("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:c,onChange:g=>u(g.target.value),onBlur:m,onKeyDown:l,onClick:g=>g.stopPropagation(),className:d("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:g=>{g.stopPropagation(),n(true);},className:d("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 Zm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:c=true,enableSaveFlash:u=true}){let[i,m]=react.useState(false),[l,g]=react.useState(e?.toString()||""),f=react.useRef(null),{isFlashing:x,triggerFlash:k}=sn(),{displayValue:p,isAnimating:v}=ei(e,{enabled:c&&!i});react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),react.useEffect(()=>{g(e?.toString()||"");},[e]);let b=()=>{let y=parseFloat(l);if(!isNaN(y)){let C=y;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),u&&k());}m(false);},h=y=>{y.key==="Enter"?b():y.key==="Escape"&&(g(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:d("text-sm font-mono",a?"text-white/60":"text-gray-500",v&&"font-medium"),children:p!==void 0?p:r}):i?jsxRuntime.jsx("input",{ref:f,type:"number",value:l,onChange:y=>g(y.target.value),onBlur:b,onKeyDown:h,onClick:y=>y.stopPropagation(),min:o,max:s,className:d("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:y=>{y.stopPropagation(),m(true);},className:d("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",p===void 0&&(a?"text-white/30":"text-gray-400"),x&&(a?"bg-green-500/30":"bg-green-500/20"),v&&"font-medium scale-105"),children:p!==void 0?p:r})}function Qm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,c]=react.useState(false),u=react.useRef(null);return react.useEffect(()=>{let i=m=>{u.current&&!u.current.contains(m.target)&&c(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),c(!n);},className:d("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:d("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:d("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:d("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:d("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),a(i),c(false);},className:d("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function tp({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:c,progress:u,startChange:i,cancelChange:m}=Gm(t,{delay:s}),l=f=>{f.stopPropagation(),!r&&t&&(o?c?m():i(!e):t(!e));},g=c?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:l,disabled:r||!t,className:d("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",g?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&g&&"ring-green-500/50",c&&!g&&"ring-red-500/50",c&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[c&&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:g?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):g?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),m();},className:d("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 op({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:d("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:d("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 xv(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 vv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let c=parseInt(a[1],10),u=parseInt(a[2],10);return c*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let c=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(c*60)+u}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 Lo({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:c=false}){let[u,i]=react.useState(false),[m,l]=react.useState(""),g=react.useRef(null),{isFlashing:f,triggerFlash:x}=sn(),k=xv(e,r);react.useEffect(()=>{u&&g.current&&(g.current.focus(),g.current.select());},[u]),react.useEffect(()=>{if(e){let b=Math.floor(e/60),h=e%60;b>0&&h>0?l(`${b}h ${h}m`):b>0?l(`${b}h`):l(`${h}m`);}else l("");},[e,u]);let p=()=>{let b=vv(m);b!==e&&(t?.(b),n&&x()),i(false);},v=b=>{b.key==="Enter"?p():b.key==="Escape"&&i(false);};return c?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:d("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("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"})]}):s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:d("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:k})]}):u?jsxRuntime.jsx("input",{ref:g,type:"text",value:m,onChange:b=>l(b.target.value),onBlur:p,onKeyDown:v,onClick:b=>b.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:d("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:b=>{b.stopPropagation(),i(true);},className:d("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",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:d("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:k})]})}function ip({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsxRuntime.jsx("span",{className:d("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let c=o==="es";return a===0?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#007BFF"},children:c?"En Tiempo":"On Track"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:d("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function up({task:e,isDark:t,locale:a="en",onLogTime:r,onOpenTimeLog:o}){let s=a==="es",[n,c]=react.useState(false),[u,i]=react.useState(false),m=react.useRef(null),l=e.timeLoggedMinutes||0,g=e.effortMinutes||0,f=Math.round(l/60*10)/10,x=Math.round(g/60*10)/10,k=g>0?l/g*100:0,p=k>100?Math.round((l-g)/60*10)/10:0,v=k>100?"#FF453A":k>=80?"#FFD60A":"#32D74B";react.useEffect(()=>{if(!u)return;let C=N=>{m.current&&!m.current.contains(N.target)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[u]);let b=C=>{C.stopPropagation(),r?i(N=>!N):o&&o(e);},h=async(C,N)=>{r&&C&&r(e,C,N),i(false);},y=r||o;return g===0&&l===0?jsxRuntime.jsxs("div",{className:"relative flex items-center gap-2",onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("span",{className:d("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),n&&y&&jsxRuntime.jsx("button",{onClick:b,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:s?"Reg":"Log"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&r&&jsxRuntime.jsx("div",{ref:m,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(Fr,{mode:"log",locale:a,isDark:t,onSave:h,onClose:()=>i(false)})})})})]}):jsxRuntime.jsxs("div",{className:"relative flex items-center gap-2 w-full",onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1.5 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.jsxs("span",{className:"font-mono",style:{fontSize:"13px",fontWeight:700,color:t?"#FFFFFF":"#111827"},children:[f,"h"]}),jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"11px",color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",x,"h"]}),p>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:["+",p,"h ",s?"Exceso":"Over"]})]}),jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:"3px",backgroundColor:t?"#333":"#E5E7EB",borderRadius:"2px"},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:v,borderRadius:"2px",transition:"width 0.3s"}})})]}),y&&jsxRuntime.jsxs("button",{onClick:b,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"}),"Log"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&r&&jsxRuntime.jsx("div",{ref:m,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(Fr,{mode:"log",locale:a,isDark:t,onSave:h,onClose:()=>i(false)})})})})]})}function mp({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsxRuntime.jsx("span",{className:d("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsxRuntime.jsx("img",{src:a.avatar,alt:a.name,className:d("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsxRuntime.jsx("span",{className:d("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxRuntime.jsxs("span",{className:d("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var Tv={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function gp({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:d("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:d("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Tv[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function Wv(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gv(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 yp({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:c,onColumnHide:u,onColumnSort:i,availableUsers:m=[],onOpenTimeLog:l,onReportBlocker:g,onCopyTaskLink:f}){let x=react.useRef(null),k=r==="es"?bp.es:bp.en;if(react.useEffect(()=>{let y=N=>{x.current&&!x.current.contains(N.target)&&t();},C=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let p=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:k.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),c&&(y.push({id:"status",label:k.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:k.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:k.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:k.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:k.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:k.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:k.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:k.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:k.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),m.length>0&&y.push({id:"assign",label:k.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:m.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 N=e.task.assignees||[],w=N.some(E=>E.name===C.name)?N.filter(E=>E.name!==C.name):[...N,{name:C.name,initials:Wv(C.name),color:C.color||Gv(C.name),avatar:C.avatarUrl}];c({...e.task,assignees:w}),t();}}))})),l&&y.push({id:"log-time",label:k.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),g&&y.push({id:"report-blocker",label:k.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),f&&y.push({id:"copy-link",label:k.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{f(e.task),t();}}),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:k.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:k.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:k.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:k.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:k.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),y},b=e.type==="task"?p():v(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:x,style:h,className:d("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:b.map(y=>y.separator?jsxRuntime.jsx("div",{className:d("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(Vv,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:d("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",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:d(y.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Vv({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:d("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:d("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:d("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(c=>jsxRuntime.jsxs("button",{onClick:c.onClick,className:d("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:c.icon}),c.label]},c.id))})]})}var bp={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 Dp={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"}),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"})},i2=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Ep({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:c}){let[u,i]=react.useState(""),[m,l]=react.useState(null),g=react.useRef(null),f=c==="es"?Sp.es:Sp.en;if(react.useLayoutEffect(()=>{if(!e||!g.current)return;let h=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),N=window.innerHeight-y.top-20;l(Math.max(300,N));};return requestAnimationFrame(h),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[e]),react.useEffect(()=>{if(!e)return;let h=setTimeout(()=>{let y=N=>{g.current&&!g.current.contains(N.target)&&t();},C=N=>{N.key==="Escape"&&t();};document.addEventListener("mousedown",y),document.addEventListener("keydown",C),g._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(h),g._cleanup&&g._cleanup();}},[e,t]),!e)return null;let x=h=>f.columns[h]||h,k=h=>{if(h==="name")return;let y=a.map(C=>C.id===h?{...C,visible:!C.visible}:C);o(y);},p=(h,y)=>{let C=a.find(S=>S.type===h&&(!y||S.customFieldId===y));if(C){k(C.id);return}let N={id:y||h,type:h,label:y?r.find(S=>S.id===y)?.name||h:x(h),width:120,visible:true,sortable:true,resizable:true,customFieldId:y};o([...a,N]);},v=i2.filter(h=>x(h).toLowerCase().includes(u.toLowerCase())),b=r.filter(h=>h.name.toLowerCase().includes(u.toLowerCase()));return jsxRuntime.jsxs("div",{ref:g,style:m?{maxHeight:`${m}px`}:void 0,className:d("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center justify-between px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsxRuntime.jsx("button",{onClick:t,className:d("p-1 rounded",n?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:d("w-4 h-4",n?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:u,onChange:h=>i(h.target.value),placeholder:f.searchPlaceholder,className:d("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"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")})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-white/30":"text-gray-400"),children:f.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:v.map(h=>{let y=a.find(S=>S.type===h&&!S.customFieldId),C=y?.visible??false,N=h==="name";return jsxRuntime.jsxs("button",{onClick:()=>{N||(y?k(y.id):p(h));},disabled:N,className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",N&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",C?"bg-[#007BFF] border-[#007BFF]":n?"border-[#333]":"border-gray-300"),children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-white/60":"text-gray-400",children:Dp[h]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:x(h)})]},h)})})]}),b.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-white/30":"text-gray-400"),children:f.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:b.map(h=>{let C=a.find(N=>N.customFieldId===h.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>p(h.type,h.id),className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",C?"bg-[#007BFF] border-[#007BFF]":n?"border-[#333]":"border-gray-300"),children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-white/60":"text-gray-400",children:Dp[h.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:h.name})]},h.id)})})]})]})]})}var Sp={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",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},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:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var b2=[{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 Fp({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[c,u]=react.useState("text"),[i,m]=react.useState([""]),l=o==="es"?Pp.es:Pp.en;react.useEffect(()=>{e&&(n(""),u("text"),m([""]));},[e]),react.useEffect(()=>{let p=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]);let g=()=>{if(!s.trim())return;let p={name:s.trim(),type:c};c==="dropdown"&&(p.options=i.filter(v=>v.trim())),a(p),t();},f=()=>{m([...i,""]);},x=(p,v)=>{let b=[...i];b[p]=v,m(b);},k=p=>{i.length>1&&m(i.filter((v,b)=>b!==p));};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:d("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:d("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:d("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:d("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:d("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:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:p=>n(p.target.value),placeholder:l.fieldNamePlaceholder,className:d("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:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:b2.map(p=>jsxRuntime.jsxs("button",{onClick:()=>u(p.type),className:d("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===p.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:c===p.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:p.icon}),jsxRuntime.jsx("span",{className:d("text-xs",c===p.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[p.type]})]},p.type))})]}),c==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((p,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:p,onChange:b=>x(v,b.target.value),placeholder:`${l.option} ${v+1}`,className:d("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>k(v),className:d("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"})})]},v)),jsxRuntime.jsxs("button",{onClick:f,className:d("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"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:d("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:d("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:l.cancel}),jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim(),className:d("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:l.create})]})]})]}):null}var Pp={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 Ip={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 Bp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,c]=react.useState(false),u=react.useRef(null),i=react.useRef(0),m=s==="es"?Ip.es:Ip.en;react.useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||u.current&&!u.current.contains(k.target)&&c(false);},x=k=>{k.key==="Escape"&&c(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",x);}},[n]);let l=[{value:"all",label:m.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],g=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),c(x=>!x);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",g&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),m.filters,g&&jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",o?"bg-[#007BFF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:d("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:d("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:d("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(f=>{let x=e===f.value&&!t,k=()=>f.value==="all"?x?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"}):f.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(f.value),r(false),c(false);},className:d("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",x&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d(x?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsxRuntime.jsx("span",{className:d("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:d("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},f.value)})}),jsxRuntime.jsx("div",{className:d("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 f=!t;r(f),f&&a("all"),c(false);},className:d("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:d("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:d("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:d("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Rp({data:e,isDark:t,locale:a="en"}){let r=a==="es";return jsxRuntime.jsxs("div",{className:d("w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:d("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:r?"SALUD DEL PROYECTO":"PROJECT HEALTH"})}),jsxRuntime.jsxs("div",{className:d("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:d("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:r?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:d("text-xs",t?"text-white/60":"text-gray-600"),children:r?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:d("px-2 py-0.5 rounded text-[11px] font-mono font-bold",(e.openRFIs??0)>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs??0})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:d("text-xs",t?"text-white/60":"text-gray-600"),children:r?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:d("text-[11px] font-mono font-bold",(e.submittalsApprovalPercent??0)>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent??0,"%"]})]})]})]}),jsxRuntime.jsxs("div",{className:d("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:d("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:r?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let o=e.scheduleVarianceDays??0,s=o>0,n=o<0,c=e.scheduleVarianceLabel||(s?`+${o} ${r?"D\xEDas ADELANTE":"Days AHEAD"}`:n?`${o} ${r?"D\xEDas ATR\xC1S":"Days BEHIND"}`:r?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:d("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",s&&"bg-[#32D74B]/15 text-[#32D74B]",n&&"bg-[#FF453A]/15 text-[#FF453A]",!s&&!n&&"bg-[#007BFF]/15 text-[#007BFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:d("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:r?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((o,s)=>{let n=o.utilizationPercent>=100?"#FF453A":o.utilizationPercent>=80?"#FFD60A":o.color||"#32D74B";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:d("text-xs",t?"text-white/60":"text-gray-600"),children:o.name}),jsxRuntime.jsxs("span",{className:d("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[o.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:d("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(o.utilizationPercent,100)}%`,backgroundColor:n}})})]},`${o.name}-${s}`)})})]})]})}var P2=[{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 zp(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(...zp(r.subtasks,t+1));return a}function F2(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(),u=s.endDate.getTime()-n;if(u<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,u))/u*100;if(m<=0)continue;let l=(s.progress||0)/m;r+=l,o++;}return o>0?r/o:null}function A2(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Wp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:c=[],customFields:u=[],toolbarRightContent:i}){let{theme:m="dark",locale:l="en",customTranslations:g,showSearch:f=true,showHierarchy:x=true,tableColumns:k,allowColumnCustomization:p=true,allowColumnResize:v=true,enableContextMenu:b=true,showCreateTaskButton:h=false,onCreateTask:y,persistFilter:C=false,financialBlur:N,healthSidebar:S}=t,w=Ys(l,g),E=m==="dark",L=react.useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let U=localStorage.getItem(C);if(U){let Oe=JSON.parse(U);return {statusFilter:Oe.statusFilter||"all",hideCompleted:Oe.hideCompleted||!1}}}catch(U){console.error("Error loading persisted filter:",U);}return {statusFilter:"all",hideCompleted:false}},[C]),[T,z]=react.useState("startDate"),[H,J]=react.useState("asc"),[D,ve]=react.useState(""),[de,V]=react.useState(()=>L().statusFilter),[I,Te]=react.useState(()=>L().hideCompleted),[Q,et]=react.useState(k||P2),[$,ae]=react.useState(false),[Re,ke]=react.useState(false),[Ze,Ee]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ze,re]=react.useState(null),[K,q]=react.useState(0),[be,we]=react.useState(0),Je=react.useRef(null);react.useEffect(()=>{k&&et(k);},[k]),react.useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:de,hideCompleted:I}));}catch(U){console.error("Error persisting filter state:",U);}},[C,de,I]);let G=react.useMemo(()=>{let U=new Set;function Oe(Qe){for(let Ne of Qe)Ne.subtasks?.length&&(Ne.isExpanded!==false&&U.add(Ne.id),Oe(Ne.subtasks));}return Oe(e),U},[e]),he=react.useMemo(()=>Q.filter(U=>U.visible),[Q]),je=react.useCallback(U=>{a.onTaskToggleExpand?.(U);},[a]),Ie=react.useCallback(U=>{T===U?J(Oe=>Oe==="asc"?"desc":"asc"):(z(U),J("asc")),a.onSortChange?.({column:U,direction:H==="asc"?"desc":"asc"});},[T,H,a]),Ke=react.useCallback(U=>{et(U),a.onColumnsChange?.(U);},[a]),O=react.useCallback(U=>{let Oe=Q.map(Qe=>Qe.id===U?{...Qe,visible:false}:Qe);Ke(Oe);},[Q,Ke]),ne=react.useCallback((U,Oe)=>{z(U),J(Oe);},[]),X=react.useCallback((U,Oe,Qe)=>{b&&(U.preventDefault(),Ee({isOpen:true,x:U.clientX,y:U.clientY,type:Oe?"task":"header",task:Oe,columnId:Qe}));},[b]),Me=react.useCallback(()=>{Ee(U=>({...U,isOpen:false}));},[]),Ve=react.useCallback((U,Oe)=>{if(!v)return;U.preventDefault(),U.stopPropagation();let Qe=Q.find(Ne=>Ne.id===Oe);Qe&&(re(Oe),q(U.clientX),we(Qe.width));},[Q,v]);react.useEffect(()=>{if(!ze)return;let U=Qe=>{let Ne=Qe.clientX-K,$e=Math.max(50,be+Ne),me=Q.map(R=>R.id===ze?{...R,width:$e}:R);et(me);},Oe=()=>{ze&&a.onColumnsChange?.(Q),re(null);};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",Oe),()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Oe);}},[ze,K,be,Q,a]);let tt=react.useCallback(async U=>{if(a.onCreateCustomField){let Oe={...U,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Oe);}ke(false);},[a]),rt=react.useCallback(U=>U.progress===100||U.status==="completed"?"completed":U.progress&&U.progress>0||U.status==="in-progress"?"in-progress":"todo",[]),_e=react.useMemo(()=>{let U=zp(e);if(D.trim()){let Oe=D.toLowerCase();U=U.filter(Qe=>Qe.name.toLowerCase().includes(Oe));}return de!=="all"&&(U=U.filter(Oe=>rt(Oe)===de)),I&&(U=U.filter(Oe=>rt(Oe)!=="completed")),U.sort((Oe,Qe)=>{let Ne,$e;switch(T){case "name":Ne=Oe.name.toLowerCase(),$e=Qe.name.toLowerCase();break;case "startDate":Ne=Oe.startDate?.getTime()||0,$e=Qe.startDate?.getTime()||0;break;case "endDate":Ne=Oe.endDate?.getTime()||0,$e=Qe.endDate?.getTime()||0;break;case "progress":Ne=Oe.progress||0,$e=Qe.progress||0;break;case "status":Ne=Oe.status||"todo",$e=Qe.status||"todo";break;case "priority":let me={urgent:0,high:1,medium:2,low:3,none:4};Ne=me[Oe.priority]??4,$e=me[Qe.priority]??4;break;default:return 0}return Ne<$e?H==="asc"?-1:1:Ne>$e?H==="asc"?1:-1:0}),U},[e,D,de,I,T,H,rt]),Nt=react.useCallback((U,Oe)=>{let Qe=me=>{a.onTaskUpdate?.({...U,...me});},Ne=me=>me?U.customFields?.find(j=>j.fieldId===me)?.value:void 0,$e=(me,R)=>{if(!me)return;let Be=[...U.customFields||[]],De=Be.findIndex(fe=>fe.fieldId===me);De>=0?Be[De]={fieldId:me,value:R}:Be.push({fieldId:me,value:R}),Qe({customFields:Be});};switch(Oe.type){case "name":return null;case "status":return jsxRuntime.jsx(Im,{value:U.status||(U.progress===100?"completed":U.progress&&U.progress>0?"in-progress":"todo"),onChange:R=>{Qe({status:R,progress:R==="completed"?100:R==="in-progress"?50:0});},isDark:E,locale:l,translations:w.status});case "priority":return jsxRuntime.jsx(Rm,{value:U.priority,onChange:R=>Qe({priority:R}),isDark:E,locale:l});case "assignees":return jsxRuntime.jsx(Hm,{value:U.assignees||[],availableUsers:c,onChange:R=>Qe({assignees:R}),isDark:E,locale:l});case "startDate":return jsxRuntime.jsx(Qs,{value:U.startDate,onChange:R=>Qe({startDate:R}),isDark:E,locale:l,dateField:"start",startDate:U.startDate,endDate:U.endDate});case "endDate":return jsxRuntime.jsx(Qs,{value:U.endDate,onChange:R=>Qe({endDate:R}),isDark:E,locale:l,dateField:"end",startDate:U.startDate,endDate:U.endDate});case "progress":return jsxRuntime.jsx(jm,{value:U.progress||0,onChange:R=>{let j=R===100?"completed":R>0?"in-progress":"todo";Qe({progress:R,status:j});},isDark:E});case "tags":return jsxRuntime.jsx(op,{value:U.tags||[],isDark:E});case "text":return jsxRuntime.jsx(qm,{value:Ne(Oe.customFieldId)||"",onChange:R=>$e(Oe.customFieldId,R),isDark:E});case "number":return jsxRuntime.jsx(Zm,{value:Ne(Oe.customFieldId)||0,onChange:R=>$e(Oe.customFieldId,R),isDark:E});case "date":let me=Ne(Oe.customFieldId);return jsxRuntime.jsx(Qs,{value:me?new Date(me):void 0,onChange:R=>$e(Oe.customFieldId,R),isDark:E,locale:l});case "dropdown":return jsxRuntime.jsx(Qm,{value:Ne(Oe.customFieldId)||"",options:Oe.options||[],onChange:R=>$e(Oe.customFieldId,R),isDark:E});case "checkbox":return jsxRuntime.jsx(tp,{value:Ne(Oe.customFieldId)||false,onChange:R=>$e(Oe.customFieldId,R),isDark:E});case "estimatedTime":{let R=U.status==="completed"||U.progress===100;return jsxRuntime.jsx(Lo,{value:U.estimatedTime,onChange:j=>Qe({estimatedTime:j}),isDark:E,locale:l,disabled:R})}case "quotedTime":{let R=U.status==="completed"||U.progress===100,j=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsxRuntime.jsx(Lo,{value:U.quotedTime,onChange:Be=>Qe({quotedTime:Be}),isDark:E,locale:l,disabled:R,isBlurred:j})}case "elapsedTime":{let R=U.status==="completed"||U.progress===100;return jsxRuntime.jsx(Lo,{value:U.elapsedTime,onChange:j=>Qe({elapsedTime:j}),isDark:E,locale:l,disabled:R})}case "effortMinutes":{let R=U.status==="completed"||U.progress===100;return jsxRuntime.jsx(Lo,{value:U.effortMinutes,onChange:j=>Qe({effortMinutes:j}),isDark:E,locale:l,disabled:R})}case "timeLoggedMinutes":{let R=U.status==="completed"||U.progress===100;return jsxRuntime.jsx(Lo,{value:U.timeLoggedMinutes,onChange:a.onLogTime?j=>{a.onLogTime?.(U,j);}:void 0,isDark:E,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:R})}case "soldEffortMinutes":{let R=U.status==="completed"||U.progress===100,j=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Lo,{value:U.soldEffortMinutes,onChange:Be=>Qe({soldEffortMinutes:Be}),isDark:E,locale:l,disabled:R,isBlurred:j})}case "scheduleVariance":return jsxRuntime.jsx(ip,{startDate:U.startDate,endDate:U.endDate,scheduleVariance:U.scheduleVariance,isDark:E,locale:l});case "hoursBar":return jsxRuntime.jsx(up,{task:U,isDark:E,locale:l,onLogTime:a.onLogTime,onOpenTimeLog:a.onOpenTimeLog});case "teamLoad":return jsxRuntime.jsx(mp,{task:U,isDark:E});case "blockers":return jsxRuntime.jsx(gp,{blockers:U.blockers,isDark:E,locale:l});default:return jsxRuntime.jsx("span",{className:d("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,l,c,w]),ht=react.useCallback(U=>{let Qe={name:w.columns.name,status:w.columns.status,priority:w.columns.priority,assignees:w.columns.assignees,startDate:w.columns.startDate,endDate:w.columns.endDate,progress:w.columns.progress,tags:w.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:w.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:w.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:w.columns.elapsedTime||(l==="es"?"Tiempo":"Time Spent"),effortMinutes:w.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:w.columns.timeLoggedMinutes||(l==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:w.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),scheduleVariance:w.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:w.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:w.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:w.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[U.type]||U.label;return typeof Qe=="string"?Qe:String(Qe||U.type)},[w,l]),xt=react.useMemo(()=>he.reduce((U,Oe)=>U+Oe.width,0)+(p?48:0),[he,p]),yt=react.useMemo(()=>{let Qe=he.reduce(($e,me)=>$e+me.width,0)+(p?48:0),Ne={};for(let $e of he)Ne[$e.id]=`${$e.width/Qe*100}%`;return Ne},[he,p]);return r?jsxRuntime.jsx("div",{className:d("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:d("text-sm",E?"text-white/60":"text-gray-600"),children:[w.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:d("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:d("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("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:d("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:w.empty.noTasks}),jsxRuntime.jsx("p",{className:d("text-sm",E?"text-white/60":"text-gray-600"),children:w.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Je,className:d(E?"bg-[#0D0D0D]":"bg-white",ze&&"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:d("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.jsx(Bp,{value:de,hideCompleted:I,onChange:V,onHideCompletedChange:Te,isDark:E,locale:l}),jsxRuntime.jsxs("div",{className:d("text-sm",E?"text-white/60":"text-gray-600"),children:[_e.length," ",w.pagination.tasks]}),f&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:d("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:D,onChange:U=>ve(U.target.value),placeholder:w.toolbar.searchPlaceholder,className:d("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"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),h&&y&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:y,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:w.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%",minWidth:xt},children:[jsxRuntime.jsxs("div",{className:d("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:[he.map(U=>jsxRuntime.jsxs("div",{className:d("relative flex items-center gap-2 px-4 py-2",E?"text-white/60":"text-gray-500"),style:{width:yt[U.id],minWidth:U.minWidth},onContextMenu:Oe=>X(Oe,void 0,U.id),children:[U.sortable?jsxRuntime.jsxs("button",{onClick:()=>Ie(U.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ht(U),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:d("w-3 h-3",T===U.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{children:ht(U)}),v&&U.resizable&&jsxRuntime.jsx("div",{className:d("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ze===U.id&&"bg-[#007BFF]"),onMouseDown:Oe=>Ve(Oe,U.id)})]},U.id)),p&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),ae(Oe=>!Oe);},className:d("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",$&&(E?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Ep,{isOpen:$,onClose:()=>ae(false),columns:Q,customFields:u,onColumnsChange:Ke,onCreateCustomField:()=>{ae(false),ke(true);},isDark:E,locale:l})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:_e.map((U,Oe)=>{let Qe=G.has(U.id),Ne=Math.min(Oe*.01,.2),$e=U.hasChildren&&U.level===0,me=U.subtasks?.length||0;return $e?jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ne},className:d("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>je(U.id),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),je(U.id);},className:d("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Qe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",E?"text-white/40":"text-gray-500")})}),Qe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"}}),U.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:U.wbsCode}),jsxRuntime.jsx("span",{className:d("text-xs font-bold font-mono uppercase tracking-wide truncate",E?"text-gray-200":"text-gray-800"),children:U.name}),jsxRuntime.jsxs("span",{className:d("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:["(",me," ",l==="es"?me===1?"Tarea":"Tareas":me===1?"Item":"Items",")"]}),jsxRuntime.jsx("div",{className:"flex-1"}),(()=>{let R=F2(U),j=A2(U);return jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[R!==null&&jsxRuntime.jsxs("span",{className:d("text-[10px] font-mono",R>=1?"text-[#32D74B]":R>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",R.toFixed(2)]}),j>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[l==="es"?"Conflicto Recurso":"Resource Conflict",": ",j]}),U.progress!=null&&U.progress>0&&jsxRuntime.jsxs("span",{className:d("text-[10px] font-mono",U.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[U.progress,"%"]})]})})()]})},U.id):jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ne},className:d("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?.(U),onDoubleClick:()=>a.onTaskDoubleClick?.(U),onContextMenu:R=>X(R,U),children:[he.map(R=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:yt[R.id],minWidth:R.minWidth},children:R.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[x&&U.level>0&&jsxRuntime.jsx("div",{style:{width:`${U.level*24}px`},className:"flex-shrink-0"}),x&&U.hasChildren&&jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),je(U.id);},className:d("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Qe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",E?"text-white/60":"text-gray-400")})}),x&&!U.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(U.wbsCode||U.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[U.wbsCode&&jsxRuntime.jsx("span",{className:d("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:U.wbsCode}),U.taskCode&&jsxRuntime.jsx("span",{className:d("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:U.taskCode})]}),jsxRuntime.jsx("span",{className:d("truncate font-bold text-[13px]",E?"text-white":"text-gray-900",U.progress===100&&(E?"line-through text-white/30":"line-through text-gray-400")),children:U.name}),U.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${U.tags[0].color}20`,color:U.tags[0].color},children:U.tags[0].name})]})]}):Nt(U,R)},R.id)),p&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},U.id)})}),_e.length===0&&D&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:d("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:d(E?"text-white/60":"text-gray-600"),children:w.empty.noResults})]})})]})}),S?.enabled&&S.data&&jsxRuntime.jsx(Rp,{data:S.data,isDark:E,locale:l})]}),jsxRuntime.jsx(yp,{state:Ze,onClose:Me,isDark:E,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:O,onColumnSort:ne,availableUsers:c,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(Fp,{isOpen:Re,onClose:()=>ke(false),onSave:tt,isDark:E,locale:l})]})}var Gp=[{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:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",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}],Vp=[{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"}],_p=[{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 dd={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:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},cd={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:"#2563EB"},ud={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:dd,light:cd,neutral:ud};function jp(e){return oi[e]||oi.dark}var md={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"}},pd={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"}},ni={en:md,es:pd};function zn(e){return ni[e]||ni.en}function si(e,t){let a=zn(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 Kp(e){let t=zn(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 Yp(e,t=0,a=true){let r=zn(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 Vn(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 bd(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 Zp({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:d("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var eg=26,H2=22,U2=10;function Qp(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 hd(e){if(!e||e<=0)return null;let t=Math.round(e/480);return t>0?`${t}d`:null}function tg(e){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let t=e.soldEffortMinutes-e.effortMinutes;if(t===0)return null;let a=Math.round(Math.abs(t)/60),r=t<0,o=a>=1e3?`$${(a/1e3).toFixed(1)}k`:`$${a}`;return {text:`${r?"-":"+"}${o}`,isNegative:r}}function z2({segment:e,isDark:t,onClick:a,blurFinancials:r,t:o}){let{task:s,spanCols:n,lane:c,isStart:u,isEnd:i}=e,m=s.progress===100||s.status==="completed",l=s.isCriticalPath,g=u&&i?"rounded":u?"rounded-l":i?"rounded-r":"",f=i?hd(s.effortMinutes):null,x=i?tg(s):null,k=i?s.blockers?.find(p=>p.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),a();},whileHover:{scale:1.005},className:d("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",g,m?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":l?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:`${c*eg}px`,left:"1px",width:`calc(${n*100}% - 2px)`,height:`${H2}px`,zIndex:10,...t?m?{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)"}:l?{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:u?"3px":void 0,borderLeftColor:u?l?"#EF4444":m?"#10B981":"#1264FF":void 0},children:[l&&u&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[o.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:s.name}),i&&(f||x)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[f&&jsxRuntime.jsxs("span",{children:[o.labels.estimate,": ",f]}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:d(x.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:x.text})]})]}),k&&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:[o.labels.blocker,": ",k.type]}),s.progress>0&&s.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${s.progress}%`}})]})}function ag({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:c,availableTags:u=[],onCreateTag:i,attachmentsByTask:m,comments:l,onAddComment:g,currentUser:f,mentionableUsers:x,onUploadCommentAttachments:k,onTaskOpen:p,enableTimeTracking:v,timeTrackingSummary:b,timeEntries:h,timerState:y,onLogTime:C,onUpdateEstimate:N,onUpdateSoldEffort:S,onStartTimer:w,onStopTimer:E,onDiscardTimer:L,blurFinancials:T=false,suppressDetailModal:z=false}){let{theme:H="dark",locale:J="en",customTranslations:D,showBacklog:ve=true}=t,de=si(J,D),V=H==="dark"||H==="neutral",[I,Te]=react.useState(r||new Date),[Q,et]=react.useState(null),[$,ae]=react.useState(null),[Re,ke]=react.useState({}),Ze=3,Ee=3,ze=react.useCallback(R=>{z||et(R),p?.(R.id);},[z,p]),[re,K]=react.useState(null),[q,be]=react.useState(""),[we,Je]=react.useState(void 0),[G,he]=react.useState(null),[je,Ie]=react.useState(false),[Ke,O]=react.useState(false),[ne,X]=react.useState(null),[Me,Ve]=react.useState(false),[tt,rt]=react.useState(new Date),_e=react.useCallback(()=>{Te(new Date(I.getFullYear(),I.getMonth()-1,1));},[I]),Nt=react.useCallback(()=>{Te(new Date(I.getFullYear(),I.getMonth()+1,1));},[I]),ht=react.useCallback(()=>{Te(new Date);},[]),xt=react.useMemo(()=>{let R=I.getFullYear(),j=I.getMonth(),Be=new Date(R,j,1),De=new Date(R,j+1,0),fe=Be.getDay(),Ce=De.getDate(),ee=Vn(e),B=new Date;B.setHours(0,0,0,0);let _=[],Pe=fe,A=new Date(R,j,0).getDate();for(let ce=Pe-1;ce>=0;ce--){let He=new Date(R,j-1,A-ce);_.push({date:He,isCurrentMonth:false,isToday:false,isWeekend:He.getDay()===0||He.getDay()===6,events:ee.filter(ue=>bd(He,ue)).map(ue=>({id:ue.id,title:ue.name,start:ue.startDate,end:ue.endDate,task:ue}))});}for(let ce=1;ce<=Ce;ce++){let He=new Date(R,j,ce),ue=He.getTime()===B.getTime();_.push({date:He,isCurrentMonth:true,isToday:ue,isWeekend:He.getDay()===0||He.getDay()===6,events:ee.filter(it=>bd(He,it)).map(it=>({id:it.id,title:it.name,start:it.startDate,end:it.endDate,task:it}))});}let Z=42-_.length;for(let ce=1;ce<=Z;ce++){let He=new Date(R,j+1,ce);_.push({date:He,isCurrentMonth:false,isToday:false,isWeekend:He.getDay()===0||He.getDay()===6,events:ee.filter(ue=>bd(He,ue)).map(ue=>({id:ue.id,title:ue.name,start:ue.startDate,end:ue.endDate,task:ue}))});}return _},[I,e]),yt=react.useMemo(()=>Vn(e).filter(R=>!R.startDate||!R.endDate),[e]),U=react.useMemo(()=>{let R=Vn(e),j=0,Be=0,De=0,fe=0,Ce=0;R.forEach(A=>{A.effortMinutes&&(j+=A.effortMinutes),A.soldEffortMinutes&&(Be+=A.soldEffortMinutes),A.scheduleVariance!=null&&(De+=A.scheduleVariance,fe++),A.soldEffortMinutes&&A.effortMinutes&&(Ce+=A.soldEffortMinutes-A.effortMinutes);});let ee=Be>0?Math.min(100,Math.round(j/Be*100)):0,B=fe>0?Math.round(De/fe):0,_=Math.round(Ce/60),Pe=Math.abs(_)>=1e3?`${_<0?"-":"+"}$${(Math.abs(_)/1e3).toFixed(1)}k`:`${_<0?"-":"+"}$${Math.abs(_)}`;return {budgetUtil:ee,avgVariance:B,costDisplay:Pe,hasCostData:Be>0}},[e]),Oe=react.useMemo(()=>{let R=[0,0,0,0,0,0];return xt.forEach((j,Be)=>{let De=Math.floor(Be/7);j.events.forEach(fe=>{if(fe.task.startDate&&fe.task.soldEffortMinutes){let Ce=new Date(fe.task.startDate),ee=j.date;Ce.getFullYear()===ee.getFullYear()&&Ce.getMonth()===ee.getMonth()&&Ce.getDate()===ee.getDate()&&De<R.length&&(R[De]-=fe.task.soldEffortMinutes);}});}),R},[xt]),Qe=react.useMemo(()=>{let R=Vn(e),j=new Map,Be=new Set,De=[0,0,0,0,0,0];if(xt.length===0)return {segmentsByCell:j,multiDayTaskIds:Be,maxLanesPerRow:De};let fe=Pe=>new Date(Pe.getFullYear(),Pe.getMonth(),Pe.getDate()),Ce=fe(xt[0].date),ee=fe(xt[xt.length-1].date),B=[];for(let Pe of R){if(!Pe.startDate||!Pe.endDate)continue;let A=fe(Pe.startDate),Z=fe(Pe.endDate);if(A.getTime()===Z.getTime()||Z<Ce||A>ee)continue;let ce=A<Ce?Ce:A,He=Z>ee?ee:Z,ue=Qp(ce,Ce),it=Qp(He,Ce);ue<0||ue>41||it<0||it>41||ue!==it&&(Be.add(Pe.id),B.push({task:Pe,startIdx:ue,endIdx:it}));}B.sort((Pe,A)=>Pe.startIdx!==A.startIdx?Pe.startIdx-A.startIdx:A.endIdx-A.startIdx-(Pe.endIdx-Pe.startIdx));let _=[[],[],[],[],[],[]];for(let{task:Pe,startIdx:A,endIdx:Z}of B){let ce=Math.floor(A/7),He=Math.floor(Z/7),ue=fe(Pe.startDate),it=fe(Pe.endDate),dt=false;for(let Dt=ce;Dt<=He;Dt++){let Ft=Dt===ce?A%7:0,Kt=Dt===He?Z%7:6,nr=Kt-Ft+1,La=0,Fe=_[Dt]??[];for(_[Dt]||(_[Dt]=Fe);La<Fe.length&&(Fe[La]??-1)>=Ft;)La++;if(La>=U2){dt=true;break}La>=Fe.length?Fe.push(Kt):Fe[La]=Kt,De[Dt]=Math.max(De[Dt]??0,La+1);let St=Dt===ce&&ue>=Ce,sa=Dt===He&&it<=ee,ma=Dt*7+Ft,P={taskId:Pe.id,task:Pe,rowIndex:Dt,startCol:Ft,endCol:Kt,spanCols:nr,lane:La,isStart:St,isEnd:sa};j.has(ma)||j.set(ma,[]),j.get(ma).push(P);}dt&&(Be.delete(Pe.id),j.forEach((Dt,Ft)=>{let Kt=Dt.filter(nr=>nr.taskId!==Pe.id);Kt.length===0?j.delete(Ft):j.set(Ft,Kt);}));}return {segmentsByCell:j,multiDayTaskIds:Be,maxLanesPerRow:De}},[xt,e]),Ne=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$e=I.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),me=$e.charAt(0).toUpperCase()+$e.slice(1);return o?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:c,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:d("text-sm font-mono",V?"text-white/30":"text-gray-600"),children:[de.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:d("w-12 h-12 rounded-full flex items-center justify-center",V?"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:d("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",V?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:d("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",V?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:d("w-8 h-8",V?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:de.labels.noEvents}),jsxRuntime.jsx("p",{className:d("text-sm",V?"text-white/30":"text-gray-600"),children:de.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:d("flex-1 flex flex-col w-full h-full overflow-hidden",V?"bg-[#050505]":"bg-white",n),style:c,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:d("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",V?"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:d("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",V?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:d("w-3.5 h-3.5",V?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:d("font-medium",V?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:d("h-4 w-px",V?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:_e,className:d("w-6 h-6 flex items-center justify-center rounded transition-colors",V?"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:d("text-sm font-semibold tracking-tight min-w-[150px] text-center",V?"text-white":"text-gray-900"),children:me}),jsxRuntime.jsx("button",{onClick:Nt,className:d("w-6 h-6 flex items-center justify-center rounded transition-colors",V?"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.jsx("div",{className:"flex items-center gap-3 shrink-0",children:jsxRuntime.jsx("button",{onClick:ht,className:d("px-2.5 py-1 text-xs rounded-md transition-all font-medium",V?"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:de.navigation.today})})]}),jsxRuntime.jsx("div",{className:d("grid grid-cols-7 sticky top-0 z-10",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Ne.map(R=>jsxRuntime.jsx("div",{className:d("py-2 text-center text-[10px] font-bold uppercase tracking-widest",V?"text-white/60 font-mono":"text-gray-500"),children:R},R))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:d("grid grid-cols-7 min-h-[800px]",V?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},children:xt.map((R,j)=>{let Be=j%7===6,De=j>=35;return jsxRuntime.jsxs("div",{className:d("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Be&&(V?"border-r border-[#222]":"border-r border-gray-200"),!De&&(V?"border-b border-[#222]":"border-b border-gray-200"),V?R.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":R.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",R.isToday&&V&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",R.isToday&&!V&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:d("text-xs font-mono select-none relative z-20",R.isToday?V?"text-[#007FFF] font-bold":"text-blue-600 font-bold":R.isCurrentMonth?V?"text-white/60":"text-gray-900":V?"text-white/20":"text-gray-400"),children:String(R.date.getDate()).padStart(2,"0")}),(()=>{let fe=Math.floor(j/7),Ce=(Qe.maxLanesPerRow[fe]??0)*eg,ee=Qe.segmentsByCell.get(j);return Ce===0&&!ee?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ce}px`,zIndex:5},children:ee?.map(B=>jsxRuntime.jsx(z2,{segment:B,isDark:V,blurFinancials:T,t:de,onClick:()=>{ze(B.task),a.onEventClick?.({id:B.task.id,title:B.task.name,start:B.task.startDate,end:B.task.endDate,task:B.task});}},B.taskId))})})(),(()=>{let fe=R.events.filter(Ce=>Ce.task.isMilestone&&!Qe.multiDayTaskIds.has(Ce.id));return fe.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[fe.slice(0,4).map(Ce=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ce.title,onClick:ee=>{ee.stopPropagation(),ze(Ce.task);}},Ce.id)),fe.length>4&&jsxRuntime.jsxs("span",{className:d("text-[8px] font-mono",V?"text-white/30":"text-gray-400"),children:["+",fe.length-4]})]})})(),(()=>{let fe=[];R.events.forEach(ee=>{ee.task.blockers?.forEach(B=>{(B.severity==="warning"||B.severity==="critical")&&fe.push({taskId:ee.id,type:B.type,severity:B.severity,variance:ee.task.scheduleVariance});});});let Ce=fe[0];return Ce?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:d("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ce.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:[de.labels.risk,": ",Ce.type,Ce.variance?` (+${Math.abs(Ce.variance)}d ${de.labels.delay})`:""]})]})}):null})(),(()=>{let fe=R.events.filter(_=>!Qe.multiDayTaskIds.has(_.id)),Ce=Re[j]||Ze,ee=fe.slice(0,Ce),B=fe.length-Ce;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[ee.map(_=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{ze(_.task),a.onEventClick?.(_);},whileHover:{scale:1.01},className:d("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",_.task.progress===100||_.task.status==="completed"?V?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":V?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:V?_.task.progress===100||_.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)"}:_.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:d("flex-shrink-0 text-[9px]",_.task.isMilestone?V?"text-amber-400":"text-amber-600":_.task.isCriticalPath?"text-red-400":V?"text-[#1264FF]":"text-gray-400"),children:_.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:_.title})]},_.id)),B>0&&jsxRuntime.jsxs("button",{onClick:_=>{_.stopPropagation(),ke(Pe=>({...Pe,[j]:Ce+Ee}));},className:d("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",V?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",B," ",J==="es"?"m\xE1s":"more"]}),Ce>Ze&&fe.length>Ze&&jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),ke(Pe=>({...Pe,[j]:Ze}));},className:d("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",V?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),R.isCurrentMonth&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let fe=j>=28,Ce=j%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ee=>{ee.stopPropagation(),re===j?K(null):(K(j),be(""),Je(void 0),he(null),X(null),Ie(false),O(false),Ve(false),rt(R.date));},className:d("w-5 h-5 rounded flex items-center justify-center transition-all",re===j?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",V?"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:d("w-3.5 h-3.5 transition-transform",re===j&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re===j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{K(null),be(""),Je(void 0),he(null),X(null),Ie(false),O(false),Ve(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:fe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:fe?-5:5,scale:.95},transition:{duration:.12},className:d("absolute w-[320px] rounded-lg shadow-2xl z-50",fe?"bottom-full mb-1":"top-full mt-1",Ce?"right-0":"left-0",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"),onClick:ee=>{ee.stopPropagation(),Ie(false),O(false),Ve(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:q,onChange:ee=>be(ee.target.value),placeholder:J==="es"?"Nombre de la tarea...":"Task name...",className:d("w-full bg-transparent text-sm outline-none font-mono",V?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ee=>{if(ee.key==="Enter"&&q.trim()){let B=t.availableUsers?.find(Pe=>Pe.id===G),_=ne||R.date;a.onTaskCreate?.({name:q.trim(),startDate:_,endDate:_,priority:we,assignees:B?[B]:void 0}),be(""),Je(void 0),he(null),X(null),K(null);}ee.key==="Escape"&&(K(null),be(""),Je(void 0),he(null),X(null));}})}),jsxRuntime.jsxs("div",{className:d("px-2.5 py-2 flex items-center justify-between border-t",V?"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:ee=>{ee.stopPropagation(),Ie(!je),O(false);},className:d("p-1 rounded transition-colors",we?we==="urgent"||we==="high"?"text-red-400 bg-red-500/20":we==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":V?"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:je&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",V?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:ee=>ee.stopPropagation(),children:[{id:"urgent",label:J==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:J==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:J==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:J==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:J==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ee=>jsxRuntime.jsxs("button",{onClick:()=>{Je(ee.id),Ie(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",V?"hover:bg-white/5":"hover:bg-gray-50",we===ee.id&&(V?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",ee.color)}),jsxRuntime.jsx("span",{className:V?"text-white":"text-gray-900",children:ee.label})]},ee.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ee=>{ee.stopPropagation(),Ve(!Me),Ie(false),O(false),rt(ne||R.date);},className:d("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",ne?V?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":V?"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"}),(ne||R.date).toLocaleDateString(J==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",V?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:ee=>ee.stopPropagation(),children:[jsxRuntime.jsx("div",{className:d("w-40 py-2 border-r",V?"border-white/10":"border-gray-200"),children:(()=>{let ee=new Date,B=new Date(ee);B.setDate(ee.getDate()+1);let _=new Date(ee);_.setDate(ee.getDate()+((6-ee.getDay()+7)%7||7));let Pe=new Date(ee);Pe.setDate(ee.getDate()+((1-ee.getDay()+7)%7||7));let A=new Date(ee);A.setDate(ee.getDate()+14);let Z=new Date(ee);return Z.setDate(ee.getDate()+28),[{label:J==="es"?"Hoy":"Today",date:ee,display:ee.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:J==="es"?"Ma\xF1ana":"Tomorrow",date:B,display:B.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:J==="es"?"Este fin de semana":"This weekend",date:_,display:J==="es"?"s\xE1b.":"sat."},{label:J==="es"?"Pr\xF3xima semana":"Next week",date:Pe,display:J==="es"?"lun.":"mon."},{label:J==="es"?"2 semanas":"2 weeks",date:A,display:A.toLocaleDateString(J==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:J==="es"?"4 semanas":"4 weeks",date:Z,display:Z.toLocaleDateString(J==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((He,ue)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",V?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{X(He.date),Ve(false);},children:[jsxRuntime.jsx("span",{children:He.label}),jsxRuntime.jsx("span",{className:d("text-[10px] font-mono",V?"text-white/30":"text-gray-400"),children:He.display})]},ue))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:d("text-xs font-medium font-mono",V?"text-white":"text-gray-900"),children:tt.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>rt(new Date),className:d("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",V?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:J==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>rt(new Date(tt.getFullYear(),tt.getMonth()-1)),className:d("p-0.5 rounded",V?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>rt(new Date(tt.getFullYear(),tt.getMonth()+1)),className:d("p-0.5 rounded",V?"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:(J==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ee=>jsxRuntime.jsx("div",{className:d("w-6 h-6 flex items-center justify-center text-[10px] font-mono",V?"text-white/30":"text-gray-400"),children:ee},ee))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ee=tt.getFullYear(),B=tt.getMonth(),_=new Date(ee,B,1).getDay(),Pe=new Date(ee,B+1,0).getDate(),A=new Date(ee,B,0).getDate(),Z=new Date,ce=[];for(let ue=_-1;ue>=0;ue--)ce.push({dayNum:A-ue,isCurrentMonth:false,date:new Date(ee,B-1,A-ue)});for(let ue=1;ue<=Pe;ue++)ce.push({dayNum:ue,isCurrentMonth:true,date:new Date(ee,B,ue)});let He=42-ce.length;for(let ue=1;ue<=He;ue++)ce.push({dayNum:ue,isCurrentMonth:false,date:new Date(ee,B+1,ue)});return ce.map((ue,it)=>{let dt=ue.date.toDateString()===Z.toDateString(),Dt=(ne||R.date).toDateString()===ue.date.toDateString();return jsxRuntime.jsx("button",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ue.isCurrentMonth&&(V?"text-white/20":"text-gray-300"),ue.isCurrentMonth&&(V?"text-white":"text-gray-900"),dt&&"ring-1 ring-[#007FFF]",Dt&&"bg-[#007FFF] text-white",!Dt&&(V?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{X(ue.date),Ve(false);},children:ue.dayNum},it)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ee=>{ee.stopPropagation(),O(!Ke),Ie(false);},className:d("p-1 rounded transition-colors",G?"text-[#007FFF] bg-[#007FFF]/20":V?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:G?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:t.availableUsers?.find(ee=>ee.id===G)?.color||"#007FFF"},children:t.availableUsers?.find(ee=>ee.id===G)?.initials||t.availableUsers?.find(ee=>ee.id===G)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ke&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",V?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:ee=>ee.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{he(null),O(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",V?"hover:bg-white/5":"hover:bg-gray-50",!G&&(V?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded-full flex items-center justify-center",V?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:V?"text-white/40":"text-gray-500",children:J==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ee=>jsxRuntime.jsxs("button",{onClick:()=>{he(ee.id),O(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",V?"hover:bg-white/5":"hover:bg-gray-50",G===ee.id&&(V?"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:ee.color||"#007FFF"},children:ee.initials||ee.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:V?"text-white":"text-gray-900",children:ee.name})]},ee.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:d("px-3 py-2 text-xs font-mono",V?"text-white/30":"text-gray-400"),children:J==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(q.trim()){let ee=t.availableUsers?.find(_=>_.id===G),B=ne||R.date;a.onTaskCreate?.({name:q.trim(),startDate:B,endDate:B,priority:we,assignees:ee?[ee]:void 0}),be(""),Je(void 0),he(null),X(null),K(null);}},disabled:!q.trim(),className:d("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",q.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":V?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:J==="es"?"Guardar":"Save"})]})]})]})})]})})()}),j%7===6&&(()=>{let fe=Math.floor(j/7),Ce=Oe[fe];if(!Ce||Ce===0)return null;let ee=Math.round(Math.abs(Ce)/60),B=ee>=1e3?`$${(ee/1e3).toFixed(1)}k`:`$${ee}`;return jsxRuntime.jsxs("div",{className:d("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ce<0?"text-red-400":"text-emerald-400",T&&"blur-sm select-none"),children:[de.labels.cashOut,": ",Ce<0?"-":"+",B]})})()]},j)})})})]}),ve&&jsxRuntime.jsxs("aside",{className:d("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",V?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:d("flex-shrink-0 h-14 flex items-center justify-between px-4",V?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:d("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:de.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:d("text-[10px] font-mono tabular-nums",V?"text-white/20":"text-gray-400"),children:yt.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:yt.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded-xl flex items-center justify-center mb-3",V?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:d("w-5 h-5",V?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:d("text-xs font-mono",V?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):yt.map(R=>jsxRuntime.jsxs("button",{onClick:()=>{ze(R);},className:d("w-full text-left rounded-md p-3 transition-all group/card",V?"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:d("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",V?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:d("text-sm font-medium leading-snug line-clamp-2",V?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:R.name})]}),R.tags&&R.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[R.tags.slice(0,3).map(j=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${j.color}15`,color:j.color,border:`1px solid ${j.color}30`},children:j.name},j.id)),R.tags.length>3&&jsxRuntime.jsxs("span",{className:d("text-[9px] font-mono px-1 py-0.5",V?"text-white/20":"text-gray-400"),children:["+",R.tags.length-3]})]}),(R.effortMinutes||R.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:d("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",V?"text-white/25":"text-gray-400",T&&"blur-sm select-none"),children:[hd(R.effortMinutes)&&jsxRuntime.jsxs("span",{children:[de.labels.estimate,": ",hd(R.effortMinutes)]}),(()=>{let j=tg(R);return j?jsxRuntime.jsx("span",{className:j.isNegative?"text-red-400":"text-emerald-400",children:j.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:[R.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:d("w-3 h-3",R.priority==="urgent"||R.priority==="high"?"text-red-400":R.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(Zp,{task:R,isDark:V})]}),R.assignees&&R.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:R.assignees.slice(0,2).map((j,Be)=>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:j.color||"#007FFF"},title:j.name,children:j.initials||j.name?.slice(0,2).toUpperCase()},Be))})]})]},R.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:d("flex-shrink-0 px-3 py-2.5 border-t",V?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:de.labels.typeToAdd,className:d("w-full text-[11px] font-mono bg-transparent outline-none",V?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:R=>{R.key==="Enter"&&R.target.value.trim()&&(a.onTaskCreate?.({name:R.target.value.trim()}),R.target.value="");}})}),U.hasCostData&&jsxRuntime.jsxs("div",{className:d("flex-shrink-0 px-4 py-3 border-t space-y-2.5",V?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:d("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:["\u25C8 ",de.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:d("text-[10px] font-mono",V?"text-white/40":"text-gray-500"),children:de.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:d("text-[10px] font-mono font-bold tabular-nums",V?"text-white/60":"text-gray-700",T&&"blur-sm select-none"),children:[U.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:d("h-1.5 rounded-full overflow-hidden",V?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${U.budgetUtil}%`,background:U.budgetUtil>90?"#EF4444":U.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #3B82F6, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:d("rounded-md px-2 py-1.5 text-center",V?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:de.labels.variance}),jsxRuntime.jsxs("div",{className:d("text-[11px] font-mono font-bold tabular-nums",U.avgVariance>0?"text-emerald-400":U.avgVariance<0?"text-red-400":V?"text-white/50":"text-gray-600"),children:[U.avgVariance>0?"+":"",U.avgVariance," ",de.labels.days]})]}),jsxRuntime.jsxs("div",{className:d("rounded-md px-2 py-1.5 text-center",V?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:de.labels.cost}),jsxRuntime.jsx("div",{className:d("text-[11px] font-mono font-bold tabular-nums",U.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",T&&"blur-sm select-none"),children:U.costDisplay})]})]})]})]})]}),!z&&jsxRuntime.jsx(zr,{task:Q,isOpen:!!Q,onClose:()=>et(null),onTaskUpdate:R=>{a.onTaskUpdate?.(R),et(R);},theme:H==="dark"?"dark":"light",locale:J,availableUsers:t.availableUsers?.map(R=>({id:R.id,name:R.name,avatar:R.avatar,initials:R.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:u,onCreateTag:i,attachments:Q?m?.get(Q.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Vn(e).filter(R=>R.id!==Q?.id),comments:l?.filter(R=>R.taskId===Q?.id).map(R=>({...R,createdAt:R.createdAt instanceof Date?R.createdAt:new Date(R.createdAt),updatedAt:R.updatedAt instanceof Date?R.updatedAt:R.updatedAt?new Date(R.updatedAt):void 0})),onAddComment:g,currentUser:f,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:v,timeTrackingSummary:b,timeEntries:h,isTimerRunning:y?.isRunning,timerElapsedSeconds:y?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:S,onTimerStart:w,onTimerStop:E,onTimerDiscard:L,blurFinancials:T}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ae(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:d("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",V?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:d("px-4 py-3 border-b flex items-center justify-between",V?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:d("font-medium text-sm",V?"text-white/90":"text-gray-900"),children:$.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>ae(null),className:d("p-1 rounded",V?"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:$.events.map(R=>jsxRuntime.jsxs("button",{onClick:()=>{ae(null),ze(R.task);},className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",V?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(Zp,{task:R.task,isDark:V}),jsxRuntime.jsx("span",{className:d("text-sm truncate flex-1",V?"text-white/80":"text-gray-900"),children:R.title}),(R.task.priority==="high"||R.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},R.id))})]})]})})]})}var xd={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)"},vd={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)"},kd={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)"},li={dark:xd,light:vd,neutral:kd};function rg(e){return li[e]||li.dark}function G2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:c}){let[u,i]=react.useState(false),m=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),l=react.useMemo(()=>{let f=m.length,x=new Set(m.flatMap(v=>v.assignedUserIds||[])).size,k=m.map(v=>v.priority).filter(Boolean),p=new Set(m.flatMap(v=>v.labels||[])).size;return {totalCards:f,uniqueAssignees:x,priorities:k,labels:p}},[m]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:d("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:g,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:d("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:l.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"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.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:[l.uniqueAssignees," assignees"]})]}),l.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:[l.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:m.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:m.map(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var ng={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function _n(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 jn(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 sg(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 ig({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:c}){let u=react.useMemo(()=>({...ng,...n}),[n]),[i,m]=react.useState(new Set),l=react.useRef(null),g=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(h=>{let y=h.timestamp.toISOString().split("T")[0],C=b.get(y);C?C.push(h):b.set(y,[h]);}),Array.from(b.entries()).sort((h,y)=>y[0].localeCompare(h[0])).map(([h,y])=>({date:new Date(h),events:y.sort((C,N)=>N.timestamp.getTime()-C.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:f,uniqueTypes:x}=react.useMemo(()=>{let b=new Set,h=new Set;return e.forEach(y=>{b.add(y.userId),h.add(y.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(h)}},[e]),k=b=>{m(h=>{let y=new Set(h);return y.has(b)?y.delete(b):y.add(b),y});},p=b=>{let y=new Date().getTime()-b.getTime(),C=Math.floor(y/6e4),N=Math.floor(y/36e5),S=Math.floor(y/864e5);return C<1?"just now":C<60?`${C}m ago`:N<24?`${N}h ago`:S<7?`${S}d ago`:b.toLocaleDateString()},v=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:d("history-timeline-empty",c),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:d("history-timeline",u.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let h=b.target.value;a({...t,types:h?[h]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(b=>jsxRuntime.jsxs("option",{value:b,children:[jn(b)," ",b.replace("_"," ")]},b))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let h=b.target.value;a({...t,users:h?[h]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:g.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((h,y)=>{let C=i.has(h.id),N=s===h.id,S=sg(h.type);return jsxRuntime.jsxs("div",{"data-event-id":h.id,className:d("history-timeline-event",C&&"expanded",N&&"selected"),onClick:()=>o?.(h),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:S},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:jn(h.type)})}),y<b.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:[u.showAvatars&&h.userAvatar&&jsxRuntime.jsx("img",{src:h.userAvatar,alt:h.userName||h.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:h.userName||h.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:_n(h)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?p(h.timestamp):h.timestamp.toLocaleString()})]}),Object.keys(h.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),k(h.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(h.changes).map(([w,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},w)),h.metadata&&Object.keys(h.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(h.metadata).map(([w,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},w))]})]})]})]},h.id)})})]},b.date?.toISOString()||"all"))})]})}function dg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:c,onSpeedChange:u,className:i}){let m=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:d("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:d("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&jn(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&_n(l)}),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:l&&l.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:f=>c(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,x)=>jsxRuntime.jsx("div",{className:d("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>c(x),title:_n(f)},f.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:m.map(f=>jsxRuntime.jsxs("button",{className:d("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>u(f),children:[f,"x"]},f))})]}),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:l&&l.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(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:d("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function wd(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 Cd(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 cg(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 ug(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function q2(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(m=>{let l=a/2,g=r/2;m.vx+=(l-m.x)*o.centerForce*i,m.vy+=(g-m.y)*o.centerForce*i,n.forEach(f=>{if(m.id===f.id)return;let x=m.x-f.x,k=m.y-f.y,p=Math.sqrt(x*x+k*k)||1,v=o.chargeStrength*i/(p*p);m.vx+=x/p*v,m.vy+=k/p*v;});}),t.forEach(m=>{let l=c.get(typeof m.source=="string"?m.source:m.source.id),g=c.get(typeof m.target=="string"?m.target:m.target.id);if(!l||!g)return;let f=g.x-l.x,x=g.y-l.y,k=Math.sqrt(f*f+x*x)||1,p=(k-o.linkDistance)/k*o.forceStrength*i;l.vx+=f*p,l.vy+=x*p,g.vx-=f*p,g.vy-=x*p;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function mg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:c,className:u}){let i=react.useRef(null),[m,l]=react.useState([]),[g,f]=react.useState(null),[x,k]=react.useState(null),[p,v]=react.useState(null),[b,h]=react.useState(1),[y,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let H=q2(e,t,a.width,a.height,a,150);l(H);},[e,t,a]);let N=react.useCallback((H,J)=>{a.enableDragging&&(J.stopPropagation(),f(H));},[a.enableDragging]),S=react.useCallback(H=>{if(!g||!i.current)return;let D=i.current.getBoundingClientRect(),ve=(H.clientX-D.left-y.x)/b,de=(H.clientY-D.top-y.y)/b;l(V=>V.map(I=>I.id===g?{...I,x:ve,y:de,fx:ve,fy:de}:I));},[g,b,y]),w=react.useCallback(()=>{f(null);},[]),E=react.useCallback((H,J)=>{J.stopPropagation(),c?.({type:"node-click",node:H,position:{x:J.clientX,y:J.clientY}});},[c]),L=react.useCallback((H,J)=>{J.stopPropagation(),c?.({type:"edge-click",edge:H,position:{x:J.clientX,y:J.clientY}});},[c]),T=react.useCallback(H=>{let J=m.find(D=>D.id===H);return J?{x:J.x,y:J.y}:{x:0,y:0}},[m]),z=react.useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let J=H.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:d("relationships-graph-empty",u),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:d("relationships-graph",u),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:()=>h(H=>Math.min(H+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>h(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{h(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:wd(H)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[cg(H)," ",Cd(H)]})]},H))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:S,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let J=T(typeof H.source=="string"?H.source:H.source.id),D=T(typeof H.target=="string"?H.target:H.target.id),ve=ug(H.type),de=p===H.id,V=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-edge",de&&"hovered",V&&"critical"),onMouseEnter:()=>v(H.id),onMouseLeave:()=>v(null),onClick:I=>L(H,I),children:[jsxRuntime.jsx("line",{x1:J.x,y1:J.y,x2:D.x,y2:D.y,stroke:wd(H.type),strokeWidth:V?a.edgeWidth*2:a.edgeWidth,strokeOpacity:de?1:.6,markerEnd:ve?"url(#arrowhead)":void 0}),a.showEdgeLabels&&de&&jsxRuntime.jsx("text",{x:(J.x+D.x)/2,y:(J.y+D.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Cd(H.type)})]},H.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(H=>{let J=x===H.id,D=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-node",J&&"hovered",D&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:ve=>N(H.id,ve),onMouseEnter:()=>k(H.id),onMouseLeave:()=>k(null),onClick:ve=>E(H,ve),children:[jsxRuntime.jsx("circle",{r:D?a.nodeSize*1.2:a.nodeSize,fill:z(H),stroke:D?"#fbbf24":"#ffffff",strokeWidth:D?3:2,opacity:J?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.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 fg({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[c,u]=react.useState(false),[i,m]=react.useState(null),[l,g]=react.useState(null),f=react.useRef(null),x=c||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&!x&&k();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,x]);let k=()=>{x||(n(""),m(null),g(null),t());},p=async()=>{if(!(!s.trim()||x)){u(true),m(null),g(null);try{let b=await r(s.trim());g(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{u(false);}}},v=()=>{l&&(a(l),k());};return e?jsxRuntime.jsxs(Pt,{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-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:k,disabled:x,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:l?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!"})]}),l.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:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,h)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},h))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,h)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},h)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.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:f,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,h)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},h))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&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:x,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"}),l?jsxRuntime.jsx("button",{onClick:v,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:p,disabled:!s.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Td={"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 J2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Z2={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 Q2(e,t,a){let r=Td[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Kn(e){return `$${e.toFixed(4)}`}var Nd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Q2(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(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,g)=>l+g.cost,0),s=a.reduce((l,g)=>l+g.inputTokens,0),n=a.reduce((l,g)=>l+g.outputTokens,0),c=a.filter(l=>l.success),u=a.reduce((l,g)=>l+g.duration,0),i={},m={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,m[l.feature]=(m[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:m,averageDuration:r>0?u/r:0,successRate:r>0?c.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 c=this.operations.filter(m=>m.timestamp>=n).length,u=Math.max(0,o-c),i=c/o*100;return {used:c,limit:o,remaining:u,percentUsed:i,isExceeded:c>=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)}},Bo=new Nd;function yg({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Bo.getStats()),[s,n]=react.useState(Bo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(Bo.getStats()),n(Bo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),react.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let c=Bo.getRecentOperations(5);return jsxRuntime.jsxs(Pt,{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:u=>u.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:Kn(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(([u,i])=>{let m=r.costsByFeature[u]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Kn(m)})]})]}),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:`${l}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.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:c.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Kn(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 kg({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,c]=react.useState(""),[u,i]=react.useState(""),[m,l]=react.useState(""),[g,f]=react.useState(false),[x,k]=react.useState(null),[p,v]=react.useState(null),[b,h]=react.useState(null),y=react.useRef(null),C=g||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let L=T=>{T.key==="Escape"&&!C&&N();};if(e)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,C]);let N=()=>{C||(c(""),i(""),l(""),k(null),v(null),h(null),t());},S=async()=>{if(!(!n.trim()||C)){f(true),k(null),v(null),h(null);try{let L=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:m||void 0});v(L.tasks.tasks),h({from_cache:L.from_cache,tokens_used:L.tokens_used,mock_mode:L.mock_mode,similarity:L.similarity,tokens_saved:L.tokens_saved});}catch(L){k(L instanceof Error?L.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{p&&(a(p),N());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Pt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:N,disabled: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:p?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[p.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:p.map((L,T)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",T+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:L.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"})]}),L.start," \u2192 ",L.end]}),jsxRuntime.jsxs("span",{children:[L.duration," days"]}),L.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",L.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${L.priority==="high"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:L.priority})]})},L.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:y,value:n,onChange:L=>c(L.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:u,onChange:L=>i(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:m,onChange:L=>l(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})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),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((L,T)=>jsxRuntime.jsx("button",{onClick:()=>c(L),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:L},T))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled: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"}),p?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:S,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, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function ui({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(p=>{t&&as(()=>Promise.resolve(t(p)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,b,h)=>{console.warn(`Retry attempt ${b} after ${h}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(p,v,b)=>{r(h=>{let y=h.cards.find(L=>L.id===p);if(!y)return h;let C=y.columnId,N={...y,columnId:v,position:b},S=h.cards.map(L=>L.id===p?N:L),w=h.columns.map(L=>{if(L.id===C)return {...L,cardIds:L.cardIds.filter(T=>T!==p)};if(L.id===v){let T=S.filter(z=>z.columnId===v).sort((z,H)=>z.position-H.position);return {...L,cardIds:T.map(z=>z.id)}}return L}),E={...h,cards:S,columns:w};return o(E),E});},[o]),n=react.useCallback(async(p,v)=>{r(b=>{let h=b.cards.map(C=>C.id===p?{...C,...v}:C),y={...b,cards:h};return o(y),y});},[o]),c=react.useCallback(async p=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let h={...p,id:v},y=b.columns.map(N=>N.id===p.columnId?{...N,cardIds:[...N.cardIds,v]}:N),C={...b,cards:[...b.cards,h],columns:y};return o(C),C});},[o]),u=react.useCallback(async p=>{r(v=>{let b=v.cards.find(N=>N.id===p);if(!b)return v;let h=v.cards.filter(N=>N.id!==p),y=v.columns.map(N=>N.id===b.columnId?{...N,cardIds:N.cardIds.filter(S=>S!==p)}:N),C={...v,cards:h,columns:y};return o(C),C});},[o]),i=react.useCallback(async p=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let h={...p,id:v,cardIds:[]},y={...b,columns:[...b.columns,h]};return o(y),y});},[o]),m=react.useCallback(async(p,v)=>{r(b=>{let h=b.columns.map(C=>C.id===p?{...C,...v}:C),y={...b,columns:h};return o(y),y});},[o]),l=react.useCallback(async p=>{r(v=>{let b=v.cards.filter(C=>C.columnId!==p),h=v.columns.filter(C=>C.id!==p),y={...v,cards:b,columns:h};return o(y),y});},[o]),g=react.useCallback(p=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(p),v},[c]),f=react.useCallback(p=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(p),v},[i]),x=react.useCallback(()=>{r(p=>{let v={...p,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:c,onCardDelete:u,onColumnCreate:i,onColumnUpdate:m,onColumnDelete:l},setBoard:r,helpers:{addCard:g,addColumn:f,deleteCard:u,deleteColumn:l,clearBoard:x}}}function Cg({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ui({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,m={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(l=>l.columnId===u).length,...m});},addColumn:(u,i)=>{let m=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:u,position:i??m+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 Yn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Ng={by:"none",order:"asc"};function Dg({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Yn,...e}),[s,n]=react.useState({...Ng,...t}),c=react.useCallback(k=>{o(p=>({...p,...k}));},[]),u=react.useCallback(k=>{n(p=>({...p,...k}));},[]),i=react.useCallback(()=>{o(Yn),n(Ng);},[]),m=react.useCallback(()=>{a&&o({...Yn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...Yn,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Yn,priorities:["HIGH","URGENT"]});},[]),f=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]),x=react.useCallback(k=>{let p=[...k];if(r.search){let v=r.search.toLowerCase();p=p.filter(b=>b.title.toLowerCase().includes(v)||b.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,b=v.getFullYear(),h=String(v.getMonth()+1).padStart(2,"0"),y=String(v.getDate()).padStart(2,"0"),C=`${b}-${h}-${y}`;p=p.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let S=N.endDate||N.dueDate;if(!S)return false;let w;if(typeof S=="string")w=S.split("T")[0]||S;else {let E=S.getUTCFullYear(),L=String(S.getUTCMonth()+1).padStart(2,"0"),T=String(S.getUTCDate()).padStart(2,"0");w=`${E}-${L}-${T}`;}switch(r.dateFilter){case "overdue":return w<C;case "today":return w===C;case "this-week":let E=new Date(C+"T00:00:00"),L=new Date(w+"T00:00:00"),T=new Date(E);return T.setDate(T.getDate()+7),L>=E&&L<=T;case "custom":if(r.dateRange){let z=typeof S=="string"?new Date(S):S;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(p=p.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(p=p.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(h=>r.assignees.includes(h)))),r.labels.length>0&&(p=p.filter(v=>v.labels&&v.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(p=p.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&p.sort((v,b)=>{let h=0;switch(s.by){case "created":let y=v.createdAt?new Date(v.createdAt).getTime():0,C=b.createdAt?new Date(b.createdAt).getTime():0;h=y-C;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},S=N[v.priority||"LOW"],w=N[b.priority||"LOW"];h=S-w;break;case "dueDate":let E=v.endDate||v.dueDate,L=b.endDate||b.dueDate;if(!E)return 1;if(!L)return -1;let T=typeof E=="string"?new Date(E).getTime():E.getTime(),z=typeof L=="string"?new Date(L).getTime():L.getTime();h=T-z;break;case "title":h=v.title.localeCompare(b.title);break;case "estimate":let H=v.estimatedTime||0,J=b.estimatedTime||0;h=H-J;break;default:h=0;}return s.order==="asc"?h:-h}),p},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:u,resetFilters:i,filterMyTasks:m,filterOverdue:l,filterHighPriority:g,applyFilters:x,hasActiveFilters:f}}var Eg,Mg;if(typeof window<"u")try{let e=Qn("ai");Eg=e.generateObject,Mg=e.generateText;}catch{}function Pg(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Eg&&Mg&&e.apiKey),n=react.useCallback(async l=>{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:",l),{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: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let f=g instanceof Error?g:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let f=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),u=react.useCallback(async l=>{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(g){let f=g instanceof Error?g:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(g){let f=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(g){let f=g instanceof Error?g:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:c,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Sd(){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 Fg(e){let{cards:t}=e,[a,r]=Sd(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,g)=>{if(!g){r({selectedCardIds:[l],lastSelectedCardId:l});return}let f=g.ctrlKey||g.metaKey,x=g.shiftKey;if(f)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(x&&a.lastSelectedCardId){let k=t.find(v=>v.id===l),p=t.find(v=>v.id===a.lastSelectedCardId);if(k&&p&&k.columnId===p.columnId){let v=t.filter(w=>w.columnId===k.columnId).sort((w,E)=>w.position-E.position),b=v.findIndex(w=>w.id===a.lastSelectedCardId),h=v.findIndex(w=>w.id===l),[y,C]=b<h?[b,h]:[h,b],N=v.slice(y,C+1).map(w=>w.id),S=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:S,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),m=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:c,selectAll:u,toggleCard:i,getSelectedCards:m}}var Ag={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Lg(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Ag,...a}),[a]),[s,n]=react.useState([]),c=react.useCallback((k,p,v,b,h)=>{if(p.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:p,columnId:v,strategy:b,color:h,isExpanded:true,position:s.filter(C=>C.columnId===v).length,createdAt:new Date};n(C=>[...C,y]);},[o.minCardsPerStack,s]),u=react.useCallback(k=>{n(p=>p.filter(v=>v.id!==k));},[]),i=react.useCallback(k=>{n(p=>p.map(v=>v.id===k?{...v,isExpanded:!v.isExpanded}:v));},[]),m=react.useCallback((k,p)=>{n(v=>v.map(b=>b.id===k&&!b.cardIds.includes(p)?{...b,cardIds:[...b.cardIds,p]}:b));},[]),l=react.useCallback((k,p)=>{n(v=>v.map(b=>{if(b.id===k){let h=b.cardIds.filter(y=>y!==p);return h.length<o.minCardsPerStack?null:{...b,cardIds:h}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),g=react.useCallback(k=>s.filter(p=>p.columnId===k).sort((p,v)=>p.position-v.position),[s]),f=react.useCallback(async k=>{let p=t.filter(C=>C.columnId===k);if(p.length<o.minCardsPerStack*2)return [];let v=[],b=new Map;p.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(C);});}),b.forEach((C,N)=>{C.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:C.map(S=>S.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${N}"`,confidence:.85});});let h=new Map;p.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(C);});}),h.forEach((C,N)=>{C.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:C.map(S=>S.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(p.forEach(C=>{C.priority&&(y.has(C.priority)||y.set(C.priority,[]),y.get(C.priority).push(C));}),y.forEach((C,N)=>{if(C.length>=o.minCardsPerStack){let S={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";v.push({stack:{title:`${S} ${N} Priority`,cardIds:C.map(w=>w.id),columnId:k,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of p){let S=(await r.findSimilar(C,p)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(S.length>=o.minCardsPerStack-1){let w=[C.id,...S.map(L=>L.card.id)],E=S.reduce((L,T)=>L+T.similarity,0)/S.length;v.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:w,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${S.length+1} similar tasks`,confidence:E});}}return v.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,N)=>N.confidence-C.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(k=>{c(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(p=>p.columnId)).forEach(async p=>{let v=await f(p),b=v[0];v.length>0&&b&&b.confidence>=.9&&x(b);});},[]),{stacks:s,createStack:c,deleteStack:u,toggleStack:i,addToStack:m,removeFromStack:l,getStacksForColumn:g,getSuggestions:f,applySuggestion:x,config:o}}var Ig=react.createContext(null);function Bg({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=Qn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=Qn("@libxai/core");n.set(u.id,new i(u));});let c=null;if(t?.board){let{Board:u}=Qn("@libxai/core");c=new u(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Ig.Provider,{value:{store:o},children:e})}function mi(){let e=react.useContext(Ig);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xn(){let e=mi(),[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 c=react.useCallback(b=>{e.updateBoard(b);},[e]),u=react.useCallback(b=>{e.addColumn(b);},[e]),i=react.useCallback((b,h)=>{e.updateColumn(b,h);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),g=react.useCallback(b=>{e.addCard(b);},[e]),f=react.useCallback((b,h)=>{e.updateCard(b,h);},[e]),x=react.useCallback(b=>{e.deleteCard(b);},[e]),k=react.useCallback((b,h,y)=>{e.moveCard(b,h,y);},[e]),p=react.useCallback(b=>e.getCard(b),[e]),v=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:u,updateColumn:i,deleteColumn:m,getColumn:l,addCard:g,updateCard:f,deleteCard:x,moveCard:k,getCard:p,getCardsByColumn:v}}function Og(e){let{cards:t}=Xn();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 $g(e="position",t="asc"){let{cards:a}=Xn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?c[o.priority]:0,i=s.priority?c[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var pi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=sc.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 c=await Promise.resolve(n.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{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);}},b1=new pi;function Ug({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:c=0,getItemKey:u}){let i=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:c}),l=m.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:f,children:l.map(x=>{let k=e[x.index];if(!k)return null;let p=u?u(k,x.index):x.index,v={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsxRuntime.jsx("div",{style:v,"data-index":x.index,children:r(k,x.index)},p)})})})}function zg(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 Gg({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:c=16,getItemKey:u,horizontal:i=true}){let m=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:c}),g=l.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:f,className:s,children:jsxRuntime.jsx("div",{style:x,children:g.map(k=>{let p=e[k.index];if(!p)return null;let v=u?u(p,k.index):k.index,b={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":k.index,children:o(p,k.index)},v)})})})}function Vg(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 _g(e,t=10){return e>t}var Fd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ad={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ld={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Id={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Bd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Rd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Od={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},$d={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)"},Hd={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)"},Ud={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zd={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}},Wd={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}},gi={spacing:Fd,borderRadius:Ad,fontSize:Ld,fontWeight:Id,lineHeight:Bd,zIndex:Rd,duration:Od,easing:$d,shadows:Hd,opacity:Ud,kanban:zd,gantt:Wd};function jg(e,t,a){return e[t]??a}function Gd(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)?Gd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function x1(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vd(e="asakaa"){let t=Gd(gi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=x1(o);a.push(` ${s}: ${n};`);}return `:root {
403
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function sm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Hr(e,t){let a=sm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let u=l.name.toLowerCase();return n.every(i=>u.includes(i))})}function Fl(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 p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}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 f={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(f!==void 0){let v=new Date(r),k=v.getDay(),g=f-k;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}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 p=parseInt(s[1],10),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),f=parseInt(l[2],10)-1,v=parseInt(l[3],10);return new Date(v,f,p)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),f=u[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,p)}let c={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 p=c[d[1].toLowerCase()],f=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function Al(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 Ll(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 im(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 lm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),d=Hr(t,i),p=Fl(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:v},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=Hr(t,i),p=Al(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${p} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=Hr(t,i),p=Ll(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=Hr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=Hr(t,i),p=Hr(t,c);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),c=Hr(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function dm(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 tv(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 av(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Rs(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||l&&u&&Math.abs(u.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:u,progress:e.progress||0,status:tv(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function 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:av(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function um(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Rs(r,e,t))}var Il={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Bl={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},Os={en:Il,es:Bl};function Rl(e){return Os[e]||Os.en}function $s(e,t){let a=Rl(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 Ol=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function mm(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 pm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let u=mm(e),i=Ol[0],c=Ol.find(f=>f.value===u)??i,d=c.icon,p=f=>{switch(mm(f)){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:m("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Ol.map(f=>{let v=f.icon;return jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",u===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(v,{className:m("w-4 h-4",f.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var $l=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function fm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=$l.find(c=>c.value===e)??$l[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:$l.map(c=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function Hs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ws(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 kv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:lucideReact.AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function ym({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,u]=react.useState(false),[i,c]=react.useState(""),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&(u(false),c(""));};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),k=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:Hs(g.name),color:g.color||Ws(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:m("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>jsxRuntime.jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!g.avatar&&Ws(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Hs(g.name)},`${g.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),u(!l);},className:m("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:m("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:m("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsxRuntime.jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&Ws(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Hs(g.name)},`${g.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:m("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxRuntime.jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxRuntime.jsxs("div",{className:m("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:g=>c(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:m("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsxRuntime.jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=kv(g.workload,r);return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),k(g);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsxRuntime.jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&Ws(g.name)),children:g.avatarUrl?jsxRuntime.jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):Hs(g.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsxRuntime.jsx("div",{className:m("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxRuntime.jsxs("div",{className:m("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsxRuntime.jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxRuntime.jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:u}){let[i,c]=react.useState(false),[d,p]=react.useState(o),[f,v]=react.useState(()=>{let C=o==="start"?e:t;if(C){let w=C instanceof Date?C:new Date(C);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),k=react.useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let C=w=>{k.current&&!k.current.contains(w.target)&&c(false);};return i&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=C=>C?C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",b=react.useCallback(()=>{let C=f.getFullYear(),w=f.getMonth(),R=new Date(C,w,1),T=new Date(C,w+1,0).getDate(),H=R.getDay(),A=[],S=new Date(C,w,0).getDate();for(let le=H-1;le>=0;le--)A.push({date:new Date(C,w-1,S-le),isCurrentMonth:false});for(let le=1;le<=T;le++)A.push({date:new Date(C,w,le),isCurrentMonth:true});let j=42-A.length;for(let le=1;le<=j;le++)A.push({date:new Date(C,w+1,le),isCurrentMonth:false});return A},[f]),x=C=>{if(r)o==="start"?a(C,y||void 0):a(g||void 0,C),c(false);else if(d==="start"){let w=y&&C>y?C:y;a(C,w||void 0),p("end");}else {let w=g&&C<g?C:g;a(w||void 0,C),c(false);}},D=()=>{let C=new Date,w=new Date(C);w.setDate(C.getDate()+1);let R=new Date(C);R.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let F=new Date(C);F.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let T=new Date(C);T.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let H=new Date(C);H.setDate(C.getDate()+14);let A=new Date(C);return A.setDate(C.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:F,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let C=r&&o==="start"?g:y;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(C)})]})}let N=r&&o==="start"?g:y;return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),c(!i);let w=o==="start"?g:y;w&&v(new Date(w.getFullYear(),w.getMonth(),1));},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(N)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxRuntime.jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:m("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((C,w)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(C.date),children:[jsxRuntime.jsx("span",{children:C.label}),jsxRuntime.jsx("span",{className:m("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C.display})]},w)),jsxRuntime.jsx("div",{className:m("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||void 0,void 0):a(void 0,void 0),c(false);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 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:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"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:m("font-medium",s?"text-white":"text-gray-900"),children:f.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:()=>v(new Date),className:m("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("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(C=>jsxRuntime.jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((C,w)=>{let R=C.date.toDateString()===new Date().toDateString(),F=g?.toDateString()===C.date.toDateString(),T=y?.toDateString()===C.date.toDateString(),H=F||T,A=!r&&g&&y&&C.date>=g&&C.date<=y;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(C.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",F&&"bg-[#3B82F6] text-white",T&&!F&&"bg-[#7C3AED] text-white",A&&!H&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},w)})})]})]})]})]})}function Gs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let u=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(km,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:l||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},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 Vs(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,u]=react.useState(false),i=react.useRef(e),c=react.useRef([]);return react.useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,p=e,f=p-d,v=r/o;u(true);for(let k=1;k<=o;k++){let g=setTimeout(()=>{let y=k/o,h=1-Math.pow(1-y,3),b=Math.round(d+f*h);n(b),k===o&&(u(false),n(p));},v*k);c.current.push(g);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function wm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),u=react.useRef(null),i=react.useRef(null),c=react.useCallback(f=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(f),l(0);let v=Date.now();i.current=setInterval(()=>{let k=Date.now()-v,g=Math.min(k/a*100,100);l(g);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=tn(),{displayValue:u,isAnimating:i}=Vs(e,{enabled:o,duration:300,steps:6}),c=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,k=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,k));g!==e&&(t(g),s&&l());},d=u??e;return jsxRuntime.jsxs("div",{className:m("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsxRuntime.jsx("div",{onClick:c,className:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:m("h-full rounded-full transition-all",d===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxRuntime.jsxs("span",{className:m("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,u]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{u(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(u(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:m("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:p=>u(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:u=true}){let[i,c]=react.useState(false),[d,p]=react.useState(e?.toString()||""),f=react.useRef(null),{isFlashing:v,triggerFlash:k}=tn(),{displayValue:g,isAnimating:y}=Vs(e,{enabled:l&&!i});react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(d);if(!isNaN(x)){let D=x;o!==void 0&&(D=Math.max(o,D)),s!==void 0&&(D=Math.min(s,D)),D!==e&&(t?.(D),u&&k());}c(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),c(false));};return n||!t?jsxRuntime.jsx("span",{className:m("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsxRuntime.jsx("input",{ref:f,type:"number",value:d,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),c(true);},className:m("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),u=react.useRef(null);return react.useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:m("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:m("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:m("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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:m("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Im({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:u,startChange:i,cancelChange:c}=wm(t,{delay:s}),d=f=>{f.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},p=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),c();},className:m("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 Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:m("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:m("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Hv(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 Wv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+u}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 No({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false}){let[u,i]=react.useState(false),[c,d]=react.useState(""),p=react.useRef(null),{isFlashing:f,triggerFlash:v}=tn(),k=Hv(e,r);react.useEffect(()=>{u&&p.current&&(p.current.focus(),p.current.select());},[u]),react.useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?d(`${h}h ${b}m`):h>0?d(`${h}h`):d(`${b}m`);}else d("");},[e,u]);let g=()=>{let h=Wv(c);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return l?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:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:k})]}):u?jsxRuntime.jsx("input",{ref:p,type:"text",value:c,onChange:h=>d(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:m("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:m("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate",children:k})]})}function ax(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function rx(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 Gm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:u,onColumnSort:i,availableUsers:c=[]}){let d=react.useRef(null),p=r==="es"?Hm.es:Hm.en;if(react.useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.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:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],D=b.some(N=>N.name===h.name)?b.filter(N=>N.name!==h.name):[...b,{name:h.name,initials:ax(h.name),color:h.color||rx(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),y},k=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:d,style:g,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(y=>y.separator?jsxRuntime.jsx("div",{className:m("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(ox,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:m(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function ox({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:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Hm={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"},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"}};var Xm={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"}),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"})},vx=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Zm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[u,i]=react.useState(""),[c,d]=react.useState(null),p=react.useRef(null),f=l==="es"?Jm.es:Jm.en;if(react.useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),N=window.innerHeight-x.top-20;d(Math.max(300,N));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),react.useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=N=>{p.current&&!p.current.contains(N.target)&&t();},D=N=>{N.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",D),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,k=b=>{if(b==="name")return;let x=a.map(D=>D.id===b?{...D,visible:!D.visible}:D);o(x);},g=(b,x)=>{let D=a.find(C=>C.type===b&&(!x||C.customFieldId===x));if(D){k(D.id);return}let N={id:x||b,type:b,label:x?r.find(C=>C.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,N]);},y=vx.filter(b=>v(b).toLowerCase().includes(u.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(u.toLowerCase()));return jsxRuntime.jsxs("div",{ref:p,style:c?{maxHeight:`${c}px`}:void 0,className:m("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:m("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:m("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsxRuntime.jsx("button",{onClick:t,className:m("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:m("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:u,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:m("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(C=>C.type===b&&!C.customFieldId),D=x?.visible??false,N=b==="name";return jsxRuntime.jsxs("button",{onClick:()=>{N||(x?k(x.id):g(b));},disabled:N,className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",N&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Xm[b]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:h.map(b=>{let D=a.find(N=>N.customFieldId===b.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>g(b.type,b.id),className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Xm[b.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Jm={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",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},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:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Ex=[{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 tp({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,u]=react.useState("text"),[i,c]=react.useState([""]),d=o==="es"?ep.es:ep.en;react.useEffect(()=>{e&&(n(""),u("text"),c([""]));},[e]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{c([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,c(h);},k=g=>{i.length>1&&c(i.filter((y,h)=>h!==g));};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:m("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:m("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:m("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:m("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("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:Ex.map(g=>jsxRuntime.jsxs("button",{onClick:()=>u(g.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:m("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,y)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:m("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>k(y),className:m("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},y)),jsxRuntime.jsxs("button",{onClick:f,className:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:m("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var ep={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 op={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 np({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),u=react.useRef(null),i=react.useRef(0),c=s==="es"?op.es:op.en;react.useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||u.current&&!u.current.contains(k.target)&&l(false);},v=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(v=>!v);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,p&&jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:m("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:m("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(f=>{let v=e===f.value&&!t,k=()=>f.value==="all"?v?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m(v?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsxRuntime.jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsxRuntime.jsx(lucideReact.Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsxRuntime.jsx("div",{className:m("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:m("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Wx=[{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}],Gx=["estimatedTime","quotedTime","elapsedTime","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function dp(e){return e.map(t=>{if(!t.subtasks?.length)return t;let a=dp(t.subtasks),r={};for(let o of Gx){let s=0;for(let n of a){let l=n[o];typeof l=="number"&&l>0&&(s+=l);}s>0&&(r[o]=s);}return {...t,...r,subtasks:a}})}function cp(e,t=0){let a=[],r=[...e].sort((o,s)=>(o.position??0)-(s.position??0));for(let o of r)a.push({...o,level:t,hasChildren:(o.subtasks?.length||0)>0,parentPath:[o.id]}),o.subtasks?.length&&o.isExpanded!==false&&a.push(...cp(o.subtasks,t+1));return a}function up({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:u=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:D}=t,N=$s(c,d),C=i==="dark",w=react.useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let _=localStorage.getItem(x);if(_){let Y=JSON.parse(_);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(_){console.error("Error loading persisted filter:",_);}return {statusFilter:"all",hideCompleted:false}},[x]),[R,F]=react.useState("position"),[T,H]=react.useState("asc"),[A,ie]=react.useState(""),[S,j]=react.useState(()=>w().statusFilter),[le,Le]=react.useState(()=>w().hideCompleted),[L,fe]=react.useState(v||Wx),[Q,qe]=react.useState(false),[B,ee]=react.useState(false),[we,he]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[We,ke]=react.useState(null),[je,ae]=react.useState(0),[G,q]=react.useState(0),me=react.useRef(null);react.useEffect(()=>{v&&fe(v);},[v]),react.useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:S,hideCompleted:le}));}catch(_){console.error("Error persisting filter state:",_);}},[x,S,le]);let Ne=react.useMemo(()=>{let _=new Set;function Y(ge){for(let et of ge)et.subtasks?.length&&(et.isExpanded!==false&&_.add(et.id),Y(et.subtasks));}return Y(e),_},[e]),Xe=react.useMemo(()=>L.filter(_=>_.visible),[L]),U=react.useCallback(_=>{a.onTaskToggleExpand?.(_);},[a]),De=react.useCallback(_=>{R===_?H(Y=>Y==="asc"?"desc":"asc"):(F(_),H("asc")),a.onSortChange?.({column:_,direction:T==="asc"?"desc":"asc"});},[R,T,a]),Me=react.useCallback(_=>{fe(_),a.onColumnsChange?.(_);},[a]),Ae=react.useCallback(_=>{let Y=L.map(ge=>ge.id===_?{...ge,visible:false}:ge);Me(Y);},[L,Me]),X=react.useCallback((_,Y)=>{F(_),H(Y);},[]),I=react.useCallback((_,Y,ge)=>{y&&(_.preventDefault(),he({isOpen:true,x:_.clientX,y:_.clientY,type:Y?"task":"header",task:Y,columnId:ge}));},[y]),K=react.useCallback(()=>{he(_=>({..._,isOpen:false}));},[]),de=react.useCallback((_,Y)=>{if(!g)return;_.preventDefault(),_.stopPropagation();let ge=L.find(et=>et.id===Y);ge&&(ke(Y),ae(_.clientX),q(ge.width));},[L,g]);react.useEffect(()=>{if(!We)return;let _=ge=>{let et=ge.clientX-je,Ee=Math.max(50,G+et),Oe=L.map(oe=>oe.id===We?{...oe,width:Ee}:oe);fe(Oe);},Y=()=>{We&&a.onColumnsChange?.(L),ke(null);};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",Y);}},[We,je,G,L,a]);let Se=react.useCallback(async _=>{if(a.onCreateCustomField){let Y={..._,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}ee(false);},[a]),Ke=react.useCallback(_=>_.progress===100||_.status==="completed"?"completed":_.progress&&_.progress>0||_.status==="in-progress"?"in-progress":"todo",[]),ot=react.useMemo(()=>{let _=dp(e),Y=cp(_);if(A.trim()){let ge=A.toLowerCase();Y=Y.filter(et=>et.name.toLowerCase().includes(ge));}return S!=="all"&&(Y=Y.filter(ge=>Ke(ge)===S)),le&&(Y=Y.filter(ge=>Ke(ge)!=="completed")),R==="position"||Y.sort((ge,et)=>{let Ee,Oe;switch(R){case "position":Ee=ge.position??0,Oe=et.position??0;break;case "name":Ee=ge.name.toLowerCase(),Oe=et.name.toLowerCase();break;case "startDate":Ee=ge.startDate?.getTime()||0,Oe=et.startDate?.getTime()||0;break;case "endDate":Ee=ge.endDate?.getTime()||0,Oe=et.endDate?.getTime()||0;break;case "progress":Ee=ge.progress||0,Oe=et.progress||0;break;case "status":Ee=ge.status||"todo",Oe=et.status||"todo";break;case "priority":let oe={urgent:0,high:1,medium:2,low:3,none:4};Ee=oe[ge.priority]??4,Oe=oe[et.priority]??4;break;default:return 0}return Ee<Oe?T==="asc"?-1:1:Ee>Oe?T==="asc"?1:-1:0}),Y},[e,A,S,le,R,T,Ke]),ct=react.useCallback((_,Y,ge=false)=>{let et=oe=>{a.onTaskUpdate?.({..._,...oe});},Ee=oe=>oe?_.customFields?.find($=>$.fieldId===oe)?.value:void 0,Oe=(oe,ye)=>{if(!oe)return;let ne=[..._.customFields||[]],$e=ne.findIndex(Ze=>Ze.fieldId===oe);$e>=0?ne[$e]={fieldId:oe,value:ye}:ne.push({fieldId:oe,value:ye}),et({customFields:ne});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(pm,{value:_.status||(_.progress===100?"completed":_.progress&&_.progress>0?"in-progress":"todo"),onChange:ye=>{et({status:ye,progress:ye==="completed"?100:ye==="in-progress"?50:0});},isDark:C,locale:c,translations:N.status});case "priority":return jsxRuntime.jsx(fm,{value:_.priority,onChange:ye=>et({priority:ye}),isDark:C,locale:c});case "assignees":return jsxRuntime.jsx(ym,{value:_.assignees||[],availableUsers:l,onChange:ye=>et({assignees:ye}),isDark:C,locale:c});case "startDate":return jsxRuntime.jsx(Gs,{value:_.startDate,onChange:ye=>et({startDate:ye}),isDark:C,locale:c,dateField:"start",startDate:_.startDate,endDate:_.endDate});case "endDate":return jsxRuntime.jsx(Gs,{value:_.endDate,onChange:ye=>et({endDate:ye}),isDark:C,locale:c,dateField:"end",startDate:_.startDate,endDate:_.endDate});case "progress":return jsxRuntime.jsx(Nm,{value:_.progress||0,onChange:ye=>{let $=ye===100?"completed":ye>0?"in-progress":"todo";et({progress:ye,status:$});},isDark:C});case "tags":return jsxRuntime.jsx(Om,{value:_.tags||[],isDark:C});case "text":return jsxRuntime.jsx(Em,{value:Ee(Y.customFieldId)||"",onChange:ye=>Oe(Y.customFieldId,ye),isDark:C});case "number":return jsxRuntime.jsx(Fm,{value:Ee(Y.customFieldId)||0,onChange:ye=>Oe(Y.customFieldId,ye),isDark:C});case "date":let oe=Ee(Y.customFieldId);return jsxRuntime.jsx(Gs,{value:oe?new Date(oe):void 0,onChange:ye=>Oe(Y.customFieldId,ye),isDark:C,locale:c});case "dropdown":return jsxRuntime.jsx(Am,{value:Ee(Y.customFieldId)||"",options:Y.options||[],onChange:ye=>Oe(Y.customFieldId,ye),isDark:C});case "checkbox":return jsxRuntime.jsx(Im,{value:Ee(Y.customFieldId)||false,onChange:ye=>Oe(Y.customFieldId,ye),isDark:C});case "estimatedTime":{let ye=_.status==="completed"||_.progress===100;return jsxRuntime.jsx(No,{value:_.estimatedTime,onChange:ge?void 0:$=>et({estimatedTime:$}),isDark:C,locale:c,disabled:ye||ge})}case "quotedTime":{let ye=_.status==="completed"||_.progress===100,$=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsxRuntime.jsx(No,{value:_.quotedTime,onChange:ge?void 0:ne=>et({quotedTime:ne}),isDark:C,locale:c,disabled:ye||ge,isBlurred:$})}case "elapsedTime":{let ye=_.status==="completed"||_.progress===100;return jsxRuntime.jsx(No,{value:_.elapsedTime,onChange:ge?void 0:$=>et({elapsedTime:$}),isDark:C,locale:c,disabled:ye||ge})}case "effortMinutes":{let ye=_.status==="completed"||_.progress===100;return jsxRuntime.jsx(No,{value:_.effortMinutes,onChange:ge?void 0:$=>et({effortMinutes:$}),isDark:C,locale:c,disabled:ye||ge})}case "timeLoggedMinutes":{let ye=_.status==="completed"||_.progress===100;return jsxRuntime.jsx(No,{value:_.timeLoggedMinutes,onChange:ge?void 0:a.onLogTime?$=>{a.onLogTime?.(_,$);}:void 0,isDark:C,locale:c,placeholder:c==="es"?"Agregar":"Add",disabled:ye||ge})}case "soldEffortMinutes":{let ye=_.status==="completed"||_.progress===100,$=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(No,{value:_.soldEffortMinutes,onChange:ge?void 0:ne=>et({soldEffortMinutes:ne}),isDark:C,locale:c,disabled:ye||ge,isBlurred:$})}default:return jsxRuntime.jsx("span",{className:m("text-sm",C?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,C,c,l,N]),Ye=react.useCallback(_=>{let ge={name:N.columns.name,status:N.columns.status,priority:N.columns.priority,assignees:N.columns.assignees,startDate:N.columns.startDate,endDate:N.columns.endDate,progress:N.columns.progress,tags:N.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:N.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:N.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:N.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:N.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:N.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:N.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[_.type]||_.label;return typeof ge=="string"?ge:String(ge||_.type)},[N,c]),sa=react.useMemo(()=>Xe.reduce((_,Y)=>_+Y.width,0)+(k?48:0),[Xe,k]);return r?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[N.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"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:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:N.empty.noTasks}),jsxRuntime.jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:me,className:m("flex-1 flex flex-col w-full h-full overflow-hidden",C?"bg-[#0F1117]":"bg-white",We&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",C?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(np,{value:S,hideCompleted:le,onChange:j,onHideCompletedChange:Le,isDark:C,locale:c}),jsxRuntime.jsxs("div",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[ot.length," ",N.pagination.tasks]}),p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:A,onChange:_=>ie(_.target.value),placeholder:N.toolbar.searchPlaceholder,className:m("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",C?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&b&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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-4 h-4"}),jsxRuntime.jsx("span",{children:N.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:sa},children:[jsxRuntime.jsxs("div",{className:m("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",C?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Xe.map(_=>jsxRuntime.jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-3",C?"text-[#9CA3AF]":"text-gray-500"),style:{width:_.width,minWidth:_.minWidth},onContextMenu:Y=>I(Y,void 0,_.id),children:[_.sortable?jsxRuntime.jsxs("button",{onClick:()=>De(_.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Ye(_),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:m("w-3 h-3",R===_.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Ye(_)}),g&&_.resizable&&jsxRuntime.jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",We===_.id&&"bg-[#3B82F6]"),onMouseDown:Y=>de(Y,_.id)})]},_.id)),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),qe(Y=>!Y);},className:m("p-1.5 rounded-lg transition-colors",C?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Q&&(C?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(Zm,{isOpen:Q,onClose:()=>qe(false),columns:L,customFields:u,onColumnsChange:Me,onCreateCustomField:()=>{qe(false),ee(true);},isDark:C,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:ot.map((_,Y)=>{let ge=Ne.has(_.id),et=Math.min(Y*.01,.2);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:et},className:m("flex items-center border-b transition-colors",C?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(_),onDoubleClick:()=>a.onTaskDoubleClick?.(_),onContextMenu:Ee=>I(Ee,_),children:[Xe.map(Ee=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Ee.width,minWidth:Ee.minWidth},children:Ee.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&_.level>0&&jsxRuntime.jsx("div",{style:{width:`${_.level*24}px`},className:"flex-shrink-0"}),f&&_.hasChildren&&jsxRuntime.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),U(_.id);},className:m("p-0.5 rounded flex-shrink-0",C?"hover:bg-white/10":"hover:bg-gray-200"),children:ge?jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")})}),f&&!_.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("span",{className:m("truncate font-medium",C?"text-white":"text-gray-900",_.progress===100&&(C?"line-through text-[#6B7280]":"line-through text-gray-400")),children:_.name})]}):ct(_,Ee,_.hasChildren)},Ee.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},_.id)})}),ot.length===0&&A&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:m("w-12 h-12 mx-auto mb-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:m(C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.noResults})]})})]})}),jsxRuntime.jsx(Gm,{state:we,onClose:K,isDark:C,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ae,onColumnSort:X,availableUsers:l}),jsxRuntime.jsx(tp,{isOpen:B,onClose:()=>ee(false),onSave:Se,isDark:C,locale:c})]})}var mp=[{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:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],pp=[{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"}],gp=[{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 Xl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Jl={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"},Zl={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"},Ks={dark:Xl,light:Jl,neutral:Zl};function fp(e){return Ks[e]||Ks.dark}var Ql={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"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ed={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"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},qs={en:Ql,es:ed};function In(e){return qs[e]||qs.en}function Ys(e,t){let a=In(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 hp(e){let t=In(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 bp(e,t=0,a=true){let r=In(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 wp(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 ad(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 Cp({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Np({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:D,onUpdateEstimate:N,onUpdateSoldEffort:C,onStartTimer:w,onStopTimer:R,onDiscardTimer:F,blurFinancials:T=false}){let{theme:H="dark",locale:A="en",customTranslations:ie}=t,S=Ys(A,ie),j=H==="dark",[le,Le]=react.useState(r||new Date),[L,fe]=react.useState(null),[Q,qe]=react.useState(null),[B,ee]=react.useState({}),we=4,he=3,[We,ke]=react.useState(null),[je,ae]=react.useState(""),[G,q]=react.useState(void 0),[me,Ne]=react.useState(null),[Xe,U]=react.useState(false),[De,Me]=react.useState(false),[Ae,X]=react.useState(null),[I,K]=react.useState(false),[de,Se]=react.useState(new Date),Ke=react.useCallback(()=>{Le(new Date(le.getFullYear(),le.getMonth()-1,1));},[le]),ot=react.useCallback(()=>{Le(new Date(le.getFullYear(),le.getMonth()+1,1));},[le]),ct=react.useCallback(()=>{Le(new Date);},[]),Ye=react.useMemo(()=>{let Y=le.getFullYear(),ge=le.getMonth(),et=new Date(Y,ge,1),Ee=new Date(Y,ge+1,0),Oe=et.getDay(),oe=Ee.getDate(),ye=wp(e),$=new Date;$.setHours(0,0,0,0);let ne=[],$e=Oe,Ze=new Date(Y,ge,0).getDate();for(let Ve=$e-1;Ve>=0;Ve--){let ve=new Date(Y,ge-1,Ze-Ve);ne.push({date:ve,isCurrentMonth:false,isToday:false,isWeekend:ve.getDay()===0||ve.getDay()===6,events:ye.filter(He=>ad(ve,He)).map(He=>({id:He.id,title:He.name,start:He.startDate,end:He.endDate,task:He}))});}for(let Ve=1;Ve<=oe;Ve++){let ve=new Date(Y,ge,Ve),He=ve.getTime()===$.getTime();ne.push({date:ve,isCurrentMonth:true,isToday:He,isWeekend:ve.getDay()===0||ve.getDay()===6,events:ye.filter(W=>ad(ve,W)).map(W=>({id:W.id,title:W.name,start:W.startDate,end:W.endDate,task:W}))});}let at=42-ne.length;for(let Ve=1;Ve<=at;Ve++){let ve=new Date(Y,ge+1,Ve);ne.push({date:ve,isCurrentMonth:false,isToday:false,isWeekend:ve.getDay()===0||ve.getDay()===6,events:ye.filter(He=>ad(ve,He)).map(He=>({id:He.id,title:He.name,start:He.startDate,end:He.endDate,task:He}))});}return ne},[le,e]),sa=A==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=le.toLocaleDateString(A==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",j?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:m("text-sm",j?"text-[#9CA3AF]":"text-gray-600"),children:[S.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",j?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"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:m("text-lg font-semibold mb-2",j?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:m("text-sm",j?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",j?"bg-[#0F1117]":"bg-white",n),style:l,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",j?"text-white":"text-gray-900"),children:S.labels.noEvents}),jsxRuntime.jsx("p",{className:m("text-sm",j?"text-[#9CA3AF]":"text-gray-600"),children:S.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-auto",j?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",j?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:m("text-xl font-semibold capitalize",j?"text-white":"text-gray-900"),children:_}),jsxRuntime.jsx("button",{onClick:ct,className:m("px-3 py-1.5 text-sm rounded-lg transition-colors",j?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:S.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ke,className:m("p-2 rounded-lg transition-colors",j?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:m("w-5 h-5",j?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ot,className:m("p-2 rounded-lg transition-colors",j?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-5 h-5",j?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:sa.map(Y=>jsxRuntime.jsx("div",{className:m("py-2 text-center text-xs font-medium uppercase",j?"text-[#9CA3AF]":"text-gray-500"),children:Y},Y))}),jsxRuntime.jsx("div",{className:m("grid grid-cols-7 auto-rows-min gap-px rounded-lg",j?"bg-[#2D2D2D]":"bg-gray-300"),children:Ye.map((Y,ge)=>{let et=Y.date.getDay()===0||Y.date.getDay()===6;return jsxRuntime.jsxs("div",{className:m("min-h-[120px] p-2 transition-colors flex flex-col relative group",j?et?"bg-[#1C1F26]":Y.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":et?"bg-gray-100":Y.isCurrentMonth?"bg-white":"bg-gray-50",Y.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ee=B[ge]||we,Oe=Y.events.slice(0,Ee),oe=Y.events.length-Ee;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Oe.map(ye=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{fe(ye.task),a.onEventClick?.(ye),g?.(ye.task.id);},whileHover:{scale:1.02},className:m("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ye.task.progress===100?j?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":j?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Cp,{task:ye.task}),jsxRuntime.jsx("span",{className:"truncate",children:ye.title})]})},ye.id)),oe>0&&jsxRuntime.jsxs("button",{onClick:ye=>{ye.stopPropagation(),ee($=>({...$,[ge]:Ee+he}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",j?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",oe," ",A==="es"?"M\xC1S":"MORE"]}),Ee>we&&Y.events.length>we&&jsxRuntime.jsx("button",{onClick:ye=>{ye.stopPropagation(),ee($=>({...$,[ge]:we}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",j?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:A==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ee=ge>=28,Oe=ge%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),We===ge?ke(null):(ke(ge),ae(""),q(void 0),Ne(null),X(null),U(false),Me(false),K(false),Se(Y.date));},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",We===ge?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:m("w-3.5 h-3.5 transition-transform",We===ge&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:We===ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ke(null),ae(""),q(void 0),Ne(null),X(null),U(false),Me(false),K(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ee?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ee?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Ee?"bottom-full mb-1":"top-full mt-1",Oe?"right-0":"left-0",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>{oe.stopPropagation(),U(false),Me(false),K(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:je,onChange:oe=>ae(oe.target.value),placeholder:A==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:m("w-full bg-transparent text-sm outline-none placeholder:opacity-40",j?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:oe=>{if(oe.key==="Enter"&&je.trim()){let ye=t.availableUsers?.find(ne=>ne.id===me),$=Ae||Y.date;a.onTaskCreate?.({name:je.trim(),startDate:$,endDate:$,priority:G,assignees:ye?[ye]:void 0}),ae(""),q(void 0),Ne(null),X(null),ke(null);}oe.key==="Escape"&&(ke(null),ae(""),q(void 0),Ne(null),X(null));}})}),jsxRuntime.jsxs("div",{className:m("px-2.5 py-2 flex items-center justify-between border-t",j?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),U(!Xe),Me(false);},className:m("p-1 rounded transition-colors",G?G==="urgent"||G==="high"?"text-red-400 bg-red-500/20":G==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":j?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[{id:"urgent",label:A==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:A==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:A==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:A==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:A==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(oe=>jsxRuntime.jsxs("button",{onClick:()=>{q(oe.id),U(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",j?"hover:bg-white/5":"hover:bg-gray-50",G===oe.id&&(j?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",oe.color)}),jsxRuntime.jsx("span",{className:j?"text-white":"text-gray-900",children:oe.label})]},oe.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:oe=>{oe.stopPropagation(),K(!I),U(false),Me(false),Se(Ae||Y.date);},className:m("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ae?"bg-[#7C3AED]/20 text-[#7C3AED]":j?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(Ae||Y.date).toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsx("div",{className:m("w-40 py-2 border-r",j?"border-white/10":"border-gray-200"),children:(()=>{let oe=new Date,ye=new Date(oe);ye.setDate(oe.getDate()+1);let $=new Date(oe);$.setDate(oe.getDate()+((6-oe.getDay()+7)%7||7));let ne=new Date(oe);ne.setDate(oe.getDate()+((1-oe.getDay()+7)%7||7));let $e=new Date(oe);$e.setDate(oe.getDate()+14);let Ze=new Date(oe);return Ze.setDate(oe.getDate()+28),[{label:A==="es"?"Hoy":"Today",date:oe,display:oe.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:A==="es"?"Ma\xF1ana":"Tomorrow",date:ye,display:ye.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:A==="es"?"Este fin de semana":"This weekend",date:$,display:A==="es"?"s\xE1b.":"sat."},{label:A==="es"?"Pr\xF3xima semana":"Next week",date:ne,display:A==="es"?"lun.":"mon."},{label:A==="es"?"2 semanas":"2 weeks",date:$e,display:$e.toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:A==="es"?"4 semanas":"4 weeks",date:Ze,display:Ze.toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ve,ve)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",j?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{X(Ve.date),K(false);},children:[jsxRuntime.jsx("span",{children:Ve.label}),jsxRuntime.jsx("span",{className:m("text-[10px]",j?"text-[#6B7280]":"text-gray-400"),children:Ve.display})]},ve))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:m("text-xs font-medium",j?"text-white":"text-gray-900"),children:de.toLocaleDateString(A==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Se(new Date),className:m("px-1.5 py-0.5 rounded text-[10px] transition-colors",j?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:A==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Se(new Date(de.getFullYear(),de.getMonth()-1)),className:m("p-0.5 rounded",j?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Se(new Date(de.getFullYear(),de.getMonth()+1)),className:m("p-0.5 rounded",j?"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:(A==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(oe=>jsxRuntime.jsx("div",{className:m("w-6 h-6 flex items-center justify-center text-[10px]",j?"text-[#6B7280]":"text-gray-400"),children:oe},oe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let oe=de.getFullYear(),ye=de.getMonth(),$=new Date(oe,ye,1).getDay(),ne=new Date(oe,ye+1,0).getDate(),$e=new Date(oe,ye,0).getDate(),Ze=new Date,at=[];for(let ve=$-1;ve>=0;ve--)at.push({dayNum:$e-ve,isCurrentMonth:false,date:new Date(oe,ye-1,$e-ve)});for(let ve=1;ve<=ne;ve++)at.push({dayNum:ve,isCurrentMonth:true,date:new Date(oe,ye,ve)});let Ve=42-at.length;for(let ve=1;ve<=Ve;ve++)at.push({dayNum:ve,isCurrentMonth:false,date:new Date(oe,ye+1,ve)});return at.map((ve,He)=>{let W=ve.date.toDateString()===Ze.toDateString(),ce=(Ae||Y.date).toDateString()===ve.date.toDateString();return jsxRuntime.jsx("button",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ve.isCurrentMonth&&(j?"text-[#4B5563]":"text-gray-300"),ve.isCurrentMonth&&(j?"text-white":"text-gray-900"),W&&"ring-1 ring-[#3B82F6]",ce&&"bg-[#7C3AED] text-white",!ce&&(j?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{X(ve.date),K(false);},children:ve.dayNum},He)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),Me(!De),U(false);},className:m("p-1 rounded transition-colors",me?"text-[#7C3AED] bg-[#7C3AED]/20":j?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:me?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(oe=>oe.id===me)?.color||"#7C3AED"},children:t.availableUsers?.find(oe=>oe.id===me)?.initials||t.availableUsers?.find(oe=>oe.id===me)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:De&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{Ne(null),Me(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",j?"hover:bg-white/5":"hover:bg-gray-50",!me&&(j?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded-full flex items-center justify-center",j?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:j?"text-[#9CA3AF]":"text-gray-500",children:A==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(oe=>jsxRuntime.jsxs("button",{onClick:()=>{Ne(oe.id),Me(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",j?"hover:bg-white/5":"hover:bg-gray-50",me===oe.id&&(j?"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-medium",style:{backgroundColor:oe.color||"#7C3AED"},children:oe.initials||oe.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:j?"text-white":"text-gray-900",children:oe.name})]},oe.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:m("px-3 py-2 text-xs",j?"text-[#6B7280]":"text-gray-400"),children:A==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(je.trim()){let oe=t.availableUsers?.find($=>$.id===me),ye=Ae||Y.date;a.onTaskCreate?.({name:je.trim(),startDate:ye,endDate:ye,priority:G,assignees:oe?[oe]:void 0}),ae(""),q(void 0),Ne(null),X(null),ke(null);}},disabled:!je.trim(),className:m("px-2.5 py-1 rounded text-xs font-medium transition-colors",je.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":j?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:A==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:m("text-sm font-medium",Y.isToday?"text-[#3B82F6]":Y.isCurrentMonth?j?"text-white":"text-gray-900":j?"text-[#6B7280]":"text-gray-400"),children:Y.date.getDate()})]})]},ge)})})]})}),jsxRuntime.jsx(Br,{task:L,isOpen:!!L,onClose:()=>fe(null),onTaskUpdate:Y=>{a.onTaskUpdate?.(Y),fe(Y);},theme:H==="dark"?"dark":"light",locale:A,availableUsers:t.availableUsers?.map(Y=>({id:Y.id,name:Y.name,avatar:Y.avatar,initials:Y.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:u,onCreateTag:i,attachments:L?c?.get(L.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:wp(e).filter(Y=>Y.id!==L?.id),comments:d?.filter(Y=>Y.taskId===L?.id).map(Y=>({...Y,createdAt:Y.createdAt instanceof Date?Y.createdAt:new Date(Y.createdAt),updatedAt:Y.updatedAt instanceof Date?Y.updatedAt:Y.updatedAt?new Date(Y.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onSoldEffortUpdate:C,onTimerStart:w,onTimerStop:R,onTimerDiscard:F,blurFinancials:T}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>qe(null),className:"fixed inset-0 bg-black/30 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:m("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-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between",j?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:m("font-medium",j?"text-white":"text-gray-900"),children:Q.date.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>qe(null),className:m("p-1 rounded",j?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:Q.events.map(Y=>jsxRuntime.jsxs("button",{onClick:()=>{qe(null),fe(Y.task),g?.(Y.task.id);},className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Cp,{task:Y.task}),jsxRuntime.jsx("span",{className:m("text-sm truncate flex-1",j?"text-white":"text-gray-900"),children:Y.title}),Y.task.priority==="high"||Y.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},Y.id))})]})]})})]})}var rd={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},od={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"},nd={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"},Xs={dark:rd,light:od,neutral:nd};function Dp(e){return Xs[e]||Xs.dark}function Qx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[u,i]=react.useState(false),c=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=react.useMemo(()=>{let f=c.length,v=new Set(c.flatMap(y=>y.assignedUserIds||[])).size,k=c.map(y=>y.priority).filter(Boolean),g=new Set(c.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:k,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,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:m("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"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.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:c.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:c.map(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Ep={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Rn(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 On(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 Pp(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 Mp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let u=react.useMemo(()=>({...Ep,...n}),[n]),[i,c]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],D=h.get(x);D?D.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=react.useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),k=h=>{c(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),D=Math.floor(x/6e4),N=Math.floor(x/36e5),C=Math.floor(x/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:C<7?`${C}d ago`:h.toLocaleDateString()},y=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:m("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:m("history-timeline",u.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxRuntime.jsxs("option",{value:h,children:[On(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((b,x)=>{let D=i.has(b.id),N=s===b.id,C=Pp(b.type);return jsxRuntime.jsxs("div",{"data-event-id":b.id,className:m("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(b),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:On(b.type)})}),x<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),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:[u.showAvatars&&b.userAvatar&&jsxRuntime.jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Rn(b)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),k(b.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),b.metadata&&Object.keys(b.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(b.metadata).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Ap({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:m("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:m("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&On(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Rn(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:f=>l(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsxRuntime.jsx("div",{className:m("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:Rn(f)},f.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:c.map(f=>jsxRuntime.jsxs("button",{className:m("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>u(f),children:[f,"x"]},f))})]}),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(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:m("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function sd(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 id(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 Lp(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 Ip(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function n2(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let v=c.x-f.x,k=c.y-f.y,g=Math.sqrt(v*v+k*k)||1,y=o.chargeStrength*i/(g*g);c.vx+=v/g*y,c.vy+=k/g*y;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let f=p.x-d.x,v=p.y-d.y,k=Math.sqrt(f*f+v*v)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Bp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:u}){let i=react.useRef(null),[c,d]=react.useState([]),[p,f]=react.useState(null),[v,k]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(1),[x,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let A=n2(e,t,a.width,a.height,a,150);d(A);},[e,t,a]);let N=react.useCallback((A,ie)=>{a.enableDragging&&(ie.stopPropagation(),f(A));},[a.enableDragging]),C=react.useCallback(A=>{if(!p||!i.current)return;let S=i.current.getBoundingClientRect(),j=(A.clientX-S.left-x.x)/h,le=(A.clientY-S.top-x.y)/h;d(Le=>Le.map(L=>L.id===p?{...L,x:j,y:le,fx:j,fy:le}:L));},[p,h,x]),w=react.useCallback(()=>{f(null);},[]),R=react.useCallback((A,ie)=>{ie.stopPropagation(),l?.({type:"node-click",node:A,position:{x:ie.clientX,y:ie.clientY}});},[l]),F=react.useCallback((A,ie)=>{ie.stopPropagation(),l?.({type:"edge-click",edge:A,position:{x:ie.clientX,y:ie.clientY}});},[l]),T=react.useCallback(A=>{let ie=c.find(S=>S.id===A);return ie?{x:ie.x,y:ie.y}:{x:0,y:0}},[c]),H=react.useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ie=A.card.priority;return ie==="URGENT"?"#ef4444":ie==="HIGH"?"#f59e0b":ie==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:m("relationships-graph-empty",u),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:m("relationships-graph",u),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:()=>b(A=>Math.min(A+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(A=>A.type))).map(A=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:sd(A)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Lp(A)," ",id(A)]})]},A))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:C,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let ie=T(typeof A.source=="string"?A.source:A.source.id),S=T(typeof A.target=="string"?A.target:A.target.id),j=Ip(A.type),le=g===A.id,Le=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:m("relationships-graph-edge",le&&"hovered",Le&&"critical"),onMouseEnter:()=>y(A.id),onMouseLeave:()=>y(null),onClick:L=>F(A,L),children:[jsxRuntime.jsx("line",{x1:ie.x,y1:ie.y,x2:S.x,y2:S.y,stroke:sd(A.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:le?1:.6,markerEnd:j?"url(#arrowhead)":void 0}),a.showEdgeLabels&&le&&jsxRuntime.jsx("text",{x:(ie.x+S.x)/2,y:(ie.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:id(A.type)})]},A.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(A=>{let ie=v===A.id,S=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:m("relationships-graph-node",ie&&"hovered",S&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:j=>N(A.id,j),onMouseEnter:()=>k(A.id),onMouseLeave:()=>k(null),onClick:j=>R(A,j),children:[jsxRuntime.jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:H(A),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:ie?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:A.card.title.length>20?A.card.title.substring(0,20)+"...":A.card.title})]},A.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 $p({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,u]=react.useState(false),[i,c]=react.useState(null),[d,p]=react.useState(null),f=react.useRef(null),v=l||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let k=()=>{v||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){u(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{u(false);}}},y=()=>{d&&(a(d),k());};return e?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-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:k,disabled:v,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((h,b)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),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((h,b)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),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:f,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,b)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&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:v,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:y,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:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ld={"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 i2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},l2={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 d2(e,t,a){let r=ld[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function $n(e){return `$${e.toFixed(4)}`}var dd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=d2(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,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),u=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:u,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Eo=new dd;function Hp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Eo.getStats()),[s,n]=react.useState(Eo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(Eo.getStats()),n(Eo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),react.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let l=Eo.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:u=>u.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:$n(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(([u,i])=>{let c=r.costsByFeature[u]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:$n(c)})]})]}),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}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:$n(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 Vp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[u,i]=react.useState(""),[c,d]=react.useState(""),[p,f]=react.useState(false),[v,k]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(null),x=react.useRef(null),D=p||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let F=T=>{T.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),k(null),y(null),b(null),t());},C=async()=>{if(!(!n.trim()||D)){f(true),k(null),y(null),b(null);try{let F=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:c||void 0});y(F.tasks.tasks),b({from_cache:F.from_cache,tokens_used:F.tokens_used,mock_mode:F.mock_mode,similarity:F.similarity,tokens_saved:F.tokens_saved});}catch(F){k(F instanceof Error?F.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{g&&(a(g),N());};if(!e)return null;let R=h?.similarity?((h.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:N}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((F,T)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",T+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:F.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"})]}),F.start," \u2192 ",F.end]}),jsxRuntime.jsxs("span",{children:[F.duration," days"]}),F.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",F.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${F.priority==="high"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:F.priority})]})},F.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:F=>l(F.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:F=>i(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:F=>d(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((F,T)=>jsxRuntime.jsx("button",{onClick:()=>l(F),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:F},T))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:C,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Qs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Kn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=react.useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(F=>F.id===g);if(!x)return b;let D=x.columnId,N={...x,columnId:y,position:h},C=b.cards.map(F=>F.id===g?N:F),w=b.columns.map(F=>{if(F.id===D)return {...F,cardIds:F.cardIds.filter(T=>T!==g)};if(F.id===y){let T=C.filter(H=>H.columnId===y).sort((H,A)=>H.position-A.position);return {...F,cardIds:T.map(H=>H.id)}}return F}),R={...b,cards:C,columns:w};return o(R),R});},[o]),n=react.useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(D=>D.id===g?{...D,...y}:D),x={...h,cards:b};return o(x),x});},[o]),l=react.useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,y]}:N),D={...h,cards:[...h.cards,b],columns:x};return o(D),D});},[o]),u=react.useCallback(async g=>{r(y=>{let h=y.cards.find(N=>N.id===g);if(!h)return y;let b=y.cards.filter(N=>N.id!==g),x=y.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(C=>C!==g)}:N),D={...y,cards:b,columns:x};return o(D),D});},[o]),i=react.useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),c=react.useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(D=>D.id===g?{...D,...y}:D),x={...h,columns:b};return o(x),x});},[o]),d=react.useCallback(async g=>{r(y=>{let h=y.cards.filter(D=>D.columnId!==g),b=y.columns.filter(D=>D.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=react.useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),y},[l]),f=react.useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=react.useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:f,deleteCard:u,deleteColumn:d,clearBoard:v}}}function jp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Qs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??c+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 Un={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},qp={by:"none",order:"asc"};function Yp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Un,...e}),[s,n]=react.useState({...qp,...t}),l=react.useCallback(k=>{o(g=>({...g,...k}));},[]),u=react.useCallback(k=>{n(g=>({...g,...k}));},[]),i=react.useCallback(()=>{o(Un),n(qp);},[]),c=react.useCallback(()=>{a&&o({...Un,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Un,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...Un,priorities:["HIGH","URGENT"]});},[]),f=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]),v=react.useCallback(k=>{let g=[...k];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),D=`${h}-${b}-${x}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let C=N.endDate||N.dueDate;if(!C)return false;let w;if(typeof C=="string")w=C.split("T")[0]||C;else {let R=C.getUTCFullYear(),F=String(C.getUTCMonth()+1).padStart(2,"0"),T=String(C.getUTCDate()).padStart(2,"0");w=`${R}-${F}-${T}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let R=new Date(D+"T00:00:00"),F=new Date(w+"T00:00:00"),T=new Date(R);return T.setDate(T.getDate()+7),F>=R&&F<=T;case "custom":if(r.dateRange){let H=typeof C=="string"?new Date(C):C;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;b=x-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=N[y.priority||"LOW"],w=N[h.priority||"LOW"];b=C-w;break;case "dueDate":let R=y.endDate||y.dueDate,F=h.endDate||h.dueDate;if(!R)return 1;if(!F)return -1;let T=typeof R=="string"?new Date(R).getTime():R.getTime(),H=typeof F=="string"?new Date(F).getTime():F.getTime();b=T-H;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let A=y.estimatedTime||0,ie=h.estimatedTime||0;b=A-ie;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var Jp,Zp;if(typeof window<"u")try{let e=Vn("ai");Jp=e.generateObject,Zp=e.generateText;}catch{}function Qp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Jp&&Zp&&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(p){let f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),u=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(p){let f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}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("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function ud(){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 eg(e){let{cards:t}=e,[a,r]=ud(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let k=t.find(y=>y.id===d),g=t.find(y=>y.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let y=t.filter(w=>w.columnId===k.columnId).sort((w,R)=>w.position-R.position),h=y.findIndex(w=>w.id===a.lastSelectedCardId),b=y.findIndex(w=>w.id===d),[x,D]=h<b?[h,b]:[b,h],N=y.slice(x,D+1).map(w=>w.id),C=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:C,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(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:u,toggleCard:i,getSelectedCards:c}}var tg={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function ag(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...tg,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((k,g,y,h,b)=>{if(g.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:k,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(D=>D.columnId===y).length,createdAt:new Date};n(D=>[...D,x]);},[o.minCardsPerStack,s]),u=react.useCallback(k=>{n(g=>g.filter(y=>y.id!==k));},[]),i=react.useCallback(k=>{n(g=>g.map(y=>y.id===k?{...y,isExpanded:!y.isExpanded}:y));},[]),c=react.useCallback((k,g)=>{n(y=>y.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((k,g)=>{n(y=>y.map(h=>{if(h.id===k){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(k=>s.filter(g=>g.columnId===k).sort((g,y)=>g.position-y.position),[s]),f=react.useCallback(async k=>{let g=t.filter(D=>D.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(C=>C.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let b=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(C=>C.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(D=>{D.priority&&(x.has(D.priority)||x.set(D.priority,[]),x.get(D.priority).push(D));}),x.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";y.push({stack:{title:`${C} ${N} Priority`,cardIds:D.map(w=>w.id),columnId:k,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let C=(await r.findSimilar(D,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(C.length>=o.minCardsPerStack-1){let w=[D.id,...C.map(F=>F.card.id)],R=C.reduce((F,T)=>F+T.similarity,0)/C.length;y.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:R});}}return y.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:l,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var rg=react.createContext(null);function og({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=Vn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=Vn("@libxai/core");n.set(u.id,new i(u));});let l=null;if(t?.board){let{Board:u}=Vn("@libxai/core");l=new u(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(rg.Provider,{value:{store:o},children:e})}function ei(){let e=react.useContext(rg);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Hn(){let e=ei(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(h=>{e.updateBoard(h);},[e]),u=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,b)=>{e.updateColumn(h,b);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),f=react.useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=react.useCallback(h=>{e.deleteCard(h);},[e]),k=react.useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),y=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:f,deleteCard:v,moveCard:k,getCard:g,getCardsByColumn:y}}function sg(e){let{cards:t}=Hn();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 ig(e="position",t="asc"){let{cards:a}=Hn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ti=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},D2=new ti;function dg({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:u}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:f,children:d.map(v=>{let k=e[v.index];if(!k)return null;let g=u?u(k,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:r(k,v.index)},g)})})})}function cg(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 mg({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:u,horizontal:i=true}){let c=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:f,className:s,children:jsxRuntime.jsx("div",{style:v,children:p.map(k=>{let g=e[k.index];if(!g)return null;let y=u?u(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},y)})})})}function pg(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 gg(e,t=10){return e>t}var fd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},hd={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},bd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},yd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},vd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},xd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},kd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},wd={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)"},Cd={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)"},Td={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Nd={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}},Dd={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}},ai={spacing:fd,borderRadius:hd,fontSize:bd,fontWeight:yd,lineHeight:vd,zIndex:xd,duration:kd,easing:wd,shadows:Cd,opacity:Td,kanban:Nd,gantt:Dd};function fg(e,t,a){return e[t]??a}function Sd(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)?Sd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function P2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ed(e="asakaa"){let t=Sd(ai),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=P2(o);a.push(` ${s}: ${n};`);}return `:root {
404
404
  ${a.join(`
405
405
  `)}
406
- }`}function Jn(e,t="asakaa"){let a=[],r=Gd(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
406
+ }`}function Wn(e,t="asakaa"){let a=[],r=Sd(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
407
407
  ${a.join(`
408
408
  `)}
409
- }`}var fi={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"}},_d={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"}},jd={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 Kd(e=fi,t="asakaa"){let a=Vd(t),r=Jn(e,t);return `${a}
409
+ }`}var ri={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"}},Pd={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"}},Md={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 Fd(e=ri,t="asakaa"){let a=Ed(t),r=Wn(e,t);return `${a}
410
410
 
411
- ${r}`}function Kg(){return `/**
411
+ ${r}`}function hg(){return `/**
412
412
  * ASAKAA Design Tokens
413
413
  * Auto-generated from design-tokens.ts
414
414
  * Do not edit this file directly
415
415
  */
416
416
 
417
- ${Kd(fi)}
417
+ ${Fd(ri)}
418
418
 
419
419
  /* Light theme */
420
420
  [data-theme="light"] {
421
- ${Jn(_d,"asakaa").split(`
421
+ ${Wn(Pd,"asakaa").split(`
422
422
  `).slice(1,-1).join(`
423
423
  `)}
424
424
  }
425
425
 
426
426
  /* Neutral theme */
427
427
  [data-theme="neutral"] {
428
- ${Jn(jd,"asakaa").split(`
428
+ ${Wn(Md,"asakaa").split(`
429
429
  `).slice(1,-1).join(`
430
430
  `)}
431
431
  }
432
- `}var v1=({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 Yg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Zo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,c])=>{let u=n,i=u===r;return jsxRuntime.jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(v1,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},u)})})}
433
- 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=yg;exports.AI_FEATURES=Z2;exports.AI_MODELS=Td;exports.AddCardButton=Yi;exports.AddColumnButton=Ki;exports.AttachmentUploader=Br;exports.BoardProvider=Bg;exports.BulkOperationsToolbar=Cs;exports.BurnDownChart=sl;exports.CUSTOM_FIELD_TYPES=_p;exports.CalendarBoard=ag;exports.Card=Hr;exports.CardDetailModal=el;exports.CardDetailModalV2=rl;exports.CardHistoryReplay=dg;exports.CardHistoryTimeline=ig;exports.CardRelationshipsGraph=mg;exports.CardStack=G2;exports.CardTemplateSelector=pl;exports.CircuitBreaker=Ni;exports.Column=_o;exports.ColumnManager=Fs;exports.CommandPalette=Ji;exports.ConfigMenu=hl;exports.ContextMenu=tn;exports.DEFAULT_SHORTCUTS=Tn;exports.DEFAULT_TABLE_COLUMNS=Gp;exports.DEFAULT_TEMPLATES=ml;exports.DateRangePicker=un;exports.DependenciesSelector=pn;exports.DependencyLine=An;exports.DistributionCharts=il;exports.EditableColumnTitle=Li;exports.ErrorBoundary=Yo;exports.ExportImportModal=fl;exports.FilterBar=bl;exports.GANTT_AI_SYSTEM_PROMPT=Nm;exports.GanttAIAssistant=Gs;exports.GanttBoard=vm;exports.GanttI18nContext=en;exports.GanttMilestone=$s;exports.GanttToolbar=Ps;exports.GenerateGanttTasksDialog=kg;exports.GeneratePlanModal=fg;exports.GroupBySelector=cl;exports.HealthBar=Ui;exports.KanbanBoard=eo;exports.KanbanToolbar=_i;exports.KanbanViewAdapter=kn;exports.KeyboardShortcutsHelp=ul;exports.ListView=Wp;exports.MenuIcons=Ut;exports.PluginManager=pi;exports.PrioritySelector=vo;exports.ProfitabilityReport=zi;exports.RATE_LIMITS=J2;exports.STANDARD_FIELDS=Vp;exports.SwimlaneBoardView=ll;exports.TagBadge=Bi;exports.TagList=Wc;exports.TagPicker=Zr;exports.TaskBar=Rs;exports.TaskDetailModal=zr;exports.TaskFormModal=Tm;exports.TaskGrid=Is;exports.ThemeModal=kl;exports.ThemeProvider=Ou;exports.ThemeSwitcher=Yg;exports.TimeInputPopover=Fr;exports.TimePill=Ri;exports.TimePopover=Oi;exports.Timeline=Us;exports.UserAssignmentSelector=wo;exports.VelocityChart=nl;exports.VirtualGrid=Gg;exports.VirtualList=Ug;exports.aiUsageTracker=Bo;exports.borderRadius=Ad;exports.calculatePosition=ts;exports.calendarDarkTheme=xd;exports.calendarEnTranslations=md;exports.calendarEsTranslations=pd;exports.calendarLightTheme=vd;exports.calendarNeutralTheme=kd;exports.calendarThemes=li;exports.calendarTranslations=ni;exports.cardToGanttTask=js;exports.cardsToGanttTasks=Am;exports.cn=d;exports.createKanbanView=bu;exports.createRetryWrapper=w0;exports.darkTheme=yl;exports.darkTokenTheme=fi;exports.defaultTheme=Ns;exports.designTokens=gi;exports.duration=Od;exports.easing=$d;exports.exportTokensToCSS=Kg;exports.findTaskByName=Kr;exports.fontSize=Ld;exports.fontWeight=Id;exports.formatCost=Kn;exports.ganttEnTranslations=Ss;exports.ganttEsTranslations=Hu;exports.ganttTaskToCardUpdate=Fm;exports.ganttThemes=ot;exports.ganttTokens=Wd;exports.ganttTranslations=wl;exports.ganttUtils=Le;exports.generateCSSVariables=Vd;exports.generateCompleteCSS=Kd;exports.generateInitialPositions=y0;exports.generateTasksContext=Dm;exports.generateThemeVariables=Jn;exports.getCalendarTheme=rg;exports.getCalendarTranslations=zn;exports.getListViewTheme=jp;exports.getListViewTranslations=jl;exports.getMonthNames=Kp;exports.getToken=jg;exports.getTranslations=Uu;exports.getWeekdayNames=Yp;exports.kanbanTokens=zd;exports.lightTheme=xl;exports.lightTokenTheme=_d;exports.lineHeight=Bd;exports.listViewDarkTheme=dd;exports.listViewEnTranslations=Vl;exports.listViewEsTranslations=_l;exports.listViewLightTheme=cd;exports.listViewNeutralTheme=ud;exports.listViewThemes=oi;exports.listViewTranslations=Ks;exports.mergeCalendarTranslations=si;exports.mergeListViewTranslations=Ys;exports.mergeTranslations=Cl;exports.neutralTheme=vl;exports.neutralTokenTheme=jd;exports.opacity=Ud;exports.parseLocalCommand=Mm;exports.parseNaturalDate=zl;exports.parseNaturalDuration=Wl;exports.parseProgress=Gl;exports.parseStatus=Em;exports.pluginManager=b1;exports.retrySyncOperation=k0;exports.retryWithBackoff=as;exports.shadows=Hd;exports.shouldVirtualizeGrid=_g;exports.spacing=Fd;exports.themes=Eo;exports.useAI=Pg;exports.useBoard=Cg;exports.useBoardCore=Xn;exports.useBoardStore=mi;exports.useCardStacking=Lg;exports.useDragState=Gi;exports.useFilteredCards=Og;exports.useFilters=Dg;exports.useGanttI18n=no;exports.useKanbanState=ui;exports.useKeyboardShortcuts=Iu;exports.useMultiSelect=Fg;exports.useSelectionState=Sd;exports.useSortedCards=$g;exports.useTheme=Zo;exports.useVirtualGrid=Vg;exports.useVirtualList=zg;exports.validateAIResponse=Pm;exports.withErrorBoundary=qi;exports.wouldCreateCircularDependency=os;exports.zIndex=Rd;//# sourceMappingURL=index.cjs.map
432
+ `}var M2=({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 bg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=jo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let u=n,i=u===r;return jsxRuntime.jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(M2,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},u)})})}
433
+ 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=Hp;exports.AI_FEATURES=l2;exports.AI_MODELS=ld;exports.AddCardButton=Ri;exports.AddColumnButton=Bi;exports.AttachmentUploader=Er;exports.BoardProvider=og;exports.BulkOperationsToolbar=gs;exports.BurnDownChart=qi;exports.CUSTOM_FIELD_TYPES=gp;exports.CalendarBoard=Np;exports.Card=Lr;exports.CardDetailModal=Wi;exports.CardDetailModalV2=_i;exports.CardHistoryReplay=Ap;exports.CardHistoryTimeline=Mp;exports.CardRelationshipsGraph=Bp;exports.CardStack=Qx;exports.CardTemplateSelector=tl;exports.CircuitBreaker=pi;exports.Column=$o;exports.ColumnManager=ks;exports.CommandPalette=Ui;exports.ConfigMenu=nl;exports.ContextMenu=Yo;exports.DEFAULT_SHORTCUTS=vn;exports.DEFAULT_TABLE_COLUMNS=mp;exports.DEFAULT_TEMPLATES=el;exports.DateRangePicker=nn;exports.DependenciesSelector=ln;exports.DependencyLine=Dn;exports.DistributionCharts=Yi;exports.EditableColumnTitle=ki;exports.ErrorBoundary=Wo;exports.ExportImportModal=rl;exports.FilterBar=ol;exports.GANTT_AI_SYSTEM_PROMPT=om;exports.GanttAIAssistant=Ls;exports.GanttBoard=Qu;exports.GanttI18nContext=qo;exports.GanttMilestone=Es;exports.GanttToolbar=xs;exports.GenerateGanttTasksDialog=Vp;exports.GeneratePlanModal=$p;exports.GroupBySelector=Zi;exports.HealthBar=Ei;exports.KanbanBoard=Yr;exports.KanbanToolbar=Li;exports.KanbanViewAdapter=hn;exports.KeyboardShortcutsHelp=Qi;exports.ListView=up;exports.MenuIcons=Lt;exports.PluginManager=ti;exports.PrioritySelector=po;exports.ProfitabilityReport=Pi;exports.RATE_LIMITS=i2;exports.STANDARD_FIELDS=pp;exports.SwimlaneBoardView=Xi;exports.TagBadge=Ci;exports.TagList=Dc;exports.TagPicker=Kr;exports.TaskBar=Ds;exports.TaskDetailModal=Br;exports.TaskFormModal=rm;exports.TaskGrid=Ts;exports.ThemeModal=dl;exports.ThemeProvider=ku;exports.ThemeSwitcher=bg;exports.TimeInputPopover=yo;exports.TimePill=Ti;exports.TimePopover=Ni;exports.Timeline=Ms;exports.UserAssignmentSelector=fo;exports.VelocityChart=Ki;exports.VirtualGrid=mg;exports.VirtualList=dg;exports.aiUsageTracker=Eo;exports.borderRadius=hd;exports.calculatePosition=jn;exports.calendarDarkTheme=rd;exports.calendarEnTranslations=Ql;exports.calendarEsTranslations=ed;exports.calendarLightTheme=od;exports.calendarNeutralTheme=nd;exports.calendarThemes=Xs;exports.calendarTranslations=qs;exports.cardToGanttTask=Rs;exports.cardsToGanttTasks=um;exports.cn=m;exports.createKanbanView=eu;exports.createRetryWrapper=_g;exports.darkTheme=sl;exports.darkTokenTheme=ri;exports.defaultTheme=hs;exports.designTokens=ai;exports.duration=kd;exports.easing=wd;exports.exportTokensToCSS=hg;exports.findTaskByName=Hr;exports.fontSize=bd;exports.fontWeight=yd;exports.formatCost=$n;exports.ganttEnTranslations=ys;exports.ganttEsTranslations=Cu;exports.ganttTaskToCardUpdate=cm;exports.ganttThemes=st;exports.ganttTokens=Dd;exports.ganttTranslations=cl;exports.ganttUtils=Te;exports.generateCSSVariables=Ed;exports.generateCompleteCSS=Fd;exports.generateInitialPositions=Hg;exports.generateTasksContext=nm;exports.generateThemeVariables=Wn;exports.getCalendarTheme=Dp;exports.getCalendarTranslations=In;exports.getListViewTheme=fp;exports.getListViewTranslations=Rl;exports.getMonthNames=hp;exports.getToken=fg;exports.getTranslations=Tu;exports.getWeekdayNames=bp;exports.kanbanTokens=Nd;exports.lightTheme=il;exports.lightTokenTheme=Pd;exports.lineHeight=vd;exports.listViewDarkTheme=Xl;exports.listViewEnTranslations=Il;exports.listViewEsTranslations=Bl;exports.listViewLightTheme=Jl;exports.listViewNeutralTheme=Zl;exports.listViewThemes=Ks;exports.listViewTranslations=Os;exports.mergeCalendarTranslations=Ys;exports.mergeListViewTranslations=$s;exports.mergeTranslations=ul;exports.neutralTheme=ll;exports.neutralTokenTheme=Md;exports.opacity=Td;exports.parseLocalCommand=lm;exports.parseNaturalDate=Fl;exports.parseNaturalDuration=Al;exports.parseProgress=Ll;exports.parseStatus=im;exports.pluginManager=D2;exports.retrySyncOperation=Vg;exports.retryWithBackoff=Kn;exports.shadows=Cd;exports.shouldVirtualizeGrid=gg;exports.spacing=fd;exports.themes=ko;exports.useAI=Qp;exports.useBoard=jp;exports.useBoardCore=Hn;exports.useBoardStore=ei;exports.useCardStacking=ag;exports.useDragState=Fi;exports.useFilteredCards=sg;exports.useFilters=Yp;exports.useGanttI18n=eo;exports.useKanbanState=Qs;exports.useKeyboardShortcuts=yu;exports.useMultiSelect=eg;exports.useSelectionState=ud;exports.useSortedCards=ig;exports.useTheme=jo;exports.useVirtualGrid=pg;exports.useVirtualList=cg;exports.validateAIResponse=dm;exports.withErrorBoundary=Oi;exports.wouldCreateCircularDependency=Yn;exports.zIndex=xd;//# sourceMappingURL=index.cjs.map
434
434
  //# sourceMappingURL=index.cjs.map