@libxai/board 0.17.359 → 0.17.360
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 +23 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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'),xc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),_u=require('react-markdown'),Vu=require('remark-gfm'),ju=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var xc__default=/*#__PURE__*/_interopDefault(xc);var _u__default=/*#__PURE__*/_interopDefault(_u);var Vu__default=/*#__PURE__*/_interopDefault(Vu);var ju__default=/*#__PURE__*/_interopDefault(ju);var
|
|
2
|
-
`)}async function mp(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 xc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=n.toDataURL("image/png"),p=297,i=210,u=n.width/n.height,d=p-20,g=d/u;g>i-20&&(g=i-20,d=g*u);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,p,15,"F"),f.text(e.title||"Kanban Board",10,10);let
|
|
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'),xc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),_u=require('react-markdown'),Vu=require('remark-gfm'),ju=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var xc__default=/*#__PURE__*/_interopDefault(xc);var _u__default=/*#__PURE__*/_interopDefault(_u);var Vu__default=/*#__PURE__*/_interopDefault(Vu);var ju__default=/*#__PURE__*/_interopDefault(ju);var Zo=(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 Qo=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 [Qo.Translate.toString(e),Qo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function h(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function en(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 rp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function os(e,t){return e.length===0?1e3:t===0?en(null,e[0].position):t>=e.length?en(e[e.length-1].position,null):en(e[t-1].position,e[t].position)}function Cl(e,t=100){return e>t}var op=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 np(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 tn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=op,onRetry:m}=t,p,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(p=d,u===a||!n(p,u))return {error:p,attempts:i,success:false};let f=np(u,r,o,s);if(m)try{m(p,u,f);}catch(C){console.error("Error in retry callback:",C);}await new Promise(C=>setTimeout(C,f));}}return {error:p||new Error("Unknown error"),attempts:i,success:false}}function sp(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 ip(e,t={}){return async(...a)=>tn(()=>e(...a),t)}var ns=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 Tl=(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))(Tl||{}),$r=class $r{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,m=`[${a}] [${r}] [${s}]`,p=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(m,o,p?n:"");break;case "INFO":console.info(m,o,p?n:"");break;case "WARN":console.warn(m,o,p?n:"");break;case "ERROR":console.error(m,o,p?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",...$r.globalOptions};}static configure(t){$r.globalOptions={...$r.globalOptions,...t};}child(t){return new $r({...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 an((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new an(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Tl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};$r.globalOptions={};var ss=$r,an=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}},Nl=new ss;function dp(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 cp(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(m=>m.id===s.columnId);return [s.id,is(s.title),is(s.description||""),is(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 mp(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 xc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=n.toDataURL("image/png"),p=297,i=210,u=n.width/n.height,d=p-20,g=d/u;g>i-20&&(g=i-20,d=g*u);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,p,15,"F"),f.text(e.title||"Kanban Board",10,10);let C=(p-d)/2;return f.addImage(m,"PNG",C,20,d,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 m=e.cards.filter(p=>p.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,m.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):m.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(p.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(p.priority&&i.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&i.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&i.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let u=[];p.startDate&&u.push(`Start: ${p.startDate}`),p.endDate&&u.push(`End: ${p.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function is(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function Sl(e,t,a,r){switch(t){case "json":return dp(e,r);case "csv":return cp(e);case "pdf":return await mp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function El(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},m=new Blob([e],{type:n[t]}),p=URL.createObjectURL(m),i=document.createElement("a");i.href=p,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(p);}function pp(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 up(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=Pl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let m=Pl(t[n]||"");if(m.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((f,T)=>{i[f]=m[T]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={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(g),d.cardIds.push(g.id);}catch(m){s.push(`Line ${n+1}: ${m instanceof Error?m.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 Pl(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 Ml(e,t){switch(t){case "json":return pp(e);case "csv":return up(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Al(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 ls=react.createContext(null);function Fl(){return react.useContext(ls)}var Ll=react.createContext(null);function Il({children:e,themeName:t}){return jsxRuntime.jsx(Ll.Provider,{value:{themeName:t},children:e})}function oo(){return react.useContext(Ll)}function gt({children:e,container:t}){let[a,r]=react.useState(false),o=Fl(),s=oo();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:m,themeName:p}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"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 zl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},kp="#BDC3C7",wp=({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 Or({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),m=react.useRef(null),p=react.useRef(null),i=()=>{if(!p.current)return;let f=p.current.getBoundingClientRect(),T=window.innerHeight,N=window.innerWidth,c=160,b=220,v=4,l=f.right-c;l<10&&(l=f.left),l+c>N-10&&(l=N-c-10);let k=T-f.bottom,y=f.top,D;k>=b+v?D=f.bottom+v:y>=b+v?D=f.top-b-v:D=k>=y?f.bottom+v:Math.max(10,f.top-b-v),n({top:D,left:l}),o(true);};react.useEffect(()=>{let f=T=>{m.current&&!m.current.contains(T.target)&&!p.current?.contains(T.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let u=f=>{t(f),o(false);},d=e?zl[e]:null,g=d?.color||kp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,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: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:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:m,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(zl).map(([f,T])=>jsxRuntime.jsxs("button",{onClick:()=>u(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:T.color,background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:N=>{N.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(wp,{color:T.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:T.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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Cp=[{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 No({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),p=react.useRef(null),i=react.useRef(null),g=(oo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),k=window.innerHeight,y=window.innerWidth,D=320,x=380,w=4,B=l.left;B+D>y-10&&(B=y-D-10),B<10&&(B=10);let M=k-l.bottom,S=l.top,U;M>=x+w?U=l.bottom+w:S>=x+w?U=l.top-x-w:U=M>=S?l.bottom+w:Math.max(10,l.top-x-w),m({top:U,left:B}),s(true);};react.useEffect(()=>{let l=k=>{p.current&&!p.current.contains(k.target)&&!i.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),react.useEffect(()=>{let l=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let T=l=>{let k=new Date,y=B=>{let M=B.getFullYear(),S=String(B.getMonth()+1).padStart(2,"0"),U=String(B.getDate()).padStart(2,"0");return `${M}-${S}-${U}`},D=y(k),x=new Date(k);x.setDate(x.getDate()+l);let w=y(x);a(D,w),s(false);},N=()=>{if(!e||!t)return "Set date";let l=x=>{if(x instanceof Date)return x;if(typeof x!="string"||!x.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=x.split("-").map(Number);if(w.length!==3||w.some(U=>isNaN(U)))return null;let B=w[0],M=w[1],S=w[2];return B===void 0||M===void 0||S===void 0?null:new Date(B,M-1,S)},k=l(e),y=l(t);if(!k||!y||isNaN(k.getTime())||isNaN(y.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[k.getMonth()]} ${k.getDate()} \u2013 ${D[y.getMonth()]} ${y.getDate()}`},c=e&&t,v=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),l<k})();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 ${v?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${N()}`:"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:N()})]}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:p,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:Cp.map(l=>jsxRuntime.jsx("button",{onClick:()=>T(l.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:k=>{k.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.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:l=>a(l.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:l=>a(e,l.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:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Ur({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[m,p]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let v=g.current.getBoundingClientRect(),l=window.innerHeight,k=window.innerWidth,y=300,D=380,x=4,w=v.right-y;w<10&&(w=v.left),w+y>k-10&&(w=k-y-10);let B=l-v.bottom,M=v.top,S;B>=D+x?S=v.bottom+x:M>=D+x?S=v.top-D-x:S=B>=M?v.bottom+x:Math.max(10,v.top-D-x),u({top:S,left:w}),n(true);};react.useEffect(()=>{let v=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),p(""));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),react.useEffect(()=>{let v=l=>{l.key==="Escape"&&(n(false),p(""));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]);let T=v=>{let l=e.some(k=>k.id===v.id);a(l?e.filter(k=>k.id!==v.id):[...e,v]);},N=t.filter(v=>v.name.toLowerCase().includes(m.toLowerCase())),c=e.slice(0,o),b=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:[c.map(v=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:v.name,children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"asakaa-avatar-img"}):v.initials},v.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(gt,{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:m,onChange:v=>p(v.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:N.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"}):N.map(v=>{let l=e.some(k=>k.id===v.id);return jsxRuntime.jsxs("button",{onClick:()=>T(v),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.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:v.color,color:"#fff"},children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.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:v.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},v.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 rn(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let i=p.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,m=p=>{if(!s.has(p)){s.add(p),n.add(p);let i=r.get(p)||[];for(let u of i){if(!s.has(u)&&m(u))return true;if(n.has(u))return true}}return n.delete(p),false};return m(a)}function So({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[m,p]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(t.length>0),[f,T]=react.useState({top:0,left:0}),[N,c]=react.useState(null),b=react.useRef(null),v=react.useRef(null),l=()=>{if(!v.current)return;let w=v.current.getBoundingClientRect(),B=window.innerHeight,M=window.innerWidth,S=300,U=d?380:120,$=4,j=w.right-S;j<10&&(j=w.left),j+S>M-10&&(j=M-S-10);let K=B-w.bottom,be=w.top,ze;K>=U+$?ze=w.bottom+$:be>=U+$?ze=w.top-U-$:ze=K>=be?w.bottom+$:Math.max(10,w.top-U-$),T({top:ze,left:j}),p(true);};react.useEffect(()=>{if(!m||!v.current)return;let w=v.current.getBoundingClientRect(),B=window.innerHeight,M=window.innerWidth,S=300,U=d?380:120,$=4,j=w.right-S;j<10&&(j=w.left),j+S>M-10&&(j=M-S-10);let K=B-w.bottom,be=w.top,ze;K>=U+$?ze=w.bottom+$:be>=U+$?ze=w.top-U-$:ze=K>=be?w.bottom+$:Math.max(10,w.top-U-$),T({top:ze,left:j});},[d,m]),react.useEffect(()=>{let w=B=>{b.current&&!b.current.contains(B.target)&&!v.current?.contains(B.target)&&(p(false),u(""));};if(m)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[m]),react.useEffect(()=>{let w=B=>{B.key==="Escape"&&(p(false),u(""));};if(m)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[m]);let k=w=>{let B=t.includes(w),M=a.find(S=>S.id===w);if(c(null),B){let S=t.filter(U=>U!==w);r(S),S.length===0&&g(false);}else {if(s&&rn(a,w,e)){let U=`Cannot add "${M?.title||w}" as dependency - would create circular reference`;c(U),n?.(w,M?.title||w),setTimeout(()=>c(null),3e3);return}r([...t,w]),g(true);}},y=()=>{let w=!d;g(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),x=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:v,onClick:()=>m?p(false):l(),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:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:x},children:t.length})]}),m&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:b,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:[N&&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:N})]}),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:y,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=>u(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:D.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"}):D.map(w=>{let B=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>k(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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),p(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 pr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:m=[],allCards:p=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:f,isDragging:T}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),N={transform:Zo.Transform.toString(g),transition:f};if(t)return jsxRuntime.jsx("div",{ref:d,style:N,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=m.filter(k=>e.assignedUserIds?.includes(k.id)),b=e.progress===100,v=(e.attachments||[]).filter(k=>k.type.startsWith("image/")),l={...N,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:l,className:h("asakaa-card",T&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:k=>{k.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:k=>{k.currentTarget.style.display="none";}})}),v.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:v.length===1&&v[0]?jsxRuntime.jsx("img",{src:v[0].url,alt:v[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:k=>{k.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:v.slice(0,4).map((k,y)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:k.url,alt:k.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),y===3&&v.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:["+",v.length-4]})})]},k.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Or,{priority:e.priority,onChange:k=>n?.(e.id,{priority:k})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(No,{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:(k,y)=>n?.(e.id,{startDate:k,endDate:y})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ur,{assignedUsers:c,availableUsers:m,onChange:k=>n?.(e.id,{assignedUserIds:k.map(y=>y.id)})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(So,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(k=>typeof k=="string"?k:k.taskId):[],availableTasks:p,onChange:k=>n?.(e.id,{dependencies:k})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(k=>jsxRuntime.jsx("span",{className:"asakaa-label",children:k},k))}),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)));pr.displayName="Card";var on={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"}},ql=({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 Xl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),p=react.useRef(null),i=react.useRef(null),u=[...Object.entries(on).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(on).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=on[e];if(c)return {...c,id:e};let b=r.find(v=>v.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...on.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,v=window.innerWidth,l=180,k=280,y=4,D=c.right-l;D<10&&(D=c.left),D+l>v-10&&(D=v-l-10);let x=b-c.bottom,w=c.top,B;x>=k+y?B=c.bottom+y:w>=k+y?B=c.top-k-y:B=x>=w?c.bottom+y:Math.max(10,c.top-k-y),m({top:B,left:D}),s(true);};react.useEffect(()=>{let c=b=>{p.current&&!p.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),react.useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let f=c=>{t(c),s(false);},T=d(),N=T.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:`${N}10`,boxShadow:`0 0 0 2px ${N}30 inset`},title:T.label,children:jsxRuntime.jsx(ql,{icon:T.icon,color:N})}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(c=>jsxRuntime.jsxs("button",{onClick:()=>f(c.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:c.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ql,{icon:c.icon,color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:c.label}),e===c.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"})})]},c.id))})]})})]})}function Jl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[m,p]=react.useState(false),[i,u]=react.useState(e),[d,g]=react.useState({top:0,left:0}),f=react.useRef(null),T=react.useRef(null),N=react.useRef(null);react.useEffect(()=>{if(s&&T.current){let l=T.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),react.useEffect(()=>{let l=k=>{f.current&&!f.current.contains(k.target)&&!T.current?.contains(k.target)&&(n(false),p(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),react.useEffect(()=>{let l=k=>{k.key==="Escape"&&(n(false),p(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),react.useEffect(()=>{m&&N.current&&(N.current.focus(),N.current.select());},[m]);let c=()=>{p(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),p(false),n(false),u(e);},v=l=>{l.key==="Enter"?b():l.key==="Escape"&&(p(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:T,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(gt,{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:m?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:N,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:v,onBlur:b,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:c,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 io=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:m,availableUsers:p,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:f,onColumnRename:T,onColumnDelete:N,isDeletable:c=false,className:b})=>{let{setNodeRef:v,isOver:l}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),y=u??Cl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:y});if(a)return jsxRuntime.jsx("div",{ref:v,className:b,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let S=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:S}:S>=80?{state:"warning",percentage:S}:S>=60?{state:"approaching",percentage:S}:{state:"ok",percentage:S}})(),B=w.state==="exceeded",M=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:h("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:h(M()),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"})]})]}),(T||N)&&jsxRuntime.jsx(Jl,{columnTitle:e.title,onRename:S=>T?.(e.id,S),onDelete:N?()=>N(e.id):void 0,isDeletable:c}),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"})]})]}),!g&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:y?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(S=>S.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"})}):y?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(S=>{let U=t[S.index];return U?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsxRuntime.jsx(pr,{card:U,render:r,onClick:n,onUpdate:m,availableUsers:p,allCards:i})},U.id):null})}):t.map(S=>jsxRuntime.jsx(pr,{card:S,render:r,onClick:n,onUpdate:m,availableUsers:p,allCards:i},S.id))})})]})});io.displayName="Column";function us({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let p=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?p():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:p,onKeyDown:i,className:h("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:h("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var dn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[m,p]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(false),[f,T]=react.useState(dn[10]||"#3B82F6"),[N,c]=react.useState({top:0,left:0}),b=react.useRef(null),v=react.useRef(null),l=react.useRef(null),k=react.useRef(null),y=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),D=t.some(S=>S.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(m&&v.current){let S=v.current.getBoundingClientRect();c({top:S.bottom+6,left:S.left});}},[m]),react.useEffect(()=>{let S=U=>{let $=U.target,j=b.current?.contains($),K=l.current?.contains($);!j&&!K&&(p(false),u(""),g(false));};if(m)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[m]),react.useEffect(()=>{m&&k.current&&k.current.focus();},[m]);let x=S=>{let U=e.some($=>$.id===S.id);a(U?e.filter($=>$.id!==S.id):[...e,S]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let S=await r(i.trim(),f);S&&(a([...e,S]),u(""),T(dn[Math.floor(Math.random()*dn.length)]||"#3B82F6"));}finally{g(false);}}},B=(S,U)=>{U.stopPropagation(),a(e.filter($=>$.id!==S));},M={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:v,type:"button",onClick:()=>!s&&p(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,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:N.top,left:N.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:k,type:"text",value:i,onChange:S=>u(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&i.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${S.color}20`,color:S.color},onClick:U=>B(S.id,U),children:[S.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},S.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:y.length>0?y.map(S=>{let U=e.some($=>$.id===S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>x(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:U?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{U||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{U||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.name}),U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&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:dn.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>T(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:f===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor: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 fs({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 td({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(fs,{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 sr=[{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 sd(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}}return e}function du(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}}function Gr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:m=[],availableTags:p=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:f=[],comments:T=[],onAddComment:N,currentUser:c}){let b=s==="dark",v={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),k=e,[y,D]=react.useState(e?sd(e,m):null),[x,w]=react.useState(false),[B,M]=react.useState(false),[S,U]=react.useState(false),[$,j]=react.useState(null),[K,be]=react.useState(new Date),[ze,st]=react.useState(false),[Ve,Ae]=react.useState(false),[Z,L]=react.useState(""),[C,W]=react.useState(false),[O,R]=react.useState(false),[ne,ce]=react.useState(false),[De,le]=react.useState(""),Be=react.useRef(null),[Se,Fe]=react.useState(""),xe=react.useRef(null),[We,je]=react.useState(""),[z,re]=react.useState(false);react.useEffect(()=>{if(e){let E=sd(e,m);D(E),le(E.description||""),Fe(E.name||"");}},[e?.id,m]),react.useEffect(()=>()=>{Be.current&&clearTimeout(Be.current),xe.current&&clearTimeout(xe.current);},[]);let se=react.useCallback(E=>{D(E),l&&o&&k?o(du(E,k)):r&&r(E);},[l,k,o,r]),Ce=react.useCallback(()=>{w(false),M(false),U(false),j(null),Ae(false),L(""),W(false);},[]),Oe=react.useCallback((E,q)=>{if(!y)return;let ge={...y,[E]:q};se(ge);},[y,se]),at=react.useCallback(E=>{le(E),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(y){let q={...y,description:E};se(q);}},800);},[y,se]),kt=react.useCallback(E=>{Fe(E),xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>{if(y&&E.trim()){let q={...y,name:E.trim()};se(q);}},800);},[y,se]),Le=react.useCallback(async()=>{if(!(!y||!We.trim()||!N)){re(true);try{await N(y.id,We.trim()),je("");}finally{re(false);}}},[y,We,N]),It=react.useCallback(E=>{let q=typeof E=="string"?new Date(E):E,Me=new Date().getTime()-q.getTime(),Ge=Math.floor(Me/6e4),Xe=Math.floor(Me/36e5),Ue=Math.floor(Me/864e5);return Ge<1?n==="es"?"Ahora":"Just now":Ge<60?n==="es"?`Hace ${Ge} min`:`${Ge}m ago`:Xe<24?n==="es"?`Hace ${Xe}h`:`${Xe}h ago`:Ue<7?n==="es"?`Hace ${Ue}d`:`${Ue}d ago`:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Mt=react.useCallback(E=>{if(!y)return;let q=y.progress||0;E==="completed"?q=100:E==="in-progress"&&q===0?q=10:E==="todo"&&(q=0);let ge={...y,status:E,progress:q};se(ge),w(false);},[y,se]),Dt=react.useCallback((E,q)=>{if(!y)return;let ge={...y,startDate:E,endDate:q};se(ge);},[y,se]),Qe=react.useCallback(()=>{let E=K.getFullYear(),q=K.getMonth(),ge=new Date(E,q,1),Ge=new Date(E,q+1,0).getDate(),Xe=ge.getDay(),Ue=[],it=new Date(E,q,0).getDate();for(let _=Xe-1;_>=0;_--)Ue.push({date:new Date(E,q-1,it-_),isCurrentMonth:false});for(let _=1;_<=Ge;_++)Ue.push({date:new Date(E,q,_),isCurrentMonth:true});let mt=42-Ue.length;for(let _=1;_<=mt;_++)Ue.push({date:new Date(E,q+1,_),isCurrentMonth:false});return Ue},[K]),bt=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),R(false),!y||!d)return;let q=Array.from(E.dataTransfer.files);if(q.length!==0){ce(true);try{await d(y.id,q);}finally{ce(false);}}},[y,d]),ua=react.useCallback(async E=>{if(!y||!d||!E.target.files)return;let q=Array.from(E.target.files);if(q.length!==0){ce(true);try{await d(y.id,q);}finally{ce(false);}E.target.value="";}},[y,d]),te=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),R(true);},[]),ue=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),R(false);},[]),yt=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),ie=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!y?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&y&&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:h("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:h("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:h("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:h("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:h("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:y.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:h("p-1.5 rounded transition-colors",b?"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("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=y.progress===100?0:100,ge={...y,progress:E,status:E===100?"completed":"todo"};se(ge);},className:h("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",y.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:y.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Se,onChange:E=>kt(E.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:h("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",y.progress===100?"line-through text-[#6B7280]":b?"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:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ce(),w(!x);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.progress===100||y.status==="completed"?"bg-green-500/20 text-green-400":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.progress===100||y.status==="completed"?n==="es"?"COMPLETADO":"DONE":y.progress&&y.progress>0||y.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>Mt(E.id),className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",y.status===E.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),U(!S);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[y.assignees&&y.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[y.assignees.slice(0,3).map((E,q)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},q)),y.assignees.length>3&&jsxRuntime.jsxs("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",y.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:h("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>U(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(E=>{let q=y.assignees?.some(ge=>ge.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ge=y.assignees||[],Me;q?Me=ge.filter(Ge=>Ge.name!==E.name):Me=[...ge,E],Oe("assignees",Me);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",q&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:h("flex-1",b?"text-white":"text-gray-900"),children:E.name}),q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.name)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",b?"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:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{j($?null:"start"),be(y.startDate||new Date);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[y.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:h("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),y.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>j(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:h("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:h("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,q=new Date(E);q.setDate(E.getDate()+1);let ge=new Date(E);ge.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Me=new Date(E);Me.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let Ge=new Date(E);Ge.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Xe=new Date(E);Xe.setDate(E.getDate()+14);let Ue=new Date(E);return Ue.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ge,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Me,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ge,display:Ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Xe,display:Xe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((mt,_)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if($==="start"){let ee=y.endDate&&mt.date>y.endDate?mt.date:y.endDate;Dt(mt.date,ee),j("end");}else {let ee=y.startDate&&mt.date<y.startDate?mt.date:y.startDate;Dt(ee,mt.date),j(null);}},children:[jsxRuntime.jsx("span",{children:mt.label}),jsxRuntime.jsx("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:mt.display})]},_))})(),jsxRuntime.jsx("div",{className:h("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Dt(void 0,void 0),j(null);},className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"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:h("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:$==="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:h("font-medium",b?"text-white":"text-gray-900"),children:K.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:()=>be(new Date),className:h("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>be(new Date(K.getFullYear(),K.getMonth()-1)),className:h("p-1 rounded",b?"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:()=>be(new Date(K.getFullYear(),K.getMonth()+1)),className:h("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:h("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Qe().map((E,q)=>{let ge=E.date.toDateString()===new Date().toDateString(),Me=y.startDate?.toDateString()===E.date.toDateString(),Ge=y.endDate?.toDateString()===E.date.toDateString(),Xe=Me||Ge,Ue=y.startDate&&y.endDate&&E.date>=y.startDate&&E.date<=y.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let it=new Date(E.date);if($==="start"){let mt=y.endDate&&it>y.endDate?it:y.endDate;Dt(it,mt),j("end");}else {let mt=y.startDate&&it<y.startDate?it:y.startDate;Dt(mt,it),j(null);}},className:h("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(b?"text-white":"text-gray-900"),ge&&"ring-2 ring-[#3B82F6]",Me&&"bg-[#3B82F6] text-white",Ge&&!Me&&"bg-[#7C3AED] text-white",Ue&&!Xe&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!Xe&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},q)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ce(),M(!B);},className:h("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",y.priority==="high"||y.priority==="urgent"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":y.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.priority?y.priority==="high"||y.priority==="urgent"?n==="es"?"Alta":"High":y.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:()=>M(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{Oe("priority",E.id),M(false);},className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",y.priority===E.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:h("text-sm",b?"text-white":"text-gray-900"),children:y.startDate&&y.endDate?`${Math.ceil((y.endDate.getTime()-y.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:h("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ze?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:y.progress||0,onChange:E=>{let q=parseInt(E.target.value),ge=y.status;q===100?ge="completed":q>0?ge="in-progress":ge="todo";let Me={...y,progress:q,status:ge};se(Me);},onBlur:()=>st(false),className:h("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"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:()=>st(true),className:h("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:y.tags||[],availableTags:p,onChange:E=>{Oe("tags",E);},onCreateTag:i,theme:v})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:h("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[y.dependencies&&y.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:y.dependencies.map(E=>{let q=f.find(ge=>ge.id===E);return jsxRuntime.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[q?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ge=(y.dependencies||[]).filter(Me=>Me!==E);Oe("dependencies",ge);},className:h("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),Ae(!Ve);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:h("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(false),L("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:h("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Z,onChange:E=>L(E.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:h("w-full px-3 py-2 rounded-md text-sm outline-none",b?"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(E=>E.id!==y.id).filter(E=>Z===""||E.name.toLowerCase().includes(Z.toLowerCase())).map(E=>{let q=y.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ge=y.dependencies||[],Me;q?Me=ge.filter(Ge=>Ge!==E.id):Me=[...ge,E.id],Oe("dependencies",Me);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",q&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",q?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:h("block truncate",b?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",b?"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:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),W(!C);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:y.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:h("text-sm",b?"text-white":"text-gray-900"),children:sr.find(E=>E.value===y.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"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:sr.map(E=>{let q=y.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{Oe("color",E.value),W(false);},className:h("w-7 h-7 rounded-full flex items-center justify-center transition-all",q&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:q?E.value:void 0},title:E.name,children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"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:y.isMilestone||false,onChange:E=>Oe("isMilestone",E.target.checked),className:h("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",y.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:h("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:De,onChange:E=>at(E.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:h("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"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("button",{className:h("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"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"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),y.subtasks&&y.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:y.subtasks.map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:h("text-sm",E.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"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:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:h("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(E=>{let q=ie(E.type),ge=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:h("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ge&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:h("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(q,{className:h("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:h("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:yt(E.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(E.id),className:h("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:te,onDragLeave:ue,onDrop:bt,className:h("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",O?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ne&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ua,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||ne}),ne?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:h("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:h("w-6 h-6 mx-auto mb-2",O?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:O?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:h("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:h("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:h("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",T.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",T.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:T.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:T.map(E=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:E.user?.color||"#8B5CF6"},children:E.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:h("text-sm font-medium",b?"text-white":"text-gray-900"),children:E.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:It(E.createdAt)})]}),jsxRuntime.jsx("p",{className:h("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:h("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:h("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:h("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[c&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:h("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:We,onChange:E=>je(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),Le());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:z||!N,className:h("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(z||!N)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:Le,disabled:z||!We.trim()||!N,className:h("p-1.5 rounded transition-colors",We.trim()&&N?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",z&&"opacity-50 cursor-not-allowed"),children:z?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"})})]})]})})]})]})]})})}function xs(){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 Sr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:m,isLoading:p,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:f,onUploadAttachments:T,onDeleteAttachment:N,comments:c,onAddComment:b,currentUser:v,onTaskOpen:l}){let[k,y]=xs(),[D,x]=react.useState(null),w=o?.theme||"dark",B=w==="dark"||w==="neutral",M=B?"dark":"",S=react.useCallback((C,W)=>{t.onCardUpdate?.(C,W);},[t]),U=react.useCallback((C,W)=>{t.onColumnUpdate?.(C,{title:W});},[t]),$=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),j=["todo","in-progress","completed"],K=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),be=react.useMemo(()=>{let C=new Map;return e.columns.forEach(W=>{let O=W.cardIds.map(R=>e.cards.find(ne=>ne.id===R)).filter(R=>R!==void 0).sort((R,ne)=>R.position-ne.position);C.set(W.id,O);}),C},[e.cards,e.columns]),ze=react.useMemo(()=>e.cards.map(C=>({id:C.id,name:C.title,startDate:C.startDate?new Date(C.startDate):void 0,endDate:C.endDate?new Date(C.endDate):void 0,progress:C.progress||0,status:C.columnId,priority:C.priority?.toLowerCase(),dependencies:Array.isArray(C.dependencies)?C.dependencies.map(W=>typeof W=="string"?W:W.taskId):[]})),[e.cards]),st=react.useCallback(C=>{let{active:W}=C,O=e.cards.find(R=>R.id===W.id);O&&y({isDragging:true,draggedCardId:O.id,sourceColumnId:O.columnId,targetColumnId:O.columnId});},[e.cards,y]),Ve=react.useCallback(C=>{let{active:W,over:O}=C;if(!O||!e.cards.find(ce=>ce.id===W.id))return;let ne=null;O.data.current?.type==="column"?ne=O.id:O.data.current?.type==="card"&&(ne=e.cards.find(De=>De.id===O.id)?.columnId||null),ne&&ne!==k.targetColumnId&&y({...k,targetColumnId:ne});},[e.cards,k,y]),Ae=react.useCallback(async C=>{let{active:W,over:O}=C;if(y({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!O)return;let R=e.cards.find(le=>le.id===W.id);if(!R)return;let ne,ce;if(O.data.current?.type==="column"){ne=O.id;let le=be.get(ne)||[];ce=os(le,0);}else {let le=e.cards.find(Fe=>Fe.id===O.id);if(!le)return;ne=le.columnId;let Be=be.get(ne)||[],Se=Be.findIndex(Fe=>Fe.id===O.id);ce=os(Be,Se);}let De=e.columns.find(le=>le.id===ne);if(De&&De.wipLimit&&De.wipLimitType==="hard"){let le=be.get(ne)||[];if(R.columnId!==ne&&le.length>=De.wipLimit){t.onWipLimitExceeded?.(De,R);return}}(R.columnId!==ne||R.position!==ce)&&await t.onCardMove?.(R.id,ne,ce);},[e.cards,e.columns,be,t,y]),Z=react.useCallback(C=>{x(C),a?.(C),l?.(C.id);},[a,l]),L=react.useCallback(C=>{t.onCardUpdate?.(C.id,C),x(C);},[t]);return p?jsxRuntime.jsx("div",{className:h("asakaa-board",M,n),style:m,children:jsxRuntime.jsx(ku,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:h("asakaa-board",M,n),style:m,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(Il,{themeName:w,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:K,collisionDetection:core$1.closestCorners,onDragStart:st,onDragOver:Ve,onDragEnd:Ae,children:[jsxRuntime.jsxs("div",{className:h("asakaa-board",M,n),style:m,"data-theme":w,children:[e.columns.sort((C,W)=>C.position-W.position).map(C=>{let W=be.get(C.id)||[],O=!j.includes(C.id);return jsxRuntime.jsx(io,{column:C,cards:W,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Z,onCardUpdate:S,onColumnRename:U,onColumnDelete:$,isDeletable:O,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:k.draggedCardId?jsxRuntime.jsx(pr,{card:e.cards.find(C=>C.id===k.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Gr,{task:D,isOpen:!!D,onClose:()=>x(null),onCardUpdate:L,theme:B?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:D?f?.get(D.id)||[]:[],onUploadAttachments:T,onDeleteAttachment:N,availableTasks:ze,comments:c,onAddComment:b,currentUser:v})]})}function ku({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 Du={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)"},Su={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)"},Eu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Pu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Mu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let i=u=>{m.current&&!m.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let p=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:m,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,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Au({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[m,p]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=T=>{i.current&&!i.current.contains(T.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),g=async(f,T)=>{if(T){p(f);try{await T();}catch(N){console.error(`Export ${f} failed:`,N);}finally{p(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,T)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(f.id,f.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:T<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:T*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===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 Fu({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 ws({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:m,onExportExcel:p,translations:i}){let u=r==="dark"?Du:Su,d={...o==="es"?Eu:Pu,...i},g=n||m||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Au,{theme:u,t:d,onExportCSV:n,onExportJSON:m,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(Mu,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(Fu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ts({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[m,p]=react.useState(""),i=react.useCallback(()=>{let g=m.trim();g&&(e(g),p(""),n(false));},[m,e]),u=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(p(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{m.trim()||n(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:h("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:m,onChange:g=>p(g.target.value),onKeyDown:u,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:!m.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:()=>{p(""),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:h("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 Ns({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:m="dark",locale:p="es"}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[f,T]=react.useState(""),[N,c]=react.useState([]),[b,v]=react.useState(""),[l,k]=react.useState(""),[y,D]=react.useState(""),[x,w]=react.useState(false),[B,M]=react.useState(false),[S,U]=react.useState(false),$=react.useRef(null),j=react.useRef(null),K={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},be=react.useCallback(()=>{T(""),c([]),v(""),k(""),D(""),w(false),M(false),U(false),u(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let Z=L=>{j.current&&!j.current.contains(L.target)&&(f.trim()||be());};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[i,f,be]);let ze=react.useCallback(async()=>{let Z=f.trim();if(!(!Z||d)){g(true);try{await t({name:Z,columnId:e,assigneeIds:N.length>0?N:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:y||void 0}),T(""),c([]),v(""),k(""),D(""),w(!1),M(!1),U(!1),$.current?.focus();}catch(L){console.error("Error creating card:",L);}finally{g(false);}}},[f,e,N,b,l,y,t,d]),st=react.useCallback(Z=>{Z.key==="Enter"&&!Z.shiftKey?(Z.preventDefault(),ze()):Z.key==="Escape"&&be();},[ze,be]),Ve=react.useCallback(Z=>{c(L=>L.includes(Z)?L.filter(C=>C!==Z):[...L,Z]);},[]),Ae=m==="dark";return i?jsxRuntime.jsxs("div",{ref:j,className:h("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:f,onChange:Z=>T(Z.target.value),onKeyDown:st,placeholder:K.placeholder,disabled:d,className:h("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"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(!x),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||N.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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"})]}),N.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:N.length})]}),jsxRuntime.jsx("button",{onClick:()=>M(!B),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||b||l?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:()=>U(!S),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",S||y?y==="urgent"?"bg-red-500/20 text-red-400":y==="high"?"bg-orange-500/20 text-orange-400":y==="medium"?"bg-yellow-500/20 text-yellow-400":y==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:ze,disabled:!f.trim()||d,className:h("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"}):K.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(Z=>jsxRuntime.jsxs("button",{onClick:()=>Ve(Z.id),className:h("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",N.includes(Z.id)?"bg-emerald-500 text-white":Ae?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[Z.avatar?jsxRuntime.jsx("img",{src:Z.avatar,alt:Z.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",N.includes(Z.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:Z.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:Z.name.split(" ")[0]})]},Z.id))})}),B&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Ae?"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:h("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:K.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:Z=>v(Z.target.value),className:h("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:h("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:K.endDate}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:Z=>k(Z.target.value),className:h("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),S&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(Z=>jsxRuntime.jsx("button",{onClick:()=>D(y===Z?"":Z),className:h("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",y===Z?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[Z]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:K[Z]},Z))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"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:K.buttonLabel})]})}var Ao=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(Sr,{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(`
|
|
5
|
-
`)}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 yd(e={}){return new Ao(e)}var co=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 Ds(e,t){let a=r=>jsxRuntime.jsx(co,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Es({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:m,onOpenAIUsage:p,shortcut:i="k",className:u=""}){let[d,g]=react.useState(false),[f,T]=react.useState(""),[N,c]=react.useState("home"),[b,v]=react.useState(""),[l,k]=react.useState("");react.useEffect(()=>{let w=B=>{(B.metaKey||B.ctrlKey)&&B.key===i&&(B.preventDefault(),g(M=>!M)),B.key==="Escape"&&(g(false),c("home"),T(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(c("home"),T(""),v(""),k(""));},[d]);let y=react.useCallback(()=>{g(false);},[]),D=react.useCallback(w=>{let[B,M]=w.split(":");switch(B){case "create-card":c("create-card");break;case "create-card-in":v(M||"");break;case "navigate":M?(a?.(M),y()):c("navigate");break;case "search":r?.(f),y();break;case "priority":c("priority");break;case "set-priority":l&&M&&(o?.(l,M),y());break;case "assign":c("assign");break;case "assign-user":l&&M&&(s?.(l,M),y());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),y();break;case "ai-predict-risks":m?.(),y();break;case "ai-usage":p?.(),y();break;case "back":c("home");break;}},[f,l,t,a,r,o,s,n,m,p,y]),x=react.useCallback(()=>{b&&f.trim()&&(t?.(b,f.trim()),y());},[b,f,t,y]);return d?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:y,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:T,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:N==="create-card"&&b?"Type card title and press Enter...":N==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&N==="create-card"&&b&&x();}}),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."}),N==="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:D,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:D,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:D,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:D,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:D,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(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},w.id))})]}),N==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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))})]}),N==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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 B=e.columns.find(M=>M.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,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:B?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id)})})]}),N==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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:D,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:D,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 kd(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=`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Pl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let m=Pl(t[n]||"");if(m.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((f,C)=>{i[f]=m[C]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={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(g),d.cardIds.push(g.id);}catch(m){s.push(`Line ${n+1}: ${m instanceof Error?m.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 Pl(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 Ml(e,t){switch(t){case "json":return pp(e);case "csv":return up(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Al(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 ls=react.createContext(null);function Fl(){return react.useContext(ls)}var Ll=react.createContext(null);function Il({children:e,themeName:t}){return jsxRuntime.jsx(Ll.Provider,{value:{themeName:t},children:e})}function oo(){return react.useContext(Ll)}function gt({children:e,container:t}){let[a,r]=react.useState(false),o=Fl(),s=oo();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:m,themeName:p}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"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 zl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},kp="#BDC3C7",wp=({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 Or({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),m=react.useRef(null),p=react.useRef(null),i=()=>{if(!p.current)return;let f=p.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,c=160,b=220,v=4,l=f.right-c;l<10&&(l=f.left),l+c>T-10&&(l=T-c-10);let x=C-f.bottom,y=f.top,D;x>=b+v?D=f.bottom+v:y>=b+v?D=f.top-b-v:D=x>=y?f.bottom+v:Math.max(10,f.top-b-v),n({top:D,left:l}),o(true);};react.useEffect(()=>{let f=C=>{m.current&&!m.current.contains(C.target)&&!p.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let u=f=>{t(f),o(false);},d=e?zl[e]:null,g=d?.color||kp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,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: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:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:m,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(zl).map(([f,C])=>jsxRuntime.jsxs("button",{onClick:()=>u(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:C.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(wp,{color:C.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:C.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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Cp=[{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 No({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),p=react.useRef(null),i=react.useRef(null),g=(oo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),x=window.innerHeight,y=window.innerWidth,D=320,k=380,w=4,B=l.left;B+D>y-10&&(B=y-D-10),B<10&&(B=10);let M=x-l.bottom,S=l.top,z;M>=k+w?z=l.bottom+w:S>=k+w?z=l.top-k-w:z=M>=S?l.bottom+w:Math.max(10,l.top-k-w),m({top:z,left:B}),s(true);};react.useEffect(()=>{let l=x=>{p.current&&!p.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let C=l=>{let x=new Date,y=B=>{let M=B.getFullYear(),S=String(B.getMonth()+1).padStart(2,"0"),z=String(B.getDate()).padStart(2,"0");return `${M}-${S}-${z}`},D=y(x),k=new Date(x);k.setDate(k.getDate()+l);let w=y(k);a(D,w),s(false);},T=()=>{if(!e||!t)return "Set date";let l=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(z=>isNaN(z)))return null;let B=w[0],M=w[1],S=w[2];return B===void 0||M===void 0||S===void 0?null:new Date(B,M-1,S)},x=l(e),y=l(t);if(!x||!y||isNaN(x.getTime())||isNaN(y.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[y.getMonth()]} ${y.getDate()}`},c=e&&t,v=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),l<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 ${v?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${T()}`:"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:T()})]}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:p,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:Cp.map(l=>jsxRuntime.jsx("button",{onClick:()=>C(l.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:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.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:l=>a(l.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:l=>a(e,l.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:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Ur({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[m,p]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let v=g.current.getBoundingClientRect(),l=window.innerHeight,x=window.innerWidth,y=300,D=380,k=4,w=v.right-y;w<10&&(w=v.left),w+y>x-10&&(w=x-y-10);let B=l-v.bottom,M=v.top,S;B>=D+k?S=v.bottom+k:M>=D+k?S=v.top-D-k:S=B>=M?v.bottom+k:Math.max(10,v.top-D-k),u({top:S,left:w}),n(true);};react.useEffect(()=>{let v=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),p(""));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),react.useEffect(()=>{let v=l=>{l.key==="Escape"&&(n(false),p(""));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]);let C=v=>{let l=e.some(x=>x.id===v.id);a(l?e.filter(x=>x.id!==v.id):[...e,v]);},T=t.filter(v=>v.name.toLowerCase().includes(m.toLowerCase())),c=e.slice(0,o),b=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:[c.map(v=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:v.name,children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"asakaa-avatar-img"}):v.initials},v.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(gt,{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:m,onChange:v=>p(v.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:T.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"}):T.map(v=>{let l=e.some(x=>x.id===v.id);return jsxRuntime.jsxs("button",{onClick:()=>C(v),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:v.color,color:"#fff"},children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.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:v.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},v.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 rn(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let i=p.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,m=p=>{if(!s.has(p)){s.add(p),n.add(p);let i=r.get(p)||[];for(let u of i){if(!s.has(u)&&m(u))return true;if(n.has(u))return true}}return n.delete(p),false};return m(a)}function So({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[m,p]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(t.length>0),[f,C]=react.useState({top:0,left:0}),[T,c]=react.useState(null),b=react.useRef(null),v=react.useRef(null),l=()=>{if(!v.current)return;let w=v.current.getBoundingClientRect(),B=window.innerHeight,M=window.innerWidth,S=300,z=d?380:120,$=4,K=w.right-S;K<10&&(K=w.left),K+S>M-10&&(K=M-S-10);let Y=B-w.bottom,ye=w.top,Oe;Y>=z+$?Oe=w.bottom+$:ye>=z+$?Oe=w.top-z-$:Oe=Y>=ye?w.bottom+$:Math.max(10,w.top-z-$),C({top:Oe,left:K}),p(true);};react.useEffect(()=>{if(!m||!v.current)return;let w=v.current.getBoundingClientRect(),B=window.innerHeight,M=window.innerWidth,S=300,z=d?380:120,$=4,K=w.right-S;K<10&&(K=w.left),K+S>M-10&&(K=M-S-10);let Y=B-w.bottom,ye=w.top,Oe;Y>=z+$?Oe=w.bottom+$:ye>=z+$?Oe=w.top-z-$:Oe=Y>=ye?w.bottom+$:Math.max(10,w.top-z-$),C({top:Oe,left:K});},[d,m]),react.useEffect(()=>{let w=B=>{b.current&&!b.current.contains(B.target)&&!v.current?.contains(B.target)&&(p(false),u(""));};if(m)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[m]),react.useEffect(()=>{let w=B=>{B.key==="Escape"&&(p(false),u(""));};if(m)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[m]);let x=w=>{let B=t.includes(w),M=a.find(S=>S.id===w);if(c(null),B){let S=t.filter(z=>z!==w);r(S),S.length===0&&g(false);}else {if(s&&rn(a,w,e)){let z=`Cannot add "${M?.title||w}" as dependency - would create circular reference`;c(z),n?.(w,M?.title||w),setTimeout(()=>c(null),3e3);return}r([...t,w]),g(true);}},y=()=>{let w=!d;g(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:v,onClick:()=>m?p(false):l(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),m&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:b,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:[T&&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:T})]}),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:y,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=>u(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:D.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"}):D.map(w=>{let B=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:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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),p(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 pr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:m=[],allCards:p=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:f,isDragging:C}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:Qo.Transform.toString(g),transition:f};if(t)return jsxRuntime.jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=m.filter(x=>e.assignedUserIds?.includes(x.id)),b=e.progress===100,v=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),l={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:l,className:h("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,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";}})}),v.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:v.length===1&&v[0]?jsxRuntime.jsx("img",{src:v[0].url,alt:v[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:v.slice(0,4).map((x,y)=>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:D=>{D.currentTarget.style.display="none";}}),y===3&&v.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:["+",v.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Or,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(No,{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,y)=>n?.(e.id,{startDate:x,endDate:y})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ur,{assignedUsers:c,availableUsers:m,onChange:x=>n?.(e.id,{assignedUserIds:x.map(y=>y.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(So,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:p,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)));pr.displayName="Card";var on={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"}},ql=({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 Xl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),p=react.useRef(null),i=react.useRef(null),u=[...Object.entries(on).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(on).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=on[e];if(c)return {...c,id:e};let b=r.find(v=>v.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...on.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,v=window.innerWidth,l=180,x=280,y=4,D=c.right-l;D<10&&(D=c.left),D+l>v-10&&(D=v-l-10);let k=b-c.bottom,w=c.top,B;k>=x+y?B=c.bottom+y:w>=x+y?B=c.top-x-y:B=k>=w?c.bottom+y:Math.max(10,c.top-x-y),m({top:B,left:D}),s(true);};react.useEffect(()=>{let c=b=>{p.current&&!p.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),react.useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let f=c=>{t(c),s(false);},C=d(),T=C.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:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsxRuntime.jsx(ql,{icon:C.icon,color:T})}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(c=>jsxRuntime.jsxs("button",{onClick:()=>f(c.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:c.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ql,{icon:c.icon,color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:c.label}),e===c.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"})})]},c.id))})]})})]})}function Jl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[m,p]=react.useState(false),[i,u]=react.useState(e),[d,g]=react.useState({top:0,left:0}),f=react.useRef(null),C=react.useRef(null),T=react.useRef(null);react.useEffect(()=>{if(s&&C.current){let l=C.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),react.useEffect(()=>{let l=x=>{f.current&&!f.current.contains(x.target)&&!C.current?.contains(x.target)&&(n(false),p(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&(n(false),p(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),react.useEffect(()=>{m&&T.current&&(T.current.focus(),T.current.select());},[m]);let c=()=>{p(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),p(false),n(false),u(e);},v=l=>{l.key==="Enter"?b():l.key==="Escape"&&(p(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:C,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(gt,{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:m?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:T,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:v,onBlur:b,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:c,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 io=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:m,availableUsers:p,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:f,onColumnRename:C,onColumnDelete:T,isDeletable:c=false,className:b})=>{let{setNodeRef:v,isOver:l}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),y=u??Cl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:y});if(a)return jsxRuntime.jsx("div",{ref:v,className:b,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let S=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:S}:S>=80?{state:"warning",percentage:S}:S>=60?{state:"approaching",percentage:S}:{state:"ok",percentage:S}})(),B=w.state==="exceeded",M=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:h("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:h(M()),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"})]})]}),(C||T)&&jsxRuntime.jsx(Jl,{columnTitle:e.title,onRename:S=>C?.(e.id,S),onDelete:T?()=>T(e.id):void 0,isDeletable:c}),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"})]})]}),!g&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:y?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(S=>S.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"})}):y?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(S=>{let z=t[S.index];return z?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsxRuntime.jsx(pr,{card:z,render:r,onClick:n,onUpdate:m,availableUsers:p,allCards:i})},z.id):null})}):t.map(S=>jsxRuntime.jsx(pr,{card:S,render:r,onClick:n,onUpdate:m,availableUsers:p,allCards:i},S.id))})})]})});io.displayName="Column";function us({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let p=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?p():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:p,onKeyDown:i,className:h("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:h("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var dn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[m,p]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(false),[f,C]=react.useState(dn[10]||"#3B82F6"),[T,c]=react.useState({top:0,left:0}),b=react.useRef(null),v=react.useRef(null),l=react.useRef(null),x=react.useRef(null),y=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),D=t.some(S=>S.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(m&&v.current){let S=v.current.getBoundingClientRect();c({top:S.bottom+6,left:S.left});}},[m]),react.useEffect(()=>{let S=z=>{let $=z.target,K=b.current?.contains($),Y=l.current?.contains($);!K&&!Y&&(p(false),u(""),g(false));};if(m)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[m]),react.useEffect(()=>{m&&x.current&&x.current.focus();},[m]);let k=S=>{let z=e.some($=>$.id===S.id);a(z?e.filter($=>$.id!==S.id):[...e,S]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let S=await r(i.trim(),f);S&&(a([...e,S]),u(""),C(dn[Math.floor(Math.random()*dn.length)]||"#3B82F6"));}finally{g(false);}}},B=(S,z)=>{z.stopPropagation(),a(e.filter($=>$.id!==S));},M={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:v,type:"button",onClick:()=>!s&&p(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,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:T.top,left:T.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:S=>u(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&i.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${S.color}20`,color:S.color},onClick:z=>B(S.id,z),children:[S.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},S.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:y.length>0?y.map(S=>{let z=e.some($=>$.id===S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{z||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.name}),z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&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:dn.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:f===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor: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 fs({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 td({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(fs,{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 sr=[{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 sd(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}}return e}function du(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}}function Gr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:m=[],availableTags:p=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:f=[],comments:C=[],onAddComment:T,currentUser:c}){let b=s==="dark",v={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),x=e,[y,D]=react.useState(e?sd(e,m):null),[k,w]=react.useState(false),[B,M]=react.useState(false),[S,z]=react.useState(false),[$,K]=react.useState(null),[Y,ye]=react.useState(new Date),[Oe,nt]=react.useState(false),[_e,Ae]=react.useState(false),[Q,L]=react.useState(""),[N,W]=react.useState(false),[U,R]=react.useState(false),[se,pe]=react.useState(false),[Ne,ie]=react.useState(""),Le=react.useRef(null),[Ee,De]=react.useState(""),He=react.useRef(null),[ht,et]=react.useState(""),[O,te]=react.useState(false);react.useEffect(()=>{if(e){let E=sd(e,m);D(E),ie(E.description||""),De(E.name||"");}},[e?.id,m]),react.useEffect(()=>()=>{Le.current&&clearTimeout(Le.current),He.current&&clearTimeout(He.current);},[]);let le=react.useCallback(E=>{D(E),l&&o&&x?o(du(E,x)):r&&r(E);},[l,x,o,r]),Ce=react.useCallback(()=>{w(false),M(false),z(false),K(null),Ae(false),L(""),W(false);},[]),$e=react.useCallback((E,q)=>{if(!y)return;let ge={...y,[E]:q};le(ge);},[y,le]),tt=react.useCallback(E=>{ie(E),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{if(y){let q={...y,description:E};le(q);}},800);},[y,le]),xt=react.useCallback(E=>{De(E),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(y&&E.trim()){let q={...y,name:E.trim()};le(q);}},800);},[y,le]),Me=react.useCallback(async()=>{if(!(!y||!ht.trim()||!T)){te(true);try{await T(y.id,ht.trim()),et("");}finally{te(false);}}},[y,ht,T]),Lt=react.useCallback(E=>{let q=typeof E=="string"?new Date(E):E,Ie=new Date().getTime()-q.getTime(),We=Math.floor(Ie/6e4),Ye=Math.floor(Ie/36e5),ze=Math.floor(Ie/864e5);return We<1?n==="es"?"Ahora":"Just now":We<60?n==="es"?`Hace ${We} min`:`${We}m ago`:Ye<24?n==="es"?`Hace ${Ye}h`:`${Ye}h ago`:ze<7?n==="es"?`Hace ${ze}d`:`${ze}d ago`:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),At=react.useCallback(E=>{if(!y)return;let q=y.progress||0;E==="completed"?q=100:E==="in-progress"&&q===0?q=10:E==="todo"&&(q=0);let ge={...y,status:E,progress:q};le(ge),w(false);},[y,le]),ct=react.useCallback((E,q)=>{if(!y)return;let ge={...y,startDate:E,endDate:q};le(ge);},[y,le]),Xe=react.useCallback(()=>{let E=Y.getFullYear(),q=Y.getMonth(),ge=new Date(E,q,1),We=new Date(E,q+1,0).getDate(),Ye=ge.getDay(),ze=[],st=new Date(E,q,0).getDate();for(let _=Ye-1;_>=0;_--)ze.push({date:new Date(E,q-1,st-_),isCurrentMonth:false});for(let _=1;_<=We;_++)ze.push({date:new Date(E,q,_),isCurrentMonth:true});let mt=42-ze.length;for(let _=1;_<=mt;_++)ze.push({date:new Date(E,q+1,_),isCurrentMonth:false});return ze},[Y]),Ht=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),R(false),!y||!d)return;let q=Array.from(E.dataTransfer.files);if(q.length!==0){pe(true);try{await d(y.id,q);}finally{pe(false);}}},[y,d]),sa=react.useCallback(async E=>{if(!y||!d||!E.target.files)return;let q=Array.from(E.target.files);if(q.length!==0){pe(true);try{await d(y.id,q);}finally{pe(false);}E.target.value="";}},[y,d]),ae=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),R(true);},[]),re=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),R(false);},[]),Vt=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),de=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!y?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&y&&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:h("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:h("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:h("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:h("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:h("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:y.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:h("p-1.5 rounded transition-colors",b?"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("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=y.progress===100?0:100,ge={...y,progress:E,status:E===100?"completed":"todo"};le(ge);},className:h("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",y.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:y.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:E=>xt(E.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:h("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",y.progress===100?"line-through text-[#6B7280]":b?"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:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ce(),w(!k);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.progress===100||y.status==="completed"?"bg-green-500/20 text-green-400":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.progress===100||y.status==="completed"?n==="es"?"COMPLETADO":"DONE":y.progress&&y.progress>0||y.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>At(E.id),className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",y.status===E.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),z(!S);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[y.assignees&&y.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[y.assignees.slice(0,3).map((E,q)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},q)),y.assignees.length>3&&jsxRuntime.jsxs("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",y.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:h("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(E=>{let q=y.assignees?.some(ge=>ge.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ge=y.assignees||[],Ie;q?Ie=ge.filter(We=>We.name!==E.name):Ie=[...ge,E],$e("assignees",Ie);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",q&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:h("flex-1",b?"text-white":"text-gray-900"),children:E.name}),q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.name)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",b?"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:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{K($?null:"start"),ye(y.startDate||new Date);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[y.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:h("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),y.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:h("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:h("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,q=new Date(E);q.setDate(E.getDate()+1);let ge=new Date(E);ge.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Ie=new Date(E);Ie.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let We=new Date(E);We.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Ye=new Date(E);Ye.setDate(E.getDate()+14);let ze=new Date(E);return ze.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ge,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ie,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:We,display:We.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ye,display:Ye.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ze,display:ze.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((mt,_)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if($==="start"){let ee=y.endDate&&mt.date>y.endDate?mt.date:y.endDate;ct(mt.date,ee),K("end");}else {let ee=y.startDate&&mt.date<y.startDate?mt.date:y.startDate;ct(ee,mt.date),K(null);}},children:[jsxRuntime.jsx("span",{children:mt.label}),jsxRuntime.jsx("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:mt.display})]},_))})(),jsxRuntime.jsx("div",{className:h("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ct(void 0,void 0),K(null);},className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"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:h("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:$==="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:h("font-medium",b?"text-white":"text-gray-900"),children:Y.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:()=>ye(new Date),className:h("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ye(new Date(Y.getFullYear(),Y.getMonth()-1)),className:h("p-1 rounded",b?"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:()=>ye(new Date(Y.getFullYear(),Y.getMonth()+1)),className:h("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:h("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Xe().map((E,q)=>{let ge=E.date.toDateString()===new Date().toDateString(),Ie=y.startDate?.toDateString()===E.date.toDateString(),We=y.endDate?.toDateString()===E.date.toDateString(),Ye=Ie||We,ze=y.startDate&&y.endDate&&E.date>=y.startDate&&E.date<=y.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let st=new Date(E.date);if($==="start"){let mt=y.endDate&&st>y.endDate?st:y.endDate;ct(st,mt),K("end");}else {let mt=y.startDate&&st<y.startDate?st:y.startDate;ct(mt,st),K(null);}},className:h("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(b?"text-white":"text-gray-900"),ge&&"ring-2 ring-[#3B82F6]",Ie&&"bg-[#3B82F6] text-white",We&&!Ie&&"bg-[#7C3AED] text-white",ze&&!Ye&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!Ye&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},q)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ce(),M(!B);},className:h("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",y.priority==="high"||y.priority==="urgent"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":y.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.priority?y.priority==="high"||y.priority==="urgent"?n==="es"?"Alta":"High":y.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:()=>M(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{$e("priority",E.id),M(false);},className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",y.priority===E.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:h("text-sm",b?"text-white":"text-gray-900"),children:y.startDate&&y.endDate?`${Math.ceil((y.endDate.getTime()-y.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:h("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Oe?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:y.progress||0,onChange:E=>{let q=parseInt(E.target.value),ge=y.status;q===100?ge="completed":q>0?ge="in-progress":ge="todo";let Ie={...y,progress:q,status:ge};le(Ie);},onBlur:()=>nt(false),className:h("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"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:()=>nt(true),className:h("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:y.tags||[],availableTags:p,onChange:E=>{$e("tags",E);},onCreateTag:i,theme:v})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:h("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[y.dependencies&&y.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:y.dependencies.map(E=>{let q=f.find(ge=>ge.id===E);return jsxRuntime.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[q?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ge=(y.dependencies||[]).filter(Ie=>Ie!==E);$e("dependencies",ge);},className:h("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),Ae(!_e);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:h("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(false),L("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:h("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Q,onChange:E=>L(E.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:h("w-full px-3 py-2 rounded-md text-sm outline-none",b?"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(E=>E.id!==y.id).filter(E=>Q===""||E.name.toLowerCase().includes(Q.toLowerCase())).map(E=>{let q=y.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ge=y.dependencies||[],Ie;q?Ie=ge.filter(We=>We!==E.id):Ie=[...ge,E.id],$e("dependencies",Ie);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",q&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",q?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:h("block truncate",b?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",b?"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:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(),W(!N);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:y.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:h("text-sm",b?"text-white":"text-gray-900"),children:sr.find(E=>E.value===y.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"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:sr.map(E=>{let q=y.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{$e("color",E.value),W(false);},className:h("w-7 h-7 rounded-full flex items-center justify-center transition-all",q&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:q?E.value:void 0},title:E.name,children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",b?"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:y.isMilestone||false,onChange:E=>$e("isMilestone",E.target.checked),className:h("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",y.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:h("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:h("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Ne,onChange:E=>tt(E.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:h("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"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("button",{className:h("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"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"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),y.subtasks&&y.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:y.subtasks.map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:h("text-sm",E.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"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:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:h("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(E=>{let q=de(E.type),ge=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:h("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ge&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:h("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(q,{className:h("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:h("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Vt(E.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(E.id),className:h("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:ae,onDragLeave:re,onDrop:Ht,className:h("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",U?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",se&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:sa,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||se}),se?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:h("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:h("w-6 h-6 mx-auto mb-2",U?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:U?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:h("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:h("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:h("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:C.map(E=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:E.user?.color||"#8B5CF6"},children:E.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:h("text-sm font-medium",b?"text-white":"text-gray-900"),children:E.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:h("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Lt(E.createdAt)})]}),jsxRuntime.jsx("p",{className:h("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:h("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:h("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:h("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[c&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:h("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:ht,onChange:E=>et(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),Me());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:O||!T,className:h("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(O||!T)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:Me,disabled:O||!ht.trim()||!T,className:h("p-1.5 rounded transition-colors",ht.trim()&&T?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",O&&"opacity-50 cursor-not-allowed"),children:O?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})})}function xs(){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 Sr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:m,isLoading:p,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:f,onUploadAttachments:C,onDeleteAttachment:T,comments:c,onAddComment:b,currentUser:v,onTaskOpen:l}){let[x,y]=xs(),[D,k]=react.useState(null),w=o?.theme||"dark",B=w==="dark"||w==="neutral",M=B?"dark":"",S=react.useCallback((N,W)=>{t.onCardUpdate?.(N,W);},[t]),z=react.useCallback((N,W)=>{t.onColumnUpdate?.(N,{title:W});},[t]),$=react.useCallback(N=>{t.onColumnDelete?.(N);},[t]),K=["todo","in-progress","completed"],Y=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),ye=react.useMemo(()=>{let N=new Map;return e.columns.forEach(W=>{let U=W.cardIds.map(R=>e.cards.find(se=>se.id===R)).filter(R=>R!==void 0).sort((R,se)=>R.position-se.position);N.set(W.id,U);}),N},[e.cards,e.columns]),Oe=react.useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(W=>typeof W=="string"?W:W.taskId):[]})),[e.cards]),nt=react.useCallback(N=>{let{active:W}=N,U=e.cards.find(R=>R.id===W.id);U&&y({isDragging:true,draggedCardId:U.id,sourceColumnId:U.columnId,targetColumnId:U.columnId});},[e.cards,y]),_e=react.useCallback(N=>{let{active:W,over:U}=N;if(!U||!e.cards.find(pe=>pe.id===W.id))return;let se=null;U.data.current?.type==="column"?se=U.id:U.data.current?.type==="card"&&(se=e.cards.find(Ne=>Ne.id===U.id)?.columnId||null),se&&se!==x.targetColumnId&&y({...x,targetColumnId:se});},[e.cards,x,y]),Ae=react.useCallback(async N=>{let{active:W,over:U}=N;if(y({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!U)return;let R=e.cards.find(ie=>ie.id===W.id);if(!R)return;let se,pe;if(U.data.current?.type==="column"){se=U.id;let ie=ye.get(se)||[];pe=os(ie,0);}else {let ie=e.cards.find(De=>De.id===U.id);if(!ie)return;se=ie.columnId;let Le=ye.get(se)||[],Ee=Le.findIndex(De=>De.id===U.id);pe=os(Le,Ee);}let Ne=e.columns.find(ie=>ie.id===se);if(Ne&&Ne.wipLimit&&Ne.wipLimitType==="hard"){let ie=ye.get(se)||[];if(R.columnId!==se&&ie.length>=Ne.wipLimit){t.onWipLimitExceeded?.(Ne,R);return}}(R.columnId!==se||R.position!==pe)&&await t.onCardMove?.(R.id,se,pe);},[e.cards,e.columns,ye,t,y]),Q=react.useCallback(N=>{k(N),a?.(N),l?.(N.id);},[a,l]),L=react.useCallback(N=>{t.onCardUpdate?.(N.id,N),k(N);},[t]);return p?jsxRuntime.jsx("div",{className:h("asakaa-board",M,n),style:m,children:jsxRuntime.jsx(ku,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:h("asakaa-board",M,n),style:m,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(Il,{themeName:w,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Y,collisionDetection:core$1.closestCorners,onDragStart:nt,onDragOver:_e,onDragEnd:Ae,children:[jsxRuntime.jsxs("div",{className:h("asakaa-board",M,n),style:m,"data-theme":w,children:[e.columns.sort((N,W)=>N.position-W.position).map(N=>{let W=ye.get(N.id)||[],U=!K.includes(N.id);return jsxRuntime.jsx(io,{column:N,cards:W,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Q,onCardUpdate:S,onColumnRename:z,onColumnDelete:$,isDeletable:U,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},N.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(pr,{card:e.cards.find(N=>N.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Gr,{task:D,isOpen:!!D,onClose:()=>k(null),onCardUpdate:L,theme:B?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:D?f?.get(D.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:Oe,comments:c,onAddComment:b,currentUser:v})]})}function ku({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 Du={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)"},Su={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)"},Eu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Pu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Mu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let i=u=>{m.current&&!m.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let p=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:m,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,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Au({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[m,p]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=C=>{i.current&&!i.current.contains(C.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),g=async(f,C)=>{if(C){p(f);try{await C();}catch(T){console.error(`Export ${f} failed:`,T);}finally{p(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,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(f.id,f.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.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:m===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 Fu({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 ws({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:m,onExportExcel:p,translations:i}){let u=r==="dark"?Du:Su,d={...o==="es"?Eu:Pu,...i},g=n||m||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Au,{theme:u,t:d,onExportCSV:n,onExportJSON:m,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(Mu,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(Fu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ts({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[m,p]=react.useState(""),i=react.useCallback(()=>{let g=m.trim();g&&(e(g),p(""),n(false));},[m,e]),u=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(p(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{m.trim()||n(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:h("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:m,onChange:g=>p(g.target.value),onKeyDown:u,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:!m.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:()=>{p(""),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:h("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 Ns({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:m="dark",locale:p="es"}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[f,C]=react.useState(""),[T,c]=react.useState([]),[b,v]=react.useState(""),[l,x]=react.useState(""),[y,D]=react.useState(""),[k,w]=react.useState(false),[B,M]=react.useState(false),[S,z]=react.useState(false),$=react.useRef(null),K=react.useRef(null),Y={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},ye=react.useCallback(()=>{C(""),c([]),v(""),x(""),D(""),w(false),M(false),z(false),u(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let Q=L=>{K.current&&!K.current.contains(L.target)&&(f.trim()||ye());};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[i,f,ye]);let Oe=react.useCallback(async()=>{let Q=f.trim();if(!(!Q||d)){g(true);try{await t({name:Q,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:y||void 0}),C(""),c([]),v(""),x(""),D(""),w(!1),M(!1),z(!1),$.current?.focus();}catch(L){console.error("Error creating card:",L);}finally{g(false);}}},[f,e,T,b,l,y,t,d]),nt=react.useCallback(Q=>{Q.key==="Enter"&&!Q.shiftKey?(Q.preventDefault(),Oe()):Q.key==="Escape"&&ye();},[Oe,ye]),_e=react.useCallback(Q=>{c(L=>L.includes(Q)?L.filter(N=>N!==Q):[...L,Q]);},[]),Ae=m==="dark";return i?jsxRuntime.jsxs("div",{ref:K,className:h("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:f,onChange:Q=>C(Q.target.value),onKeyDown:nt,placeholder:Y.placeholder,disabled:d,className:h("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"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(!k),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||T.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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"})]}),T.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:T.length})]}),jsxRuntime.jsx("button",{onClick:()=>M(!B),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||b||l?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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(!S),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",S||y?y==="urgent"?"bg-red-500/20 text-red-400":y==="high"?"bg-orange-500/20 text-orange-400":y==="medium"?"bg-yellow-500/20 text-yellow-400":y==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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:Oe,disabled:!f.trim()||d,className:h("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"}):Y.save})]})]}),k&&a.length>0&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Ae?"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:()=>_e(Q.id),className:h("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(Q.id)?"bg-emerald-500 text-white":Ae?"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:h("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.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))})}),B&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Ae?"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:h("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:Y.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:Q=>v(Q.target.value),className:h("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:h("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:Y.endDate}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:Q=>x(Q.target.value),className:h("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),S&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Ae?"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:()=>D(y===Q?"":Q),className:h("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",y===Q?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[Q]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:Y[Q]},Q))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"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:Y.buttonLabel})]})}var Ao=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(Sr,{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(`
|
|
5
|
+
`)}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 yd(e={}){return new Ao(e)}var co=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 Ds(e,t){let a=r=>jsxRuntime.jsx(co,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Es({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:m,onOpenAIUsage:p,shortcut:i="k",className:u=""}){let[d,g]=react.useState(false),[f,C]=react.useState(""),[T,c]=react.useState("home"),[b,v]=react.useState(""),[l,x]=react.useState("");react.useEffect(()=>{let w=B=>{(B.metaKey||B.ctrlKey)&&B.key===i&&(B.preventDefault(),g(M=>!M)),B.key==="Escape"&&(g(false),c("home"),C(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(c("home"),C(""),v(""),x(""));},[d]);let y=react.useCallback(()=>{g(false);},[]),D=react.useCallback(w=>{let[B,M]=w.split(":");switch(B){case "create-card":c("create-card");break;case "create-card-in":v(M||"");break;case "navigate":M?(a?.(M),y()):c("navigate");break;case "search":r?.(f),y();break;case "priority":c("priority");break;case "set-priority":l&&M&&(o?.(l,M),y());break;case "assign":c("assign");break;case "assign-user":l&&M&&(s?.(l,M),y());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),y();break;case "ai-predict-risks":m?.(),y();break;case "ai-usage":p?.(),y();break;case "back":c("home");break;}},[f,l,t,a,r,o,s,n,m,p,y]),k=react.useCallback(()=>{b&&f.trim()&&(t?.(b,f.trim()),y());},[b,f,t,y]);return d?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:y,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:C,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:T==="create-card"&&b?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&T==="create-card"&&b&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),T==="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:D,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:D,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:D,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:D,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:D,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(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},w.id))})]}),T==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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))})]}),T==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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 B=e.columns.find(M=>M.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,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:B?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id)})})]}),T==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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:D,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:D,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 kd(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=`
|
|
6
6
|
position: fixed !important;
|
|
7
7
|
inset: 0 !important;
|
|
8
8
|
z-index: 2147483647 !important;
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
padding: 8px 12px !important;
|
|
35
35
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
36
36
|
border-radius: 20px !important;
|
|
37
|
-
`,d.onclick=
|
|
37
|
+
`,d.onclick=C=>C.stopPropagation(),a.forEach((C,T)=>{let c=document.createElement("button");c.className=`attachment-lightbox-dot ${T===r?"active":""}`,c.style.cssText=`
|
|
38
38
|
width: 8px !important;
|
|
39
39
|
height: 8px !important;
|
|
40
40
|
border-radius: 50% !important;
|
|
41
|
-
background: ${
|
|
41
|
+
background: ${T===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
42
42
|
border: none !important;
|
|
43
43
|
padding: 0 !important;
|
|
44
44
|
cursor: pointer !important;
|
|
45
|
-
`,c.onclick=b=>{b.stopPropagation(),i(),o(
|
|
45
|
+
`,c.onclick=b=>{b.stopPropagation(),i(),o(T);},d.appendChild(c);});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=`
|
|
46
46
|
position: absolute !important;
|
|
47
47
|
left: 0 !important;
|
|
48
48
|
top: 0 !important;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
border: none !important;
|
|
56
56
|
cursor: pointer !important;
|
|
57
57
|
opacity: 0.5 !important;
|
|
58
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=
|
|
58
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=C=>{C.stopPropagation();let T=r>0?r-1:a.length-1;i(),o(T);};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=`
|
|
59
59
|
position: absolute !important;
|
|
60
60
|
right: 0 !important;
|
|
61
61
|
top: 0 !important;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
border: none !important;
|
|
69
69
|
cursor: pointer !important;
|
|
70
70
|
opacity: 0.5 !important;
|
|
71
|
-
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=T=>{T.stopPropagation();let N=r<a.length-1?r+1:0;i(),o(N);},n.appendChild(d),n.appendChild(g),n.appendChild(f);}n.appendChild(m),n.appendChild(p),document.body.appendChild(n),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function Ou(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 zu(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 Ms(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,m]=react.useState(false),[p,i]=react.useState(false),[u,d]=react.useState(null),g=react.useRef(null),f=react.useRef(e);f.current=e;let T=react.useCallback((w,B)=>{B.preventDefault(),B.stopPropagation();let M=f.current.filter($=>Ms($.type)),S=M.findIndex($=>$.id===w.id),U=$=>{let j=f.current.filter(be=>Ms(be.type)),K=j[$];K&&kd(K.url,K.name,j,$,U);};kd(w.url,w.name,M,S,U);},[]),N=react.useCallback(w=>{let B=[],M=[];return e.length+w.length>s?(M.push(`Maximum ${s} files allowed`),{valid:B,errors:M}):(w.forEach(S=>{if(S.size/1048576>r){M.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>S.type.match($))){M.push(`${S.name} has invalid file type`);return}B.push(S);}),{valid:B,errors:M})},[e.length,s,r,o]),c=react.useCallback(async w=>{let{valid:B,errors:M}=N(w);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(B.length!==0){i(true),d(null);try{await t?.(B);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[N,t]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),m(true);},[]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),m(false);},[]),l=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),k=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),m(false);let B=Array.from(w.dataTransfer.files);c(B);},[c]),y=react.useCallback(w=>{let B=w.target.files?Array.from(w.target.files):[];c(B),g.current&&(g.current.value="");},[c]),D=react.useCallback(()=>{g.current?.click();},[]),x=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":""} ${p?"uploading":""}`,onDragEnter:b,onDragLeave:v,onDragOver:l,onDrop:k,onClick:D,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:y,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ms(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>T(w,B),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:zu(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:Ou(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:()=>x(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 As({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],aiInsights:p=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:f,onSuggestAssignee:T,onGenerateSubtasks:N,onEstimateEffort:c,currentUserId:b="user-1"}){let[v,l]=react.useState("details"),[k,y]=react.useState(false),[D,x]=react.useState({}),[w,B]=react.useState(""),[M,S]=react.useState(false),[U,$]=react.useState({});if(!t||!e)return null;let j=react.useCallback(()=>{y(false),x({}),l("details"),B(""),$({}),a();},[a]),K=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),x({}),y(false));},[e.id,D,r]),be=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),ze=react.useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),B(""));},[e.id,w,u]),st=react.useCallback(async()=>{if(T){S(true);try{let C=await T(e);$(W=>({...W,assignees:C}));}catch(C){console.error("Failed to suggest assignee:",C);}finally{S(false);}}},[e,T]),Ve=react.useCallback(async()=>{if(N){S(true);try{let C=await N(e);$(W=>({...W,subtasks:C}));}catch(C){console.error("Failed to generate subtasks:",C);}finally{S(false);}}},[e,N]),Ae=react.useCallback(async()=>{if(c){S(true);try{let C=await c(e);$(W=>({...W,effort:C}));}catch(C){console.error("Failed to estimate effort:",C);}finally{S(false);}}},[e,c]),Z={...e,...D},L=s.filter(C=>Z.assignedUserIds?.includes(C.id));return jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:j,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:C=>C.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:Z.priority==="URGENT"?"#EF4444":Z.priority==="HIGH"?"#F59E0B":Z.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:D.title??Z.title,onChange:C=>x({...D,title:C.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:Z.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:K,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{y(false),x({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>y(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:be,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:()=>l("details"),className:`card-detail-tab ${v==="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:()=>l("comments"),className:`card-detail-tab ${v==="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:()=>l("activity"),className:`card-detail-tab ${v==="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",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${v==="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:()=>l("ai"),className:`card-detail-tab ${v==="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:[v==="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"}),k?jsxRuntime.jsx("textarea",{value:D.description??Z.description??"",onChange:C=>x({...D,description:C.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:Z.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??Z.assignedUserIds??[],onChange:C=>{let W=Array.from(C.target.selectedOptions,O=>O.value);x({...D,assignedUserIds:W});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(C=>jsxRuntime.jsx("option",{value:C.id,children:C.name},C.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:L.length>0?L.map(C=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:C.color},children:C.initials}),jsxRuntime.jsx("span",{children:C.name})]},C.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"}),k?jsxRuntime.jsxs("select",{value:D.priority??Z.priority??"",onChange:C=>x({...D,priority:C.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:Z.priority==="URGENT"?"#EF4444":Z.priority==="HIGH"?"#F59E0B":Z.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:Z.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:Z.labels&&Z.labels.length>0?Z.labels.map(C=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:C},C)):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"}),k?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:Z.startDate?new Date(Z.startDate).toISOString().split("T")[0]:"",onChange:C=>x({...D,startDate:C.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Z.startDate?new Date(Z.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:Z.endDate?new Date(Z.endDate).toISOString().split("T")[0]:"",onChange:C=>x({...D,endDate:C.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Z.endDate?new Date(Z.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??Z.estimatedTime??"",onChange:C=>x({...D,estimatedTime:C.target.value?parseFloat(C.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:Z.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:Z.dependencies&&Z.dependencies.length>0?Z.dependencies.map(C=>{let W=typeof C=="string"?C:C.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",W.slice(-4)]},W)}):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:Z.createdAt?new Date(Z.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:C=>B(C.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ze,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(C=>{let W=s.find(O=>O.id===C.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:[W&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:W.color},children:W.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:W?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(C.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(C.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:C.content})]},C.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"})]})})]}),v==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(C=>{let W=s.find(O=>O.id===C.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[C.type.includes("CREATED")&&"\u2795",C.type.includes("UPDATED")&&"\u270F\uFE0F",C.type.includes("MOVED")&&"\u27A1\uFE0F",C.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",C.type.includes("COMMENT")&&"\u{1F4AC}",C.type.includes("ASSIGNED")&&"\u{1F464}",C.type.includes("PRIORITY")&&"\u{1F3AF}",C.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",C.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:W?.name||"Unknown"})," ",C.type.replace(/_/g," ").toLowerCase(),C.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:C.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(C.timestamp).toLocaleString()})]})]},C.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"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(dr,{cardId:e.id,attachments:i,onUpload:g?C=>g(e.id,C):void 0,onDelete:f,currentUserId:b,maxSizeMB:10,maxFiles:20})}),v==="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:st,disabled:M||!T,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:Ve,disabled:M||!N,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:Ae,disabled:M||!c,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"]})]}),U.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),U.assignees.map((C,W)=>{let O=s.find(R=>R.id===C.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[O&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:O.color},children:O.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:O?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:C.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(C.confidence*100).toFixed(0),"%"]})]})]},W)})]}),U.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),U.subtasks.map((C,W)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:C.title}),C.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:C.description}),C.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",C.estimatedTime,"h"]})]},W))]}),U.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:[U.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(U.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(C=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${C.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:C.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:C.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:C.description}),C.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",C.suggestedAction]})]},C.id))]}),!U.assignees&&!U.subtasks&&!U.effort&&p.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 Lo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[m,p]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,f=window.innerWidth,T=4,N=d.left;N+o>f-10&&(N=f-o-10),N<10&&(N=10);let c=g-d.bottom,b=d.top,v;return c>=s+T?v=d.bottom+T:b>=s+T?v=d.top-s-T:c>=b?v=d.bottom+T:v=Math.max(10,d.top-s-T),{top:v,left:N}},[e,o,s]);return react.useEffect(()=>{t&&p(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=f=>{let T=f.target;i.current&&!i.current.contains(T)&&e.current&&!e.current.contains(T)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.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 Ze={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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",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:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",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:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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 Ku=["LOW","MEDIUM","HIGH","URGENT"],Yu=["todo","in-progress","review","done"];function Is({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],onAddComment:p,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:f,availableColumns:T=[],availableLabels:N=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:v,unsplashAccessKey:l,theme:k,onSubtasksChange:y,attachments:D=[],onUploadAttachments:x,onDeleteAttachment:w}){let B=oo(),M=k||B?.themeName||"dark",[S,U]=react.useState(e),[$,j]=react.useState(false),[K,be]=react.useState(e?.subtasks||[]),[ze,st]=react.useState(false),[Ve,Ae]=react.useState(""),[Z,L]=react.useState(""),[C,W]=react.useState("all"),[O,R]=react.useState(false),[ne,ce]=react.useState(false),[De,le]=react.useState(false),[Be,Se]=react.useState(false),[Fe,xe]=react.useState(false),[We,je]=react.useState(false),z=react.useRef(null),re=react.useRef(null),se=react.useRef(null),Ce=react.useRef(null),Oe=react.useRef(null),at=react.useRef(null),kt=react.useRef(null),Le=react.useRef(null),It=react.useRef(null),Mt=react.useRef(null),Dt=react.useRef(null),Qe=react.useRef(null);react.useEffect(()=>{e&&!S?(U({...e}),be(e.subtasks||[])):e&&S&&e.id!==S.id&&(U({...e}),be(e.subtasks||[]));},[e,S]),react.useEffect(()=>{let G=de=>{let $e=de.target;Ce.current&&!Ce.current.contains($e)&&R(false),Oe.current&&!Oe.current.contains($e)&&ce(false),at.current&&!at.current.contains($e)&&le(false),kt.current&&!kt.current.contains($e)&&Se(false);};if(O||ne||De||Be)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[O,ne,De,Be]),react.useEffect(()=>{if(!t)return;let G=de=>{let $e=de.target,Ft=$e.tagName==="INPUT"||$e.tagName==="TEXTAREA"||$e.isContentEditable;if(de.key==="Escape"){de.preventDefault(),O||ne||De||Be||Fe||We?(R(false),ce(false),le(false),Se(false),xe(false),je(false)):Ft||a();return}if(Ft&&de.key!=="Escape")return;let rt=de.metaKey||de.ctrlKey;switch(de.key.toLowerCase()){case "s":de.preventDefault(),R(true);break;case "a":de.preventDefault(),le(true);break;case "p":de.preventDefault(),ce(true);break;case "l":de.preventDefault(),Se(true);break;case "d":rt||(de.preventDefault(),xe(true),setTimeout(()=>Le.current?.focus(),0));break;case "e":rt||(de.preventDefault(),je(true));break;case "i":de.preventDefault(),j(true),setTimeout(()=>re.current?.focus(),0);break;case "t":de.preventDefault(),st(true);break;case "c":de.preventDefault(),se.current?.focus();break}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[t,a,O,ne,De,Be,Fe,We]);let bt=react.useCallback(G=>{let de=G.currentTarget.textContent?.trim()||"";if(S&&de!==S.title){let $e={...S,title:de};U($e),r?.(S.id,{title:de});}},[S,r]),ua=react.useCallback(G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur()),G.key==="Escape"&&(G.preventDefault(),G.currentTarget.textContent=S?.title||"",G.currentTarget.blur());},[S]),te=react.useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),j(false);},[S,e,r]),ue=react.useCallback(G=>{if(S){let de={...S,columnId:G};U(de),r?.(S.id,{columnId:G}),R(false);}},[S,r]),yt=react.useCallback(G=>{if(S){let de={...S,priority:G};U(de),r?.(S.id,{priority:G}),ce(false);}},[S,r]),ie=react.useCallback(G=>{if(S){let de=S.assignedUserIds||[],$e=de.includes(G)?de.filter(rt=>rt!==G):[...de,G],Ft={...S,assignedUserIds:$e};U(Ft),r?.(S.id,{assignedUserIds:$e});}},[S,r]),E=react.useCallback(G=>{if(S){let de=S.labels||[],$e=de.includes(G)?de.filter(rt=>rt!==G):[...de,G],Ft={...S,labels:$e};U(Ft),r?.(S.id,{labels:$e});}},[S,r]),q=react.useCallback(G=>{if(S){let de={...S,tags:G};U(de),r?.(S.id,{tags:G});}},[S,r]),ge=react.useCallback(G=>{if(S){let de=G.target.value,$e={...S,endDate:de};U($e),r?.(S.id,{endDate:de}),xe(false);}},[S,r]),Me=react.useCallback(G=>{if(S){let de={...S,estimatedTime:parseFloat(G)||0};U(de),r?.(S.id,{estimatedTime:parseFloat(G)||0});}},[S,r]),Ge=react.useCallback(()=>{if(Ve.trim()&&S){let G={id:`subtask-${Date.now()}`,title:Ve.trim(),completed:false,createdAt:new Date},de=[...K,G];be(de),Ae(""),st(false),y?.(S.id,de);}},[Ve,K,S,y]),Xe=react.useCallback(G=>{let de=K.map($e=>$e.id===G?{...$e,completed:!$e.completed,updatedAt:new Date}:$e);be(de),S&&y?.(S.id,de);},[K,S,y]),Ue=react.useCallback(G=>{let de=K.filter($e=>$e.id!==G);be(de),S&&y?.(S.id,de);},[K,S,y]),it=react.useCallback(()=>{Z.trim()&&S&&p&&(p(S.id,Z.trim()),L(""));},[Z,S,p]),mt=react.useCallback(G=>{(G.metaKey||G.ctrlKey)&&G.key==="Enter"&&(G.preventDefault(),it());},[it]),_=G=>jsxRuntime.jsx(_u__default.default,{remarkPlugins:[Vu__default.default],rehypePlugins:[ju__default.default],components:{a:({node:de,...$e})=>jsxRuntime.jsx("a",{...$e,target:"_blank",rel:"noopener noreferrer"})},children:G}),ee=m.filter(G=>C==="comments"?G.type.includes("COMMENT"):C==="history"?!G.type.includes("COMMENT"):true);if(!t||!e)return null;let Pe=S||e,Je=s.filter(G=>Pe.assignedUserIds?.includes(G.id)),_e=K.filter(G=>G.completed).length;return jsxRuntime.jsx(gt,{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:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":M,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:z,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:bt,onKeyDown:ua,children:Pe.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:Ce,children:[jsxRuntime.jsxs("button",{ref:It,className:"modal-v2-field",onClick:()=>R(!O),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:Pe.columnId||"No status"})]}),jsxRuntime.jsx(Lo,{triggerRef:It,isOpen:O,onClose:()=>R(false),width:250,estimatedHeight:200,children:(T.length>0?T:Yu.map(G=>({id:G,title:G}))).map(G=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Pe.columnId===G.id?"active":""}`,onClick:()=>ue(G.id),children:G.title},G.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:at,children:[jsxRuntime.jsxs("button",{ref:Mt,className:"modal-v2-field",onClick:()=>le(!De),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:Je.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Je.map(G=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:G.color},title:G.name,children:G.initials},G.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lo,{triggerRef:Mt,isOpen:De,onClose:()=>le(false),width:280,estimatedHeight:300,children:s.map(G=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.assignedUserIds?.includes(G.id)?"active":""}`,onClick:()=>ie(G.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:G.color},children:G.initials}),G.name,Pe.assignedUserIds?.includes(G.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"})})]},G.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Oe,children:[jsxRuntime.jsxs("button",{ref:Dt,className:"modal-v2-field",onClick:()=>ce(!ne),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:Pe.priority||"None"})]}),jsxRuntime.jsxs(Lo,{triggerRef:Dt,isOpen:ne,onClose:()=>ce(false),width:180,estimatedHeight:220,children:[Ku.map(G=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${G.toLowerCase()} ${Pe.priority===G?"active":""}`,onClick:()=>yt(G),children:G},G)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>yt(""),children:"None"})]})]}),c.length>0||b?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(nr,{selectedTags:Pe.tags||[],availableTags:c,onChange:q,onCreateTag:b,theme:Ze[M]||Ze.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:kt,children:[jsxRuntime.jsxs("button",{ref:Qe,className:"modal-v2-field",onClick:()=>Se(!Be),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.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:Pe.labels&&Pe.labels.length>0?jsxRuntime.jsx("span",{children:Pe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lo,{triggerRef:Qe,isOpen:Be,onClose:()=>Se(false),width:220,estimatedHeight:200,children:(N.length>0?N:["Bug","Feature","Enhancement","Documentation"]).map(G=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.labels?.includes(G)?"active":""}`,onClick:()=>E(G),children:[G,Pe.labels?.includes(G)&&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"})})]},G))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{xe(!Fe),setTimeout(()=>Le.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:Pe.endDate?new Date(Pe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Le,type:"date",value:typeof Pe.endDate=="string"?Pe.endDate.split("T")[0]:Pe.endDate?(()=>{let G=new Date(Pe.endDate),de=G.getUTCFullYear(),$e=String(G.getUTCMonth()+1).padStart(2,"0"),Ft=String(G.getUTCDate()).padStart(2,"0");return `${de}-${$e}-${Ft}`})():"",onChange:ge,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>je(!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("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:Pe.estimatedTime?`${Pe.estimatedTime}h`:"Not set"})]}),We&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Pe.estimatedTime||"",onChange:G=>Me(G.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>je(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Pe.description||"",onChange:G=>{if(S){let de={...S,description:G.target.value};U(de);}},onBlur:te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:Pe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:_(Pe.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"}),K.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[_e,"/",K.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>st(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:[K.map(G=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${G.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Xe(G.id),children:G.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:G.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ue(G.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"})]})})]},G.id)),ze&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Ve,onChange:G=>Ae(G.target.value),onKeyDown:G=>{G.key==="Enter"&&Ge(),G.key==="Escape"&&(st(false),Ae(""));},onBlur:Ge,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(x||D.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"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(dr,{cardId:Pe.id,attachments:D,onUpload:x?G=>x(Pe.id,G):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 ${C==="all"?"active":""}`,onClick:()=>W("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${C==="comments"?"active":""}`,onClick:()=>W("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${C==="history"?"active":""}`,onClick:()=>W("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:se,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Z,onChange:G=>L(G.target.value),onKeyDown:mt,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:it,disabled:!Z.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ee.map(G=>{let de=s.find(Ft=>Ft.id===G.userId);if(G.type.includes("COMMENT")){let Ft=n.find(rt=>rt.id===G.metadata?.commentId);return Ft?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[de&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:de.color},children:de.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:de?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ft.content})]})]},G.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[G.type.includes("CREATED")&&"\u2795",G.type.includes("UPDATED")&&"\u270F\uFE0F",G.type.includes("MOVED")&&"\u27A1\uFE0F",G.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",G.type.includes("ASSIGNED")&&"\u{1F464}",G.type.includes("PRIORITY")&&"\u{1F3AF}",G.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:de?.name||"Unknown"})," ",G.type.replace(/_/g," ").toLowerCase(),G.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:G.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]})]},G.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 rg({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 Rs({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((m,p)=>m+p.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(rg,{})}),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,m)=>n+m.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,m)=>n+m.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,m)=>n+(m.planned||0),0)})]})]})]})}function pg({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 $s({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,m=e[e.length-1]?.ideal||0,p=s>0?(s-n)/s*100:0,i=n<=m;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(pg,{})}),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:p>=50?"#10B981":"#F59E0B"},children:[p.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 kg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Md=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function wg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,m=e+n*Math.cos(-a*(Math.PI/180)),p=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:p,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ad({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 Os({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,i)=>p+i.value,0),n=e.map(p=>({...p,totalValue:s,color:p.color||kg[p.name]||Md[e.indexOf(p)%Md.length]})),m=n.map(p=>p.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?wg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((p,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ad,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${p} (${u.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(Ad,{})}),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((p,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[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((p,i)=>i.value>p.value?i:p).name})]})]})]})}var fn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,m]=react.useState(false),[p,i]=react.useState(false),[u,d]=react.useState(false),[g,f]=react.useState(false);if(e.length===0)return null;let T=e.map(k=>k.id),N=k=>{r.onBulkUpdate?.(T,{priority:k}),m(false);},c=k=>{r.onBulkMove?.(T,k),i(false),a();},b=k=>{r.onBulkUpdate?.(T,{assignedUserIds:k}),d(false);},v=k=>{let y=new Set;e.forEach(x=>{x.labels?.forEach(w=>y.add(w));});let D=Array.from(new Set([...y,...k]));r.onBulkUpdate?.(T,{labels:D}),f(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(T),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:()=>m(!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(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>N(k),children:[jsxRuntime.jsx("span",{className:h("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.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(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});fn.displayName="BulkOperationsToolbar";function Sg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,m,p,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(f=>{let T=a?.find(N=>N.id===f);n=`assignee-${f}`,m=T?.name||`User ${f}`,p=T?.color,i=T?.avatar,r.has(n)||r.set(n,{id:n,title:m,groupValue:f,cardIds:[],color:p,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",m="Unassigned",p="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:p,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];m=g.title,p=g.color,r.has(n)||r.set(n,{id:n,title:m,groupValue:s,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,m=f,p="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:f,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);}):(n="label-none",m="No Labels",p="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:p}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function zs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),m=react.useMemo(()=>Sg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Sr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:h("asakaa-swimlane-view",o),children:[m.map(i=>{let u=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),g={...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&&p(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Sr,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),m.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 Us=[{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 Hs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),m=Us.find(i=>i.value===e)||Us[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:h("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:h("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:Us.map(i=>jsxRuntime.jsxs("button",{onClick:()=>p(i.value),className:h("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 Io=[{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 Mg(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,m=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&n&&m&&p}function Rd(e={}){let{shortcuts:t=Io,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(p=>{o.current=[...o.current,p];},[]),m=react.useCallback(p=>{o.current=o.current.filter(i=>i.action!==p);},[]);return react.useEffect(()=>{function p(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Mg(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:n,unregisterShortcut:m,isEnabled:a}}function Fg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Lg(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 Ig(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Lg(e),r=t?Fg(t):"";return a?`${a} + ${r}`:r}function Bg(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 Ws({shortcuts:e=Io,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let n=Bg(e);return jsxRuntime.jsxs("div",{className:h("fixed inset-0 z-[9999] flex items-center justify-center",r),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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.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(([m,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Ig(i)})]},i.action))})]},m))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Gs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
71
|
+
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(f);}n.appendChild(m),n.appendChild(p),document.body.appendChild(n),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function Ou(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 zu(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 Ms(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,m]=react.useState(false),[p,i]=react.useState(false),[u,d]=react.useState(null),g=react.useRef(null),f=react.useRef(e);f.current=e;let C=react.useCallback((w,B)=>{B.preventDefault(),B.stopPropagation();let M=f.current.filter($=>Ms($.type)),S=M.findIndex($=>$.id===w.id),z=$=>{let K=f.current.filter(ye=>Ms(ye.type)),Y=K[$];Y&&kd(Y.url,Y.name,K,$,z);};kd(w.url,w.name,M,S,z);},[]),T=react.useCallback(w=>{let B=[],M=[];return e.length+w.length>s?(M.push(`Maximum ${s} files allowed`),{valid:B,errors:M}):(w.forEach(S=>{if(S.size/1048576>r){M.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>S.type.match($))){M.push(`${S.name} has invalid file type`);return}B.push(S);}),{valid:B,errors:M})},[e.length,s,r,o]),c=react.useCallback(async w=>{let{valid:B,errors:M}=T(w);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(B.length!==0){i(true),d(null);try{await t?.(B);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),m(true);},[]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),m(false);},[]),l=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),m(false);let B=Array.from(w.dataTransfer.files);c(B);},[c]),y=react.useCallback(w=>{let B=w.target.files?Array.from(w.target.files):[];c(B),g.current&&(g.current.value="");},[c]),D=react.useCallback(()=>{g.current?.click();},[]),k=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${p?"uploading":""}`,onDragEnter:b,onDragLeave:v,onDragOver:l,onDrop:x,onClick:D,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:y,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ms(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>C(w,B),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:zu(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:Ou(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function As({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],aiInsights:p=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:f,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:c,currentUserId:b="user-1"}){let[v,l]=react.useState("details"),[x,y]=react.useState(false),[D,k]=react.useState({}),[w,B]=react.useState(""),[M,S]=react.useState(false),[z,$]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{y(false),k({}),l("details"),B(""),$({}),a();},[a]),Y=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),k({}),y(false));},[e.id,D,r]),ye=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),Oe=react.useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),B(""));},[e.id,w,u]),nt=react.useCallback(async()=>{if(C){S(true);try{let N=await C(e);$(W=>({...W,assignees:N}));}catch(N){console.error("Failed to suggest assignee:",N);}finally{S(false);}}},[e,C]),_e=react.useCallback(async()=>{if(T){S(true);try{let N=await T(e);$(W=>({...W,subtasks:N}));}catch(N){console.error("Failed to generate subtasks:",N);}finally{S(false);}}},[e,T]),Ae=react.useCallback(async()=>{if(c){S(true);try{let N=await c(e);$(W=>({...W,effort:N}));}catch(N){console.error("Failed to estimate effort:",N);}finally{S(false);}}},[e,c]),Q={...e,...D},L=s.filter(N=>Q.assignedUserIds?.includes(N.id));return jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:N=>N.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:D.title??Q.title,onChange:N=>k({...D,title:N.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:Y,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{y(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>y(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:ye,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:K,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:()=>l("details"),className:`card-detail-tab ${v==="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:()=>l("comments"),className:`card-detail-tab ${v==="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:()=>l("activity"),className:`card-detail-tab ${v==="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",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${v==="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:()=>l("ai"),className:`card-detail-tab ${v==="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:[v==="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:D.description??Q.description??"",onChange:N=>k({...D,description:N.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:D.assignedUserIds??Q.assignedUserIds??[],onChange:N=>{let W=Array.from(N.target.selectedOptions,U=>U.value);k({...D,assignedUserIds:W});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:L.length>0?L.map(N=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:N.color},children:N.initials}),jsxRuntime.jsx("span",{children:N.name})]},N.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:D.priority??Q.priority??"",onChange:N=>k({...D,priority:N.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(N=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:N},N)):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:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:Q.startDate?new Date(Q.startDate).toISOString().split("T")[0]:"",onChange:N=>k({...D,startDate:N.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:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:Q.endDate?new Date(Q.endDate).toISOString().split("T")[0]:"",onChange:N=>k({...D,endDate:N.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:D.estimatedTime??Q.estimatedTime??"",onChange:N=>k({...D,estimatedTime:N.target.value?parseFloat(N.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(N=>{let W=typeof N=="string"?N:N.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",W.slice(-4)]},W)}):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"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:N=>B(N.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Oe,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(N=>{let W=s.find(U=>U.id===N.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:[W&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:W.color},children:W.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:W?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(N.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(N.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:N.content})]},N.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"})]})})]}),v==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(N=>{let W=s.find(U=>U.id===N.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[N.type.includes("CREATED")&&"\u2795",N.type.includes("UPDATED")&&"\u270F\uFE0F",N.type.includes("MOVED")&&"\u27A1\uFE0F",N.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",N.type.includes("COMMENT")&&"\u{1F4AC}",N.type.includes("ASSIGNED")&&"\u{1F464}",N.type.includes("PRIORITY")&&"\u{1F3AF}",N.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",N.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:W?.name||"Unknown"})," ",N.type.replace(/_/g," ").toLowerCase(),N.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:N.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(N.timestamp).toLocaleString()})]})]},N.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"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(dr,{cardId:e.id,attachments:i,onUpload:g?N=>g(e.id,N):void 0,onDelete:f,currentUserId:b,maxSizeMB:10,maxFiles:20})}),v==="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:nt,disabled:M||!C,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:_e,disabled:M||!T,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:Ae,disabled:M||!c,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((N,W)=>{let U=s.find(R=>R.id===N.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[U&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:U?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:N.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(N.confidence*100).toFixed(0),"%"]})]})]},W)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((N,W)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:N.title}),N.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:N.description}),N.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",N.estimatedTime,"h"]})]},W))]}),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),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(N=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${N.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:N.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:N.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:N.description}),N.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",N.suggestedAction]})]},N.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&p.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 Lo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[m,p]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,f=window.innerWidth,C=4,T=d.left;T+o>f-10&&(T=f-o-10),T<10&&(T=10);let c=g-d.bottom,b=d.top,v;return c>=s+C?v=d.bottom+C:b>=s+C?v=d.top-s-C:c>=b?v=d.bottom+C:v=Math.max(10,d.top-s-C),{top:v,left:T}},[e,o,s]);return react.useEffect(()=>{t&&p(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=f=>{let C=f.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.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 Je={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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",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:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",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:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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 Ku=["LOW","MEDIUM","HIGH","URGENT"],Yu=["todo","in-progress","review","done"];function Is({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],onAddComment:p,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:f,availableColumns:C=[],availableLabels:T=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:v,unsplashAccessKey:l,theme:x,onSubtasksChange:y,attachments:D=[],onUploadAttachments:k,onDeleteAttachment:w}){let B=oo(),M=x||B?.themeName||"dark",[S,z]=react.useState(e),[$,K]=react.useState(false),[Y,ye]=react.useState(e?.subtasks||[]),[Oe,nt]=react.useState(false),[_e,Ae]=react.useState(""),[Q,L]=react.useState(""),[N,W]=react.useState("all"),[U,R]=react.useState(false),[se,pe]=react.useState(false),[Ne,ie]=react.useState(false),[Le,Ee]=react.useState(false),[De,He]=react.useState(false),[ht,et]=react.useState(false),O=react.useRef(null),te=react.useRef(null),le=react.useRef(null),Ce=react.useRef(null),$e=react.useRef(null),tt=react.useRef(null),xt=react.useRef(null),Me=react.useRef(null),Lt=react.useRef(null),At=react.useRef(null),ct=react.useRef(null),Xe=react.useRef(null);react.useEffect(()=>{e&&!S?(z({...e}),ye(e.subtasks||[])):e&&S&&e.id!==S.id&&(z({...e}),ye(e.subtasks||[]));},[e,S]),react.useEffect(()=>{let G=ce=>{let Re=ce.target;Ce.current&&!Ce.current.contains(Re)&&R(false),$e.current&&!$e.current.contains(Re)&&pe(false),tt.current&&!tt.current.contains(Re)&&ie(false),xt.current&&!xt.current.contains(Re)&&Ee(false);};if(U||se||Ne||Le)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[U,se,Ne,Le]),react.useEffect(()=>{if(!t)return;let G=ce=>{let Re=ce.target,Pt=Re.tagName==="INPUT"||Re.tagName==="TEXTAREA"||Re.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),U||se||Ne||Le||De||ht?(R(false),pe(false),ie(false),Ee(false),He(false),et(false)):Pt||a();return}if(Pt&&ce.key!=="Escape")return;let at=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),R(true);break;case "a":ce.preventDefault(),ie(true);break;case "p":ce.preventDefault(),pe(true);break;case "l":ce.preventDefault(),Ee(true);break;case "d":at||(ce.preventDefault(),He(true),setTimeout(()=>Me.current?.focus(),0));break;case "e":at||(ce.preventDefault(),et(true));break;case "i":ce.preventDefault(),K(true),setTimeout(()=>te.current?.focus(),0);break;case "t":ce.preventDefault(),nt(true);break;case "c":ce.preventDefault(),le.current?.focus();break}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[t,a,U,se,Ne,Le,De,ht]);let Ht=react.useCallback(G=>{let ce=G.currentTarget.textContent?.trim()||"";if(S&&ce!==S.title){let Re={...S,title:ce};z(Re),r?.(S.id,{title:ce});}},[S,r]),sa=react.useCallback(G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur()),G.key==="Escape"&&(G.preventDefault(),G.currentTarget.textContent=S?.title||"",G.currentTarget.blur());},[S]),ae=react.useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),K(false);},[S,e,r]),re=react.useCallback(G=>{if(S){let ce={...S,columnId:G};z(ce),r?.(S.id,{columnId:G}),R(false);}},[S,r]),Vt=react.useCallback(G=>{if(S){let ce={...S,priority:G};z(ce),r?.(S.id,{priority:G}),pe(false);}},[S,r]),de=react.useCallback(G=>{if(S){let ce=S.assignedUserIds||[],Re=ce.includes(G)?ce.filter(at=>at!==G):[...ce,G],Pt={...S,assignedUserIds:Re};z(Pt),r?.(S.id,{assignedUserIds:Re});}},[S,r]),E=react.useCallback(G=>{if(S){let ce=S.labels||[],Re=ce.includes(G)?ce.filter(at=>at!==G):[...ce,G],Pt={...S,labels:Re};z(Pt),r?.(S.id,{labels:Re});}},[S,r]),q=react.useCallback(G=>{if(S){let ce={...S,tags:G};z(ce),r?.(S.id,{tags:G});}},[S,r]),ge=react.useCallback(G=>{if(S){let ce=G.target.value,Re={...S,endDate:ce};z(Re),r?.(S.id,{endDate:ce}),He(false);}},[S,r]),Ie=react.useCallback(G=>{if(S){let ce={...S,estimatedTime:parseFloat(G)||0};z(ce),r?.(S.id,{estimatedTime:parseFloat(G)||0});}},[S,r]),We=react.useCallback(()=>{if(_e.trim()&&S){let G={id:`subtask-${Date.now()}`,title:_e.trim(),completed:false,createdAt:new Date},ce=[...Y,G];ye(ce),Ae(""),nt(false),y?.(S.id,ce);}},[_e,Y,S,y]),Ye=react.useCallback(G=>{let ce=Y.map(Re=>Re.id===G?{...Re,completed:!Re.completed,updatedAt:new Date}:Re);ye(ce),S&&y?.(S.id,ce);},[Y,S,y]),ze=react.useCallback(G=>{let ce=Y.filter(Re=>Re.id!==G);ye(ce),S&&y?.(S.id,ce);},[Y,S,y]),st=react.useCallback(()=>{Q.trim()&&S&&p&&(p(S.id,Q.trim()),L(""));},[Q,S,p]),mt=react.useCallback(G=>{(G.metaKey||G.ctrlKey)&&G.key==="Enter"&&(G.preventDefault(),st());},[st]),_=G=>jsxRuntime.jsx(_u__default.default,{remarkPlugins:[Vu__default.default],rehypePlugins:[ju__default.default],components:{a:({node:ce,...Re})=>jsxRuntime.jsx("a",{...Re,target:"_blank",rel:"noopener noreferrer"})},children:G}),ee=m.filter(G=>N==="comments"?G.type.includes("COMMENT"):N==="history"?!G.type.includes("COMMENT"):true);if(!t||!e)return null;let Pe=S||e,qe=s.filter(G=>Pe.assignedUserIds?.includes(G.id)),Ge=Y.filter(G=>G.completed).length;return jsxRuntime.jsx(gt,{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:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":M,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ht,onKeyDown:sa,children:Pe.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:Ce,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>R(!U),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:Pe.columnId||"No status"})]}),jsxRuntime.jsx(Lo,{triggerRef:Lt,isOpen:U,onClose:()=>R(false),width:250,estimatedHeight:200,children:(C.length>0?C:Yu.map(G=>({id:G,title:G}))).map(G=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Pe.columnId===G.id?"active":""}`,onClick:()=>re(G.id),children:G.title},G.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:tt,children:[jsxRuntime.jsxs("button",{ref:At,className:"modal-v2-field",onClick:()=>ie(!Ne),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:qe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:qe.map(G=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:G.color},title:G.name,children:G.initials},G.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lo,{triggerRef:At,isOpen:Ne,onClose:()=>ie(false),width:280,estimatedHeight:300,children:s.map(G=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.assignedUserIds?.includes(G.id)?"active":""}`,onClick:()=>de(G.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:G.color},children:G.initials}),G.name,Pe.assignedUserIds?.includes(G.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"})})]},G.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:$e,children:[jsxRuntime.jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>pe(!se),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:Pe.priority||"None"})]}),jsxRuntime.jsxs(Lo,{triggerRef:ct,isOpen:se,onClose:()=>pe(false),width:180,estimatedHeight:220,children:[Ku.map(G=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${G.toLowerCase()} ${Pe.priority===G?"active":""}`,onClick:()=>Vt(G),children:G},G)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Vt(""),children:"None"})]})]}),c.length>0||b?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(nr,{selectedTags:Pe.tags||[],availableTags:c,onChange:q,onCreateTag:b,theme:Je[M]||Je.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:xt,children:[jsxRuntime.jsxs("button",{ref:Xe,className:"modal-v2-field",onClick:()=>Ee(!Le),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:Pe.labels&&Pe.labels.length>0?jsxRuntime.jsx("span",{children:Pe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lo,{triggerRef:Xe,isOpen:Le,onClose:()=>Ee(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(G=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.labels?.includes(G)?"active":""}`,onClick:()=>E(G),children:[G,Pe.labels?.includes(G)&&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"})})]},G))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{He(!De),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:Pe.endDate?new Date(Pe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Me,type:"date",value:typeof Pe.endDate=="string"?Pe.endDate.split("T")[0]:Pe.endDate?(()=>{let G=new Date(Pe.endDate),ce=G.getUTCFullYear(),Re=String(G.getUTCMonth()+1).padStart(2,"0"),Pt=String(G.getUTCDate()).padStart(2,"0");return `${ce}-${Re}-${Pt}`})():"",onChange:ge,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>et(!ht),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:Pe.estimatedTime?`${Pe.estimatedTime}h`:"Not set"})]}),ht&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Pe.estimatedTime||"",onChange:G=>Ie(G.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>et(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Pe.description||"",onChange:G=>{if(S){let ce={...S,description:G.target.value};z(ce);}},onBlur:ae,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:Pe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:_(Pe.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"}),Y.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ge,"/",Y.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>nt(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:[Y.map(G=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${G.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ye(G.id),children:G.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:G.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ze(G.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"})]})})]},G.id)),Oe&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:_e,onChange:G=>Ae(G.target.value),onKeyDown:G=>{G.key==="Enter"&&We(),G.key==="Escape"&&(nt(false),Ae(""));},onBlur:We,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||D.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"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(dr,{cardId:Pe.id,attachments:D,onUpload:k?G=>k(Pe.id,G):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 ${N==="all"?"active":""}`,onClick:()=>W("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${N==="comments"?"active":""}`,onClick:()=>W("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${N==="history"?"active":""}`,onClick:()=>W("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:le,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Q,onChange:G=>L(G.target.value),onKeyDown:mt,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:st,disabled:!Q.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ee.map(G=>{let ce=s.find(Pt=>Pt.id===G.userId);if(G.type.includes("COMMENT")){let Pt=n.find(at=>at.id===G.metadata?.commentId);return Pt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.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:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Pt.content})]})]},G.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[G.type.includes("CREATED")&&"\u2795",G.type.includes("UPDATED")&&"\u270F\uFE0F",G.type.includes("MOVED")&&"\u27A1\uFE0F",G.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",G.type.includes("ASSIGNED")&&"\u{1F464}",G.type.includes("PRIORITY")&&"\u{1F3AF}",G.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:ce?.name||"Unknown"})," ",G.type.replace(/_/g," ").toLowerCase(),G.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:G.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]})]},G.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 rg({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 Rs({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((m,p)=>m+p.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(rg,{})}),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,m)=>n+m.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,m)=>n+m.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,m)=>n+(m.planned||0),0)})]})]})]})}function pg({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 $s({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,m=e[e.length-1]?.ideal||0,p=s>0?(s-n)/s*100:0,i=n<=m;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(pg,{})}),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:p>=50?"#10B981":"#F59E0B"},children:[p.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 kg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Md=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function wg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,m=e+n*Math.cos(-a*(Math.PI/180)),p=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:p,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ad({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 Os({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,i)=>p+i.value,0),n=e.map(p=>({...p,totalValue:s,color:p.color||kg[p.name]||Md[e.indexOf(p)%Md.length]})),m=n.map(p=>p.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?wg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((p,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ad,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${p} (${u.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(Ad,{})}),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((p,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[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((p,i)=>i.value>p.value?i:p).name})]})]})]})}var fn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,m]=react.useState(false),[p,i]=react.useState(false),[u,d]=react.useState(false),[g,f]=react.useState(false);if(e.length===0)return null;let C=e.map(x=>x.id),T=x=>{r.onBulkUpdate?.(C,{priority:x}),m(false);},c=x=>{r.onBulkMove?.(C,x),i(false),a();},b=x=>{r.onBulkUpdate?.(C,{assignedUserIds:x}),d(false);},v=x=>{let y=new Set;e.forEach(k=>{k.labels?.forEach(w=>y.add(w));});let D=Array.from(new Set([...y,...x]));r.onBulkUpdate?.(C,{labels:D}),f(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),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:()=>m(!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:()=>T(x),children:[jsxRuntime.jsx("span",{className:h("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(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(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(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([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(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});fn.displayName="BulkOperationsToolbar";function Sg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,m,p,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(f=>{let C=a?.find(T=>T.id===f);n=`assignee-${f}`,m=C?.name||`User ${f}`,p=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:m,groupValue:f,cardIds:[],color:p,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",m="Unassigned",p="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:p,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];m=g.title,p=g.color,r.has(n)||r.set(n,{id:n,title:m,groupValue:s,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,m=f,p="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:f,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);}):(n="label-none",m="No Labels",p="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:p}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function zs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),m=react.useMemo(()=>Sg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Sr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:h("asakaa-swimlane-view",o),children:[m.map(i=>{let u=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),g={...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&&p(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Sr,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),m.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 Us=[{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 Hs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),m=Us.find(i=>i.value===e)||Us[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:h("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:h("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:Us.map(i=>jsxRuntime.jsxs("button",{onClick:()=>p(i.value),className:h("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 Io=[{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 Mg(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,m=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&n&&m&&p}function Rd(e={}){let{shortcuts:t=Io,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(p=>{o.current=[...o.current,p];},[]),m=react.useCallback(p=>{o.current=o.current.filter(i=>i.action!==p);},[]);return react.useEffect(()=>{function p(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Mg(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:n,unregisterShortcut:m,isEnabled:a}}function Fg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Lg(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 Ig(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Lg(e),r=t?Fg(t):"";return a?`${a} + ${r}`:r}function Bg(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 Ws({shortcuts:e=Io,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let n=Bg(e);return jsxRuntime.jsxs("div",{className:h("fixed inset-0 z-[9999] flex items-center justify-center",r),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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.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(([m,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Ig(i)})]},i.action))})]},m))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Gs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
72
72
|
1.
|
|
73
73
|
|
|
74
74
|
**Expected behavior:**
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
1.
|
|
109
109
|
|
|
110
110
|
**Action items:**
|
|
111
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _s({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},p=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:h("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:h("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(p).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(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: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: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 js({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[p,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let N=o?.current||void 0,c=await Sl(e,p,N);El(c,p);},T=async N=>{let c=N.target.files?.[0];if(c){try{let b=await Al(c),v=c.name.endsWith(".json")?"json":"csv",l=Ml(b,v);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:h("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:()=>m("export"),className:h("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:()=>m("import"),className:h("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(N=>jsxRuntime.jsxs("button",{onClick:()=>i(N),className:h("p-4 rounded-lg border-2 transition-all text-center",p===N?"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:[N==="json"&&"\u{1F4C4}",N==="csv"&&"\u{1F4CA}",N==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:N})]},N))})]}),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:T,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"})]})]}),u&&jsxRuntime.jsxs("div",{className:h("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:h("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((N,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",N]},c))})]})]})]})]})]})}var Ug=["URGENT","HIGH","MEDIUM","LOW"],Hg=[{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"}],Wg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ks({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:p=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:f="none",onGroupByChange:T}){let[N,c]=react.useState(true),b=react.useCallback(D=>{a({search:D.target.value});},[a]),v=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),l=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),y=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":""} ${N?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!N),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:N?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:N?"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"}),y&&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)"]})]}),!N&&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"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:D=>{let x=D.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ug.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let x=D.target.value;a({assignees:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let x=D.target.value;a({labels:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),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:l,className:"filter-bar__select filter-bar__select--sm",children:Hg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),T&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:D=>T(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Wg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),y&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:p}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=T=>{d.current&&!d.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let g=f=>{f(),u(false);};return jsxRuntime.jsxs("div",{className:h("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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 m?.()),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(()=>p?.()),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 qs={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"}},Xs={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"}},Js={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"}},jr={dark:qs,light:Xs,neutral:Js},bn="dark";var yn=react.createContext(void 0),Qg="asakaa-theme";function zd({children:e,defaultTheme:t=bn,storageKey:a=Qg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,p=jr[r];Object.entries(p.colors).forEach(([u,d])=>{d&&m.style.setProperty(`--theme-${Zg(u)}`,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(([u,d])=>{let g=p.colors[u];g&&m.style.setProperty(d,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:jr};return jsxRuntime.jsx(yn.Provider,{value:n,children:e})}function go(){let e=react.useContext(yn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Zg(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Qs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:h("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(jr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:h("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 Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ze[e]||Ze.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Ze[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ze[e].bgSecondary),bgGrid:r("--theme-bg-card",Ze[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ze[e].bgWeekend),border:r("--theme-border-primary",Ze[e].border),borderLight:r("--theme-border-subtle",Ze[e].borderLight),textPrimary:r("--theme-text-primary",Ze[e].textPrimary),textSecondary:r("--theme-text-secondary",Ze[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ze[e].textTertiary),accent:r("--theme-accent-primary",Ze[e].accent),accentHover:r("--theme-accent-hover",Ze[e].accentHover),accentLight:r("--theme-accent-primary",Ze[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ze[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ze[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ze[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ze[e].dependency),dependencyHover:r("--theme-border-secondary",Ze[e].dependencyHover),criticalPath:r("--theme-error",Ze[e].criticalPath),criticalPathLight:r("--theme-error",Ze[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ze[e].today):e==="neutral"?r("--theme-text-primary",Ze[e].today):r("--theme-error",Ze[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ze[e].todayLight):e==="neutral"?r("--theme-text-primary",Ze[e].todayLight):r("--theme-error",Ze[e].todayLight),milestone:r("--theme-warning",Ze[e].milestone),milestoneLight:r("--theme-warning",Ze[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ze[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ze[e].statusInProgress),statusCompleted:r("--theme-success",Ze[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ze[e].hoverBg),focusRing:r("--theme-accent-primary",Ze[e].focusRing)}}var vn={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:"Filter",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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"},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"}},Hd={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:"Filtrar",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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"},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"}},Zs={en:vn,es:Hd};function Wd(e){return Zs[e]||Zs.en}function ei(e,t){let a=Wd(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 ho=react.createContext(vn);function bo(){return react.useContext(ho)}function hf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,p]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&p(false);};return m&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[m]),!(t||a||r||o||s||n))return null;let T=[{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(c=>c.handler),N=async(c,b)=>{if(b){u(c);try{await b();}catch(v){console.error(`Export ${c} failed:`,v);}finally{u(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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:T.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>N(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<T.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):c.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:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function bf({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 yf({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 vf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],p=m.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"}: ${p}`,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:m.map((i,u)=>{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:u<m.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:u*.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 xf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],p=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p||r?e.accentLight:e.bgSecondary,border:`1px solid ${p||r?e.accent:e.borderLight}`,color:p||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),p&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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-56 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:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),p&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function kn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:p,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:f="all",onTaskFilterChange:T,onExportPNG:N,onExportPDF:c,onExportExcel:b,onExportCSV:v,onExportJSON:l,onExportMSProject:k}){let y=bo(),D=N||c||b||v||l||k,x=[{value:"day",label:y.toolbar.day},{value:"week",label:y.toolbar.week},{value:"month",label:y.toolbar.month}],w=[{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(yf,{options:x,value:t,onChange:B=>a(B),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(vf,{theme:e,value:m,onChange:p}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(xf,{theme:e,value:f,onChange:T})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&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:d||y.toolbar.createTask})]}),(D||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hf,{theme:e,onExportPNG:N,onExportPDF:c,onExportExcel:b,onExportCSV:v,onExportJSON:l,onExportMSProject:k}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(bf,{options:w,value:s,onChange:B=>n(B),theme:e})]})]})}function wn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{m.current&&!m.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let u=p.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[m,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,f=window.innerWidth,T=window.innerHeight,N=t,c=a;t+u+g>f&&(N=t-u,N<g&&(N=g)),a+d+g>T&&(c=T-d-g,c<g&&(c=g)),p({x:N,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Ht={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"}),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 Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:p,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let f=react.useRef(false),T=react.useCallback(l=>{f.current=l;},[]),N=react.useCallback(l=>{let k=[],y=D=>{for(let x of D)k.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&y(x.subtasks);};return y(l),k},[]),c=react.useCallback(()=>{let l=N(e);for(let k of l)if(t.has(k.id))return k;return null},[e,t,N]),b=react.useCallback((l,k)=>{let y=N(e);if(y.length===0)return;let D=c();if(!D){a(y[0].id,false);return}let x=y.findIndex(M=>M.id===D.id);if(x===-1)return;let w=l==="up"?x-1:x+1;if(w<0||w>=y.length)return;let B=y[w];a(B.id,k);},[e,c,N,a]),v=react.useCallback(l=>{if(!g)return;let k=l.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||f.current){l.key==="Escape"&&(k.blur(),f.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),B=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(B&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!B.isExpanded||l.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Enter"&&!l.shiftKey&&!x){B&&(l.preventDefault(),r(B.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!x){B&&(l.preventDefault(),r(B.id,"above"));return}if(l.key==="Enter"&&x){B&&(l.preventDefault(),d(B.id));return}if(l.key==="F2"){B&&(l.preventDefault(),i(B.id));return}if(l.key==="Delete"||l.key==="Backspace"&&x){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&x&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,m,p,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[g,v]),{setIsEditing:T}}function tc(){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(g=>{let f=new Set(g);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let f=g.indexOf(a),T=g.indexOf(d);if(f===-1||T===-1){o(d);return}let N=Math.min(f,T),c=Math.max(f,T),b=g.slice(N,c+1);t(new Set(b)),r(d);},[a,o]),m=react.useCallback((d,g,f,T)=>{T?n(d,g):f?s(d):o(d);},[o,s,n]),p=react.useCallback((d,g)=>{g?t(f=>{let T=new Set(f);return T.add(d),T}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:m,handleKeyboardSelection:p,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function si(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=si(a.subtasks,t);if(r)return r}return null}function ii(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let f=[];return {tasks:d.filter(N=>{if(g.has(N.id))return f.push(N),false;if(N.subtasks){let c=n(N.subtasks,g);N.subtasks=c.tasks,f.push(...c.removed);}return true}),removed:f}},m=(d,g,f)=>d.map(T=>T.id===g?{...T,subtasks:[...T.subtasks||[],...f],isExpanded:true}:T.subtasks?{...T,subtasks:m(T.subtasks,g,f)}:T),p=new Set(t),{tasks:i,removed:u}=n(e,p);return m(i,s.id,u)}function li(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=si(a,r);if(!o)continue;let s=si(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let f=i[g];if(f.id===u&&f.subtasks){let T=f.subtasks.findIndex(N=>N.id===d);if(T!==-1){let[N]=f.subtasks.splice(T,1);return N}}if(f.subtasks){let T=n(f.subtasks,u,d);if(T)return T}}return null},m=(i,u,d)=>{let g=i.findIndex(f=>f.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let f of i)f.subtasks&&m(f.subtasks,u,d);return i},p=n(a,o.id,r);p&&(s&&s.subtasks?m(s.subtasks,o.id,p):m(a,o.id,p));}return a}function di(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,p)=>{let i=n.findIndex(d=>d.id===m);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,m,p))return true;return false}let u=p==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function ci(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 mi(e,t){let a=[...e];for(let r of t){let o=n=>{let m=n.findIndex(u=>u.id===r);if(m===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let p=n[m],i={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function rc(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"},m=p=>{let i=p.findIndex(d=>d.id===t);if(i===-1){for(let d of p)if(d.subtasks&&m(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return p.splice(u,0,n),true};return m(r),{tasks:r,newTask:n}}function pi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:pi(r.subtasks,t,a)}:r)}function ui(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ui(a.subtasks,t)}:a)}function gi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,m=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,p],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:p}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let m=(p,i)=>{if(!p.subtasks)return false;for(let u of p.subtasks)if(u.id===i||m(u,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=p=>p.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});n=m(n);}return n}function Nn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:p,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:f,onTaskIndent:T,onTaskOutdent:N,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:v,onTaskCreate:l,onTaskRename:k,onCreateSubtask:y,onOpenTaskModal:D,onDeleteRequest:x,onTaskReparent:w}){let B=react.useContext(ho),[M,S]=react.useState(null),[U,$]=react.useState(null),[j,K]=react.useState(""),be=react.useRef(null),[ze,st]=react.useState(null),[Ve,Ae]=react.useState(0),[Z,L]=react.useState(0),[C,W]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[O,R]=react.useState(null),[ne,ce]=react.useState(null),[De,le]=react.useState(null),Be=react.useRef(0),Se=5,Fe=react.useRef(false),[xe,We]=react.useState(null),[je,z]=react.useState(false),[re,se]=react.useState(null),[Ce,Oe]=react.useState(false),at=react.useRef(null);react.useEffect(()=>{function _(ee){at.current&&!at.current.contains(ee.target)&&Oe(false);}if(Ce)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Ce]),react.useEffect(()=>{U&&be.current&&(be.current.focus(),be.current.select());},[U]),react.useEffect(()=>{if(!ze)return;let _=Pe=>{let Je=Pe.clientX-Ve,_e=Z+Je;g?.(ze,_e);},ee=()=>{st(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ee),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ee),document.body.style.cursor="",document.body.style.userSelect="";}},[ze,Ve,Z,g]);let{selectedTaskIds:kt,handleTaskClick:Le,isTaskSelected:It}=tc(),{setIsEditing:Mt}=Zd({tasks:e,selectedTaskIds:kt,onTaskSelect:(_,ee)=>{let Je=vo(e).map(_e=>_e.id);Le(_,Je,ee||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:T||(()=>{}),onTaskOutdent:N||(()=>{}),onTaskRename:_=>{let ee=vo(e).find(Pe=>Pe.id===_);ee&&ue(ee);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let ee=vo(e).find(Pe=>Pe.id===_);ee&&D&&D(ee);},enableKeyboard:true}),Dt=(_,ee=0)=>{let Pe=[];for(let Je of _)Pe.push({task:Je,level:ee}),Je.subtasks&&Je.subtasks.length>0&&Je.isExpanded&&Pe.push(...Dt(Je.subtasks,ee+1));return Pe},Qe=Dt(e),bt=48,ua=Math.max(Qe.length*a,600-bt),te=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,ue=_=>{$(_.id),K(_.name),Mt(true);},yt=_=>{j.trim()&&j!==e.find(ee=>ee.id===_)?.name&&k?.(_,j.trim()),$(null),K(""),Mt(false);},ie=()=>{$(null),K(""),Mt(false);},E=(_,ee)=>{ee.stopPropagation(),y?.(_.id);},q=(_,ee)=>{ee.preventDefault(),Be.current=ee.clientY,R(_),Fe.current=false,z(false),We({x:ee.clientX,y:ee.clientY});},ge=_=>{if(!O||(Math.abs(_.clientY-Be.current)>Se&&!Fe.current&&(Fe.current=true,z(true)),We({x:_.clientX,y:_.clientY}),!Fe.current))return;let Pe=document.querySelectorAll("[data-task-row]"),Je=null,_e=null;Pe.forEach(G=>{let de=G.getBoundingClientRect(),$e=G.getAttribute("data-task-row");if($e&&$e!==O&&_.clientY>=de.top&&_.clientY<=de.bottom){Je=$e;let Ft=_.clientY-de.top,rt=de.height;Ft<rt*.25?_e="above":Ft>rt*.75?_e="below":_e="child";}}),ce(Je),le(_e);},Me=()=>{if(Fe.current&&O&&ne&&De){if(De==="child")w?.(O,ne);else if(De==="above"||De==="below"){let _=(Je,_e,G=null)=>{for(let de of Je){if(de.id===_e)return G;if(de.subtasks){let $e=_(de.subtasks,_e,de.id);if($e!==void 0)return $e}}},ee=_(e,ne,null),Pe=(Je,_e)=>{let G=Je.findIndex(de=>de.id===_e);return De==="below"?G+1:G};if(ee===null){let Je=Pe(e,ne);w?.(O,null,Je);}else {let Je=Qe.find(_e=>_e.task.id===ee)?.task;if(Je?.subtasks){let _e=Pe(Je.subtasks,ne);w?.(O,ee,_e);}}}}R(null),ce(null),le(null),We(null),Fe.current=false,z(false);};react.useEffect(()=>{if(O)return document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Me),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Me),document.body.style.cursor="",document.body.style.userSelect="";}},[O,ne,De]);let Ge=(_,ee,Pe)=>{switch(_.id){case "name":let Je=U===ee.id,_e=M===ee.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:_e?1:.3},onMouseDown:J=>q(ee.id,J),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ee.subtasks&&ee.subtasks.length>0?jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),p?.(ee.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ee.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:ee.color||"#3B82F6",opacity:ee.parentId?.6:1,borderColor:ee.isMilestone?t.accent:"transparent",borderWidth:ee.isMilestone?"2px":"0px"},title:ee.isMilestone?"Milestone":ee.parentId?"Subtask":"Task"})}),Je?jsxRuntime.jsx("input",{ref:be,type:"text",value:j,onChange:J=>K(J.target.value),onKeyDown:J=>{J.key==="Enter"?yt(ee.id):J.key==="Escape"&&ie();},onBlur:()=>yt(ee.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:J=>J.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ee.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ee.parentId?"13px":"14px",fontWeight:ee.isMilestone?600:ee.parentId?400:600,letterSpacing:ee.parentId?"0":"-0.01em"},title:ee.name,children:ee.name}),_e&&!Je&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:J=>E(ee,J),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),ue(ee);},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 de=_.id==="startDate"?"startDate":"endDate",$e=ee[de],Ft=re?.taskId===ee.id&&re?.field===de,rt=J=>J?(typeof J=="string"?new Date(J):J).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:J=>{if(Ft)se(null);else {let Ie=J.currentTarget.getBoundingClientRect();se({taskId:ee.id,field:de,month:$e?typeof $e=="string"?new Date($e):$e:new Date,position:{top:Ie.bottom+4,left:Ie.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:rt($e)})]}),Ft&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>se(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:re?.position.top,left:re?.position.left},onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let J=new Date,Ie=new Date(J);Ie.setDate(J.getDate()+1);let lt=new Date(J);lt.setDate(J.getDate()+7);let oe=new Date(J);return oe.setDate(J.getDate()+14),[{label:"Hoy",date:J},{label:"Ma\xF1ana",date:Ie},{label:"Pr\xF3xima semana",date:lt},{label:"2 semanas",date:oe}].map((St,Re)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Rt=>Rt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Rt=>Rt.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ee.id,{[de]:St.date}),se(null);},children:St.label},Re))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:J=>J.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ee.id,{[de]:void 0}),se(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:()=>se(J=>J?{...J,month:new Date(J.month.getFullYear(),J.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:re?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>se(J=>J?{...J,month:new Date(J.month.getFullYear(),J.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((J,Ie)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:J},Ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=re?.month||new Date,Ie=J.getFullYear(),lt=J.getMonth(),oe=new Date(Ie,lt,1).getDay(),He=new Date(Ie,lt+1,0).getDate(),St=new Date,Re=[];for(let pt=oe-1;pt>=0;pt--)Re.push({day:new Date(Ie,lt,-pt).getDate(),date:new Date(Ie,lt-1,new Date(Ie,lt,-pt).getDate()),isCurrentMonth:false});for(let pt=1;pt<=He;pt++)Re.push({day:pt,date:new Date(Ie,lt,pt),isCurrentMonth:true});let Rt=42-Re.length;for(let pt=1;pt<=Rt;pt++)Re.push({day:pt,date:new Date(Ie,lt+1,pt),isCurrentMonth:false});return Re.map((pt,ha)=>{let Gt=pt.date.toDateString()===St.toDateString(),Et=($e?typeof $e=="string"?new Date($e):$e:null)?.toDateString()===pt.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:pt.isCurrentMonth?Et?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Et?"#3B82F6":"transparent",boxShadow:Gt&&!Et?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(ee.id,{[de]:pt.date}),se(null);},children:pt.day},ha)})})()})]})]})]}),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:te(ee)})});case "assignees":let xa=r.filter(J=>ee.assignees?.some(Ie=>Ie.name===J.name||Ie.initials===J.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:xa,availableUsers:r,onChange:J=>{let Ie=J.map(lt=>({id:lt.id,name:lt.name,initials:lt.initials,color:lt.color}));f?.(ee.id,{assignees:Ie.length>0?Ie:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:ee.status||"todo",onChange:J=>{f?.(ee.id,{status:J,progress:J==="completed"?100:ee.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:`${ee.progress}%`,backgroundColor:ee.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:[ee.progress,"%"]})]});case "priority":let fa={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},P={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ve=fa[ee.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Or,{priority:ve,onChange:J=>{J&&f?.(ee.id,{priority:P[J]||"medium"});}})});default:return null}},Xe=_=>[{id:"hide",label:"Hide Column",icon:Ht.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ht.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ht.SortDesc,onClick:()=>{}}],Ue=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{y?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{x?x(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{y?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{f?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{f?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{f?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{x?x(_.id,_.name):b?.([_.id]);}}],it=u.filter(_=>_.visible),mt=it.reduce((_,ee)=>_+ee.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:mt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${bt}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:it.map((_,ee)=>{let Pe=ee===it.length-1,Je=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Je?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Je?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:_e=>{_e.preventDefault(),W({isOpen:true,x:_e.clientX,y:_e.clientY,type:"header",columnId:_.id});},onMouseEnter:_e=>{_e.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:_e=>{_e.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:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ze===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:_e=>{_e.preventDefault(),_e.stopPropagation(),st(_.id),Ae(_e.clientX),L(_.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"}})})]},_.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(wn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Oe(!Ce),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"})}),Ce&&jsxRuntime.jsxs("div",{ref:at,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:_=>_.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:()=>Oe(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:ua},children:Qe.map(({task:_,level:ee},Pe)=>{let Je=It(_.id),_e=ne===_.id,G=_e&&De==="above",de=_e&&De==="below",$e=_e&&De==="child",Ft={};return $e&&(Ft.backgroundColor=`${t.accent}15`,Ft.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${O===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Je?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Je?t.accentLight:$e?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...Ft},onMouseEnter:()=>S(_.id),onMouseLeave:()=>S(null),onClick:rt=>{let fa=vo(e).map(J=>J.id),ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?rt.metaKey:rt.ctrlKey;Le(_.id,fa,ve,rt.shiftKey),s?.(_);},onDoubleClick:rt=>{rt.stopPropagation(),n?.(_);},onContextMenu:rt=>{rt.preventDefault(),W({isOpen:true,x:rt.clientX,y:rt.clientY,type:"task",task:_}),m?.(_,rt);},whileHover:{backgroundColor:Je?t.accentLight:t.hoverBg},children:[G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),it.map((rt,xa)=>{let fa=xa===it.length-1,P=rt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${rt.width}px`,minWidth:`${rt.minWidth??(P?200:60)}px`,maxWidth:`${rt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fa?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ge(rt,_,P?ee:0)},`${_.id}-${rt.id}`)})]},_.id)})}),jsxRuntime.jsx(yo,{isOpen:C.isOpen,x:C.x,y:C.y,items:C.type==="header"&&C.columnId?Xe(C.columnId):C.type==="task"&&C.task?Ue(C.task):[],onClose:()=>W({...C,isOpen:false}),theme:t}),je&&xe&&O&&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 _=Qe.find(ee=>ee.task.id===O)?.task;return _?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:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[p,i]=react.useState(t),[u,d]=react.useState(null),[g,f]=react.useState(null),[T,N]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(0),[k,y]=react.useState(0),[D,x]=react.useState(null),[w,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:p,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:f,activeZone:T,setActiveZone:N,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:v,setDraggedSegmentStartX:l,segmentDragOffsetX:k,setSegmentDragOffsetX:y,hoveredSegmentIndex:D,setHoveredSegmentIndex:x,isHovered:w,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,K)=>{r("none"),d(null),f(null),m(j),i(K),y(0),b(null),l(0);}}}function Dn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:p,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:T,onHoverChange:N}){let c=dc(t,r),b=react.useRef(null),{dragMode:v,setDragMode:l,dragOffset:k,setDragOffset:y,ghostX:D,setGhostX:x,ghostWidth:w,setGhostWidth:B,connectionLine:M,setConnectionLine:S,hoveredTaskId:U,setHoveredTaskId:$,activeZone:j,setActiveZone:K,draggedSegmentIndex:be,setDraggedSegmentIndex:ze,draggedSegmentStartX:st,setDraggedSegmentStartX:Ve,segmentDragOffsetX:Ae,setSegmentDragOffsetX:Z,hoveredSegmentIndex:L,setHoveredSegmentIndex:C,isHovered:W,setIsHovered:O,isDragging:R,isResizing:ne,isConnecting:ce,resetDragState:De}=c,le=32,Be=8,Se=e.endDate&&e.endDate<new Date&&e.progress<100,Fe=e.isCriticalPath,xe=o.name==="neutral"||o.today==="#1C1917",We=e.status==="completed"||e.progress===100,je={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},re=e.isCriticalPath||Se?"#DC2626":e.color?e.color:e.priority&&je[e.priority]?je[e.priority]:o.taskBarPrimary,Ce=(ie=>ie>=80?20:ie>=60?15:ie>=50?12:10)(r),Oe=r<50,at=r<40;react.useEffect(()=>{if(N)if(W&&!R&&!e.segments){let ie=a<100;N({task:e,x:t,y:a,width:r,height:le,showBelow:ie});}else N(null);},[W,R,e,t,a,r,le,N]);let kt=ie=>ie.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Le=()=>{let ie=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ie} day${ie!==1?"s":""}`},It=ie=>Math.round(ie/s)*s,Mt=ie=>{let E=Math.round(ie/s),q=new Date(n);return q.setDate(q.getDate()+E),q},Dt=(ie,E)=>{for(let q of f){if(q.id===e.id)continue;let ge=5;if(ie>=q.x-ge&&ie<=q.x+q.width+ge&&E>=q.y-ge&&E<=q.y+q.height+ge)return q.id}return null},Qe=react.useCallback((ie,E,q)=>{ie.preventDefault(),ie.stopPropagation();let ge=b.current?.ownerSVGElement;if(!ge)return;let Me=ge.createSVGPoint();Me.x=ie.clientX,Me.y=ie.clientY;let Ge=Me.matrixTransform(ge.getScreenCTM()?.inverse()),Xe=q!==void 0?q:t,Ue=E;if(!Ue){let it=Ge.x-Xe;ie.shiftKey?(Ue="connect",S({x:t+r,y:a+le/2})):ie.ctrlKey||ie.metaKey?Ue="move":ie.altKey?Ue=it<r/2?"resize-start":"resize-end":at?it<r/2?Ue="move":Ue="resize-end":Oe?it<=Ce/2?Ue="resize-start":it>=r-Ce/2?Ue="resize-end":Ue="move":it<=Ce?Ue="resize-start":it>=r-Ce?Ue="resize-end":Ue="move";}l(Ue),O(false),K(null),Ue==="move"?y(Ge.x-Xe):Ue==="connect"?S({x:t+r,y:a+le/2}):y(0),x(Xe),B(r);},[t,r,a,le]),bt=react.useCallback(ie=>{if(v==="none")return;let E=b.current?.ownerSVGElement;if(!E)return;let q=E.createSVGPoint();q.x=ie.clientX,q.y=ie.clientY;let ge=q.matrixTransform(E.getScreenCTM()?.inverse());if(v==="connect"){S({x:ge.x,y:ge.y});let Me=Dt(ge.x,ge.y);$(Me);}else if(v==="move"){let Me=ge.x-k,Ge=It(Me);x(Ge),B(r);let Xe=Math.round((Ge-t)/s);if(T?.(e.id,Xe,true),e.segments&&e.segments.length>0&&be!==null){let Ue=Ge-st;Z(Ue);}}else if(v==="resize-start"){let Me=ge.x,Ge=It(Me),Xe=t+r-Ge;Xe>=s&&(x(Ge),B(Xe));}else if(v==="resize-end"){let Me=ge.x,Xe=It(Me)-t;Xe>=s&&B(Xe);}},[v,t,r,s,k,e,It,be,st,Dt,$,S,x,B,Z,T]),ua=react.useCallback(()=>{if(v!=="none"){if(v==="connect")U&&g&&g(e,U),S(null),$(null);else {let ie=e.endDate.getTime()-e.startDate.getTime(),E,q,ge=true;if(v==="move"){if(E=Mt(D),q=new Date(E.getTime()+ie),e.segments&&e.segments.length>0&&be!==null){let Me=Math.round(Ae/s),Ge=e.segments.map((mt,_)=>{if(_===be){let ee=new Date(mt.startDate),Pe=new Date(mt.endDate);return ee.setDate(ee.getDate()+Me),Pe.setDate(Pe.getDate()+Me),{startDate:ee,endDate:Pe}}return mt}),Xe=Ge.flatMap(mt=>[mt.startDate,mt.endDate]),Ue=new Date(Math.min(...Xe.map(mt=>mt.getTime()))),it=new Date(Math.max(...Xe.map(mt=>mt.getTime())));d?.({...e,segments:Ge},Ue,it),De(t,r);return}}else v==="resize-start"?(E=Mt(D),q=e.endDate,E>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),ge=false)):v==="resize-end"?(E=e.startDate,q=Mt(D+w),q<E&&(console.warn("Invalid date range: end date must be after or equal to start date"),ge=false)):ge=false;ge&&E&&q&&(q.getTime()<E.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,E,q));}T?.(e.id,0,false),De(t,r);}},[v,D,w,e,d,U,g,t,r,s,Mt,Ae,be,De,T]);react.useEffect(()=>{if(v==="none")return;let ie=q=>{bt(q);},E=()=>{ua();};return window.addEventListener("mousemove",ie),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",ie),window.removeEventListener("mouseup",E);}},[v,bt,ua]);let te=R&&!ce?D:t,ue=R&&!ce?w:r,yt=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!R&&p?.(e),onDoubleClick:ie=>{R||(ie.stopPropagation(),i?.(e));},onContextMenu:ie=>{ie.preventDefault(),u?.(e,ie);},onMouseEnter:()=>!R&&O(true),onMouseLeave:()=>{R||(O(false),K(null));},children:[W&&!R&&!Oe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ce,height:le,fill:j==="resize-start"?o.accent:"transparent",opacity:j==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-start"),onMouseDown:ie=>Qe(ie,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ce,y:a,width:r-Ce*2,height:le,fill:j==="move"?o.accent:"transparent",opacity:j==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:ie=>Qe(ie,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ce,y:a,width:Ce,height:le,fill:j==="resize-end"?o.accent:"transparent",opacity:j==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:ie=>Qe(ie,"resize-end")})]}),W&&!R&&at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:le,fill:j==="move"?o.accent:"transparent",opacity:j==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:ie=>Qe(ie,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:le,fill:j==="resize-end"?o.accent:"transparent",opacity:j==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:ie=>Qe(ie,"resize-end")}),W&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+le-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),R&&!ce&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:D,y:a,width:w,height:le,rx:Be,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:te,y:a,width:ue,height:le,rx:Be,fill:re,"data-task-class":yt,initial:{opacity:0,scale:.95},animate:{opacity:R&&!ce?.15:e.parentId?.6:W?.9:.8,scale:W&&!R?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ie=>Qe(ie),style:{cursor:R?ce?"crosshair":ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:te,y:a,width:ue*(e.progress/100),height:le,rx:Be,fill:re,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ie,E)=>{let q=(ie.startDate.getTime()-n.getTime())/864e5*s,Me=(ie.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Ge=R&&v==="move"&&be===E,Xe=L===E,Ue=Ge?q+Ae:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!R&&C(E),onMouseLeave:()=>!R&&C(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue,y:a,width:Me,height:le,rx:Be,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:Ge||e.parentId?.6:Xe?.9:.8,scale:Xe&&!R?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:it=>{it.stopPropagation(),ze(E),Ve(q),Qe(it,void 0,q);},style:{cursor:R?ce?"crosshair":ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ue,y:a,width:Me*(e.progress/100),height:le,rx:Be,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${E}`)}),xe&&(Se||Fe)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Fe&&!Se&&jsxRuntime.jsx("rect",{x:te,y:a,width:ue,height:le,rx:Be,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Se&&jsxRuntime.jsx("rect",{x:te,y:a,width:ue,height:le,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let ie=m.taskLabel(e),E=typeof ie=="string"?ie:e.name,q=E.length>Math.floor(ue/8)?`${E.substring(0,Math.floor(ue/8))}...`:E;return jsxRuntime.jsx("text",{x:te+12,y:a+le/2,dominantBaseline:"middle",fill:We?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:We?"line-through":"none"},children:q})})(),ue>100&&e.progress>0&&e.progress<100&&!R&&!e.segments&&jsxRuntime.jsxs("text",{x:te+ue-12,y:a+le/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&&ue>80&&!R&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:te+ue-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:te+ue-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(W||ne)&&!ce&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:te-2,y:a,width:16,height:le,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>K("resize-start"),onMouseLeave:()=>K(null),onMouseDown:ie=>{ie.stopPropagation(),Qe(ie,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:te+4,y:a+8,width:3,height:le-16,rx:1.5,fill:j==="resize-start"||v==="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:te+ue-14,y:a,width:16,height:le,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>K("resize-end"),onMouseLeave:()=>K(null),onMouseDown:ie=>{ie.stopPropagation(),Qe(ie,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:te+ue-7,y:a+8,width:3,height:le-16,rx:1.5,fill:j==="resize-end"||v==="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:W&&!R&&!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+18,cy:a+le/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>K("connect"),onMouseLeave:()=>K(null),onMouseDown:ie=>{ie.stopPropagation(),Qe(ie,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+18,cy:a+le/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:j==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsxRuntime.jsx("text",{x:t+r+32,y:a+le/2,dominantBaseline:"middle",fill:j==="connect"?o.accent:o.textTertiary,fontSize:j==="connect"?"11":"10",fontWeight:j==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ce&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+le/2,x2:M.x,y2:M.y,stroke:U?o.statusCompleted:o.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:U?8:6,fill:U?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(W||R)&&!ce&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te-2,y:a-2,width:ue+4,height:le+4,rx:Be+2,fill:"none",stroke:R?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:R?.6:.4,initial:{opacity:0},animate:{opacity:R?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:D+w,y1:0,x2:D+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&!R&&!e.segments&&!N&&(()=>{let q=a<100,ge=q?a+le+13:a-82-13,Me=q?`M ${te+ue/2-6} ${a+le+3} L ${te+ue/2} ${a+le+13} L ${te+ue/2+6} ${a+le+3}`:`M ${te+ue/2-6} ${a-13} L ${te+ue/2} ${a-3} L ${te+ue/2+6} ${a-13}`,Ge=ge+22,Xe=ge+40,Ue=ge+55,it=ge+70,mt=q?ge+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:te+ue/2-120,y:ge,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:te+ue/2,y:Ge,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:te+ue/2-110,y:Xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:te+ue/2-70,y:Xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:kt(e.startDate)}),jsxRuntime.jsx("text",{x:te+ue/2-110,y:Ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:te+ue/2-70,y:Ue,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:kt(e.endDate)}),jsxRuntime.jsx("text",{x:te+ue/2+10,y:Xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:te+ue/2+65,y:Xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Le()}),jsxRuntime.jsx("text",{x:te+ue/2+10,y:Ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:te+ue/2+65,y:Ue,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:te+ue/2-110,y:it,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:te+ue/2-50,y:it,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_=>_.name).join(", ").substring(0,30),e.assignees.map(_=>_.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:te+ue/2,y:mt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":Oe?"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 pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,p=82,i=13,u=m?o+n+i:o-p-i,d=m?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,f=u+40,T=u+55,N=u+70,c=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:p,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:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:N,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:N,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Pn({x1:e,y1:t,x2:a,y2:r,verticalX:o,routeY:s,fromIndex:n,toIndex:m,rowHeight:p,theme:i,onDelete:u,onHoverChange:d,lineStyle:g="curved"}){let[f,T]=react.useState(false),N=a-e,c=e+N/2,b=56,v=5,l=n!==void 0?n*b+44+6:s??t+22,k,y=a<e,D=v,x=o??(y?e+20:a-20);if(g==="squared")k=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`;else {let K=r>t;if(Math.abs(r-t)<5){let be=Math.min(Math.abs(N)/3,30);k=`M ${e} ${t} C ${e+be} ${t}, ${a-be} ${r}, ${a} ${r}`;}else y?K?k=`M ${e} ${t} L ${x-D} ${t} Q ${x} ${t} ${x} ${t+D} L ${x} ${r-D} Q ${x} ${r} ${x-D} ${r} L ${a} ${r}`:k=`M ${e} ${t} L ${x-D} ${t} Q ${x} ${t} ${x} ${t-D} L ${x} ${r+D} Q ${x} ${r} ${x-D} ${r} L ${a} ${r}`:K?k=`M ${e} ${t} L ${x-D} ${t} Q ${x} ${t} ${x} ${t+D} L ${x} ${r-D} Q ${x} ${r} ${x+D} ${r} L ${a} ${r}`:k=`M ${e} ${t} L ${x-D} ${t} Q ${x} ${t} ${x} ${t-D} L ${x} ${r+D} Q ${x} ${r} ${x+D} ${r} L ${a} ${r}`;}let w=5,B=a-w,M=r-w*.5,S=a-w,U=r+w*.5,$=i.dependency;react.useEffect(()=>{d&&u&&d(f?{x1:e,y1:t,x2:a,y2:r,verticalX:x,routeY:l,onDelete:u,lineStyle:g}:null);},[f,e,t,a,r,x,l,u,d,g]);let j=!u&&!d;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&T(true),onMouseLeave:()=>!j&&T(false),style:{pointerEvents:j?"none":"auto"},children:[!j&&jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:$,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:f&&d?0:f?1:.8,strokeWidth:f?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${B} ${M} M ${a} ${r} L ${S} ${U}`,fill:"none",stroke:$,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:f&&d?0:f?1:.8,scale:f?1.1:1,strokeWidth:f?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:$,initial:{scale:0},animate:{scale:f&&d?0:f?1.3:1,opacity:f&&d?0:f?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),f&&u&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:K=>{K.stopPropagation(),u();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:i.bgSecondary,stroke:i.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:i.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:i.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function An({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,p=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:p(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 he={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,m=new Set,p=i=>{if(!n.has(i)){n.add(i),m.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&p(d))return true;if(m.has(d))return true}}return m.delete(i),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=he.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=he.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=he.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=he.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(`
|
|
112
|
-
`)},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=he.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=he.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)=>he.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=he.findTaskById(e,t);return !a||!a.dependencies?[]:he.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>he.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>he.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=he.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=>he.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=he.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"]],m=s.map(p=>{let i=p.startDate&&p.endDate?he.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?he.formatDate(p.startDate):"N/A",p.endDate?he.formatDate(p.endDate):"N/A",i>0?`${i} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:n,body:m,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=he.flattenTasks(e).map(p=>{let i=p.startDate&&p.endDate?he.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?he.formatDate(p.startDate):"","End Date":p.endDate?he.formatDate(p.endDate):"","Duration (days)":i>0?i:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(u=>u.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.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 m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=he.flattenTasks(e),o=new Map;r.forEach((g,f)=>{o.set(g.id,f+1);});let s=g=>g.toISOString().replace("Z",""),n=he.getEarliestStartDate(e)||new Date,m=he.getLatestEndDate(e)||new Date,p=r.map((g,f)=>{let
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _s({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},p=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:h("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:h("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(p).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(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: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: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 js({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[p,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let T=o?.current||void 0,c=await Sl(e,p,T);El(c,p);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),v=c.name.endsWith(".json")?"json":"csv",l=Ml(b,v);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:h("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:()=>m("export"),className:h("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:()=>m("import"),className:h("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(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:h("p-4 rounded-lg border-2 transition-all text-center",p===T?"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:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),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:C,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"})]})]}),u&&jsxRuntime.jsxs("div",{className:h("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:h("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((T,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Ug=["URGENT","HIGH","MEDIUM","LOW"],Hg=[{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"}],Wg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ks({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:p=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:f="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(D=>{a({search:D.target.value});},[a]),v=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),l=react.useCallback(D=>{r({by:D.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),y=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":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:T?"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"}),y&&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)"]})]}),!T&&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"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:D=>{let k=D.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ug.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let k=D.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let k=D.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),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:l,className:"filter-bar__select filter-bar__select--sm",children:Hg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.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"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:D=>C(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Wg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),y&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:p}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let g=f=>{f(),u(false);};return jsxRuntime.jsxs("div",{className:h("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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 m?.()),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(()=>p?.()),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 qs={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"}},Xs={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"}},Js={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"}},jr={dark:qs,light:Xs,neutral:Js},bn="dark";var yn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=bn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,p=jr[r];Object.entries(p.colors).forEach(([u,d])=>{d&&m.style.setProperty(`--theme-${Qg(u)}`,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(([u,d])=>{let g=p.colors[u];g&&m.style.setProperty(d,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:jr};return jsxRuntime.jsx(yn.Provider,{value:n,children:e})}function go(){let e=react.useContext(yn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Qg(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:h("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(jr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:h("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 Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Je[e]||Je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Je[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Je[e].bgSecondary),bgGrid:r("--theme-bg-card",Je[e].bgGrid),bgWeekend:r("--theme-bg-hover",Je[e].bgWeekend),border:r("--theme-border-primary",Je[e].border),borderLight:r("--theme-border-subtle",Je[e].borderLight),textPrimary:r("--theme-text-primary",Je[e].textPrimary),textSecondary:r("--theme-text-secondary",Je[e].textSecondary),textTertiary:r("--theme-text-tertiary",Je[e].textTertiary),accent:r("--theme-accent-primary",Je[e].accent),accentHover:r("--theme-accent-hover",Je[e].accentHover),accentLight:r("--theme-accent-primary",Je[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Je[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Je[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Je[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Je[e].dependency),dependencyHover:r("--theme-border-secondary",Je[e].dependencyHover),criticalPath:r("--theme-error",Je[e].criticalPath),criticalPathLight:r("--theme-error",Je[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Je[e].today):e==="neutral"?r("--theme-text-primary",Je[e].today):r("--theme-error",Je[e].today),todayLight:e==="light"?r("--theme-accent-primary",Je[e].todayLight):e==="neutral"?r("--theme-text-primary",Je[e].todayLight):r("--theme-error",Je[e].todayLight),milestone:r("--theme-warning",Je[e].milestone),milestoneLight:r("--theme-warning",Je[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Je[e].statusTodo),statusInProgress:r("--theme-accent-primary",Je[e].statusInProgress),statusCompleted:r("--theme-success",Je[e].statusCompleted),hoverBg:r("--theme-bg-hover",Je[e].hoverBg),focusRing:r("--theme-accent-primary",Je[e].focusRing)}}var vn={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:"Filter",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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"},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"}},Hd={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:"Filtrar",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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"},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"}},Qs={en:vn,es:Hd};function Wd(e){return Qs[e]||Qs.en}function ei(e,t){let a=Wd(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 ho=react.createContext(vn);function bo(){return react.useContext(ho)}function hf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,p]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&p(false);};return m&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[m]),!(t||a||r||o||s||n))return null;let C=[{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(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(v){console.error(`Export ${c} failed:`,v);}finally{u(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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:C.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):c.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:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function bf({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 yf({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 vf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],p=m.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"}: ${p}`,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:m.map((i,u)=>{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:u<m.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:u*.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 xf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],p=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p||r?e.accentLight:e.bgSecondary,border:`1px solid ${p||r?e.accent:e.borderLight}`,color:p||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),p&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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-56 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:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),p&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function kn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:p,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:f="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:v,onExportJSON:l,onExportMSProject:x}){let y=bo(),D=T||c||b||v||l||x,k=[{value:"day",label:y.toolbar.day},{value:"week",label:y.toolbar.week},{value:"month",label:y.toolbar.month}],w=[{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(yf,{options:k,value:t,onChange:B=>a(B),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(vf,{theme:e,value:m,onChange:p}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(xf,{theme:e,value:f,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&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:d||y.toolbar.createTask})]}),(D||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:v,onExportJSON:l,onExportMSProject:x}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(bf,{options:w,value:s,onChange:B=>n(B),theme:e})]})]})}function wn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{m.current&&!m.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let u=p.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[m,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,f=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>f&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),p({x:T,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var zt={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"}),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 Qd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:p,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let f=react.useRef(false),C=react.useCallback(l=>{f.current=l;},[]),T=react.useCallback(l=>{let x=[],y=D=>{for(let k of D)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&y(k.subtasks);};return y(l),x},[]),c=react.useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=react.useCallback((l,x)=>{let y=T(e);if(y.length===0)return;let D=c();if(!D){a(y[0].id,false);return}let k=y.findIndex(M=>M.id===D.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=y.length)return;let B=y[w];a(B.id,x);},[e,c,T,a]),v=react.useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){l.key==="Escape"&&(x.blur(),f.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),B=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(B&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!B.isExpanded||l.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){B&&(l.preventDefault(),r(B.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){B&&(l.preventDefault(),r(B.id,"above"));return}if(l.key==="Enter"&&k){B&&(l.preventDefault(),d(B.id));return}if(l.key==="F2"){B&&(l.preventDefault(),i(B.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,m,p,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[g,v]),{setIsEditing:C}}function tc(){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(g=>{let f=new Set(g);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let f=g.indexOf(a),C=g.indexOf(d);if(f===-1||C===-1){o(d);return}let T=Math.min(f,C),c=Math.max(f,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),m=react.useCallback((d,g,f,C)=>{C?n(d,g):f?s(d):o(d);},[o,s,n]),p=react.useCallback((d,g)=>{g?t(f=>{let C=new Set(f);return C.add(d),C}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:m,handleKeyboardSelection:p,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function si(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=si(a.subtasks,t);if(r)return r}return null}function ii(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let f=[];return {tasks:d.filter(T=>{if(g.has(T.id))return f.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,f.push(...c.removed);}return true}),removed:f}},m=(d,g,f)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...f],isExpanded:true}:C.subtasks?{...C,subtasks:m(C.subtasks,g,f)}:C),p=new Set(t),{tasks:i,removed:u}=n(e,p);return m(i,s.id,u)}function li(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=si(a,r);if(!o)continue;let s=si(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let f=i[g];if(f.id===u&&f.subtasks){let C=f.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=f.subtasks.splice(C,1);return T}}if(f.subtasks){let C=n(f.subtasks,u,d);if(C)return C}}return null},m=(i,u,d)=>{let g=i.findIndex(f=>f.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let f of i)f.subtasks&&m(f.subtasks,u,d);return i},p=n(a,o.id,r);p&&(s&&s.subtasks?m(s.subtasks,o.id,p):m(a,o.id,p));}return a}function di(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,p)=>{let i=n.findIndex(d=>d.id===m);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,m,p))return true;return false}let u=p==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function ci(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 mi(e,t){let a=[...e];for(let r of t){let o=n=>{let m=n.findIndex(u=>u.id===r);if(m===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let p=n[m],i={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function rc(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"},m=p=>{let i=p.findIndex(d=>d.id===t);if(i===-1){for(let d of p)if(d.subtasks&&m(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return p.splice(u,0,n),true};return m(r),{tasks:r,newTask:n}}function pi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:pi(r.subtasks,t,a)}:r)}function ui(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ui(a.subtasks,t)}:a)}function gi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,m=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,p],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:p}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let m=(p,i)=>{if(!p.subtasks)return false;for(let u of p.subtasks)if(u.id===i||m(u,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=p=>p.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});n=m(n);}return n}function Nn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:p,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:f,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:v,onTaskCreate:l,onTaskRename:x,onCreateSubtask:y,onOpenTaskModal:D,onDeleteRequest:k,onTaskReparent:w}){let B=react.useContext(ho),[M,S]=react.useState(null),[z,$]=react.useState(null),[K,Y]=react.useState(""),ye=react.useRef(null),[Oe,nt]=react.useState(null),[_e,Ae]=react.useState(0),[Q,L]=react.useState(0),[N,W]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[U,R]=react.useState(null),[se,pe]=react.useState(null),[Ne,ie]=react.useState(null),Le=react.useRef(0),Ee=5,De=react.useRef(false),[He,ht]=react.useState(null),[et,O]=react.useState(false),[te,le]=react.useState(null),[Ce,$e]=react.useState(false),tt=react.useRef(null);react.useEffect(()=>{function _(ee){tt.current&&!tt.current.contains(ee.target)&&$e(false);}if(Ce)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Ce]),react.useEffect(()=>{z&&ye.current&&(ye.current.focus(),ye.current.select());},[z]),react.useEffect(()=>{if(!Oe)return;let _=Pe=>{let qe=Pe.clientX-_e,Ge=Q+qe;g?.(Oe,Ge);},ee=()=>{nt(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ee),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ee),document.body.style.cursor="",document.body.style.userSelect="";}},[Oe,_e,Q,g]);let{selectedTaskIds:xt,handleTaskClick:Me,isTaskSelected:Lt}=tc(),{setIsEditing:At}=Qd({tasks:e,selectedTaskIds:xt,onTaskSelect:(_,ee)=>{let qe=vo(e).map(Ge=>Ge.id);Me(_,qe,ee||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ee=vo(e).find(Pe=>Pe.id===_);ee&&re(ee);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let ee=vo(e).find(Pe=>Pe.id===_);ee&&D&&D(ee);},enableKeyboard:true}),ct=(_,ee=0)=>{let Pe=[];for(let qe of _)Pe.push({task:qe,level:ee}),qe.subtasks&&qe.subtasks.length>0&&qe.isExpanded&&Pe.push(...ct(qe.subtasks,ee+1));return Pe},Xe=ct(e),Ht=48,sa=Math.max(Xe.length*a,600-Ht),ae=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,re=_=>{$(_.id),Y(_.name),At(true);},Vt=_=>{K.trim()&&K!==e.find(ee=>ee.id===_)?.name&&x?.(_,K.trim()),$(null),Y(""),At(false);},de=()=>{$(null),Y(""),At(false);},E=(_,ee)=>{ee.stopPropagation(),y?.(_.id);},q=(_,ee)=>{ee.preventDefault(),Le.current=ee.clientY,R(_),De.current=false,O(false),ht({x:ee.clientX,y:ee.clientY});},ge=_=>{if(!U||(Math.abs(_.clientY-Le.current)>Ee&&!De.current&&(De.current=true,O(true)),ht({x:_.clientX,y:_.clientY}),!De.current))return;let Pe=document.querySelectorAll("[data-task-row]"),qe=null,Ge=null;Pe.forEach(G=>{let ce=G.getBoundingClientRect(),Re=G.getAttribute("data-task-row");if(Re&&Re!==U&&_.clientY>=ce.top&&_.clientY<=ce.bottom){qe=Re;let Pt=_.clientY-ce.top,at=ce.height;Pt<at*.25?Ge="above":Pt>at*.75?Ge="below":Ge="child";}}),pe(qe),ie(Ge);},Ie=()=>{if(De.current&&U&&se&&Ne){if(Ne==="child")w?.(U,se);else if(Ne==="above"||Ne==="below"){let _=(qe,Ge,G=null)=>{for(let ce of qe){if(ce.id===Ge)return G;if(ce.subtasks){let Re=_(ce.subtasks,Ge,ce.id);if(Re!==void 0)return Re}}},ee=_(e,se,null),Pe=(qe,Ge)=>{let G=qe.findIndex(ce=>ce.id===Ge);return Ne==="below"?G+1:G};if(ee===null){let qe=Pe(e,se);w?.(U,null,qe);}else {let qe=Xe.find(Ge=>Ge.task.id===ee)?.task;if(qe?.subtasks){let Ge=Pe(qe.subtasks,se);w?.(U,ee,Ge);}}}}R(null),pe(null),ie(null),ht(null),De.current=false,O(false);};react.useEffect(()=>{if(U)return document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ie),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ie),document.body.style.cursor="",document.body.style.userSelect="";}},[U,se,Ne]);let We=(_,ee,Pe)=>{switch(_.id){case "name":let qe=z===ee.id,Ge=M===ee.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:Ge?1:.3},onMouseDown:J=>q(ee.id,J),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ee.subtasks&&ee.subtasks.length>0?jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),p?.(ee.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ee.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:ee.color||"#3B82F6",opacity:ee.parentId?.6:1,borderColor:ee.isMilestone?t.accent:"transparent",borderWidth:ee.isMilestone?"2px":"0px"},title:ee.isMilestone?"Milestone":ee.parentId?"Subtask":"Task"})}),qe?jsxRuntime.jsx("input",{ref:ye,type:"text",value:K,onChange:J=>Y(J.target.value),onKeyDown:J=>{J.key==="Enter"?Vt(ee.id):J.key==="Escape"&&de();},onBlur:()=>Vt(ee.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:J=>J.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ee.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ee.parentId?"13px":"14px",fontWeight:ee.isMilestone?600:ee.parentId?400:600,letterSpacing:ee.parentId?"0":"-0.01em"},title:ee.name,children:ee.name}),Ge&&!qe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:J=>E(ee,J),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),re(ee);},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 ce=_.id==="startDate"?"startDate":"endDate",Re=ee[ce],Pt=te?.taskId===ee.id&&te?.field===ce,at=J=>J?(typeof J=="string"?new Date(J):J).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:J=>{if(Pt)le(null);else {let Fe=J.currentTarget.getBoundingClientRect();le({taskId:ee.id,field:ce,month:Re?typeof Re=="string"?new Date(Re):Re:new Date,position:{top:Fe.bottom+4,left:Fe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:at(Re)})]}),Pt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>le(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:te?.position.top,left:te?.position.left},onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let J=new Date,Fe=new Date(J);Fe.setDate(J.getDate()+1);let it=new Date(J);it.setDate(J.getDate()+7);let ne=new Date(J);return ne.setDate(J.getDate()+14),[{label:"Hoy",date:J},{label:"Ma\xF1ana",date:Fe},{label:"Pr\xF3xima semana",date:it},{label:"2 semanas",date:ne}].map((Nt,Be)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:It=>It.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:It=>It.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ee.id,{[ce]:Nt.date}),le(null);},children:Nt.label},Be))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:J=>J.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ee.id,{[ce]:void 0}),le(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:()=>le(J=>J?{...J,month:new Date(J.month.getFullYear(),J.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:te?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>le(J=>J?{...J,month:new Date(J.month.getFullYear(),J.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((J,Fe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:J},Fe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=te?.month||new Date,Fe=J.getFullYear(),it=J.getMonth(),ne=new Date(Fe,it,1).getDay(),Ue=new Date(Fe,it+1,0).getDate(),Nt=new Date,Be=[];for(let pt=ne-1;pt>=0;pt--)Be.push({day:new Date(Fe,it,-pt).getDate(),date:new Date(Fe,it-1,new Date(Fe,it,-pt).getDate()),isCurrentMonth:false});for(let pt=1;pt<=Ue;pt++)Be.push({day:pt,date:new Date(Fe,it,pt),isCurrentMonth:true});let It=42-Be.length;for(let pt=1;pt<=It;pt++)Be.push({day:pt,date:new Date(Fe,it+1,pt),isCurrentMonth:false});return Be.map((pt,ha)=>{let Wt=pt.date.toDateString()===Nt.toDateString(),Dt=(Re?typeof Re=="string"?new Date(Re):Re:null)?.toDateString()===pt.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:pt.isCurrentMonth?Dt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Dt?"#3B82F6":"transparent",boxShadow:Wt&&!Dt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(ee.id,{[ce]:pt.date}),le(null);},children:pt.day},ha)})})()})]})]})]}),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:ae(ee)})});case "assignees":let xa=r.filter(J=>ee.assignees?.some(Fe=>Fe.name===J.name||Fe.initials===J.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:xa,availableUsers:r,onChange:J=>{let Fe=J.map(it=>({id:it.id,name:it.name,initials:it.initials,color:it.color}));f?.(ee.id,{assignees:Fe.length>0?Fe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:ee.status||"todo",onChange:J=>{f?.(ee.id,{status:J,progress:J==="completed"?100:ee.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:`${ee.progress}%`,backgroundColor:ee.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:[ee.progress,"%"]})]});case "priority":let fa={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},P={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ve=fa[ee.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Or,{priority:ve,onChange:J=>{J&&f?.(ee.id,{priority:P[J]||"medium"});}})});default:return null}},Ye=_=>[{id:"hide",label:"Hide Column",icon:zt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:zt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:zt.SortDesc,onClick:()=>{}}],ze=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:zt.Add,onClick:()=>{y?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:zt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:zt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:zt.Add,onClick:()=>{y?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:zt.MarkIncomplete,onClick:()=>{f?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:zt.SetInProgress,onClick:()=>{f?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:zt.MarkComplete,onClick:()=>{f?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:zt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:zt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],st=u.filter(_=>_.visible),mt=st.reduce((_,ee)=>_+ee.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:mt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Ht}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:st.map((_,ee)=>{let Pe=ee===st.length-1,qe=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${qe?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(qe?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ge=>{Ge.preventDefault(),W({isOpen:true,x:Ge.clientX,y:Ge.clientY,type:"header",columnId:_.id});},onMouseEnter:Ge=>{Ge.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ge=>{Ge.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:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Oe===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),nt(_.id),Ae(Ge.clientX),L(_.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"}})})]},_.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(wn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>$e(!Ce),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"})}),Ce&&jsxRuntime.jsxs("div",{ref:tt,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.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:()=>$e(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:sa},children:Xe.map(({task:_,level:ee},Pe)=>{let qe=Lt(_.id),Ge=se===_.id,G=Ge&&Ne==="above",ce=Ge&&Ne==="below",Re=Ge&&Ne==="child",Pt={};return Re&&(Pt.backgroundColor=`${t.accent}15`,Pt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${U===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:qe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:qe?t.accentLight:Re?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...Pt},onMouseEnter:()=>S(_.id),onMouseLeave:()=>S(null),onClick:at=>{let fa=vo(e).map(J=>J.id),ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?at.metaKey:at.ctrlKey;Me(_.id,fa,ve,at.shiftKey),s?.(_);},onDoubleClick:at=>{at.stopPropagation(),n?.(_);},onContextMenu:at=>{at.preventDefault(),W({isOpen:true,x:at.clientX,y:at.clientY,type:"task",task:_}),m?.(_,at);},whileHover:{backgroundColor:qe?t.accentLight:t.hoverBg},children:[G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ce&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),st.map((at,xa)=>{let fa=xa===st.length-1,P=at.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${at.width}px`,minWidth:`${at.minWidth??(P?200:60)}px`,maxWidth:`${at.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fa?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:We(at,_,P?ee:0)},`${_.id}-${at.id}`)})]},_.id)})}),jsxRuntime.jsx(yo,{isOpen:N.isOpen,x:N.x,y:N.y,items:N.type==="header"&&N.columnId?Ye(N.columnId):N.type==="task"&&N.task?ze(N.task):[],onClose:()=>W({...N,isOpen:false}),theme:t}),et&&He&&U&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:He.x+12,top:He.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Xe.find(ee=>ee.task.id===U)?.task;return _?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:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[p,i]=react.useState(t),[u,d]=react.useState(null),[g,f]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(0),[x,y]=react.useState(0),[D,k]=react.useState(null),[w,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:p,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:f,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:v,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:y,hoveredSegmentIndex:D,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,Y)=>{r("none"),d(null),f(null),m(K),i(Y),y(0),b(null),l(0);}}}function Dn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:p,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=react.useRef(null),{dragMode:v,setDragMode:l,dragOffset:x,setDragOffset:y,ghostX:D,setGhostX:k,ghostWidth:w,setGhostWidth:B,connectionLine:M,setConnectionLine:S,hoveredTaskId:z,setHoveredTaskId:$,activeZone:K,setActiveZone:Y,draggedSegmentIndex:ye,setDraggedSegmentIndex:Oe,draggedSegmentStartX:nt,setDraggedSegmentStartX:_e,segmentDragOffsetX:Ae,setSegmentDragOffsetX:Q,hoveredSegmentIndex:L,setHoveredSegmentIndex:N,isHovered:W,setIsHovered:U,isDragging:R,isResizing:se,isConnecting:pe,resetDragState:Ne}=c,ie=32,Le=8,Ee=e.endDate&&e.endDate<new Date&&e.progress<100,De=e.isCriticalPath,He=o.name==="neutral"||o.today==="#1C1917",ht=e.status==="completed"||e.progress===100,et={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},te=e.isCriticalPath||Ee?"#DC2626":e.color?e.color:e.priority&&et[e.priority]?et[e.priority]:o.taskBarPrimary,Ce=(de=>de>=80?20:de>=60?15:de>=50?12:10)(r),$e=r<50,tt=r<40;react.useEffect(()=>{if(T)if(W&&!R&&!e.segments){let de=a<100;T({task:e,x:t,y:a,width:r,height:ie,showBelow:de});}else T(null);},[W,R,e,t,a,r,ie,T]);let xt=de=>de.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Me=()=>{let de=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${de} day${de!==1?"s":""}`},Lt=de=>Math.round(de/s)*s,At=de=>{let E=Math.round(de/s),q=new Date(n);return q.setDate(q.getDate()+E),q},ct=(de,E)=>{for(let q of f){if(q.id===e.id)continue;let ge=5;if(de>=q.x-ge&&de<=q.x+q.width+ge&&E>=q.y-ge&&E<=q.y+q.height+ge)return q.id}return null},Xe=react.useCallback((de,E,q)=>{de.preventDefault(),de.stopPropagation();let ge=b.current?.ownerSVGElement;if(!ge)return;let Ie=ge.createSVGPoint();Ie.x=de.clientX,Ie.y=de.clientY;let We=Ie.matrixTransform(ge.getScreenCTM()?.inverse()),Ye=q!==void 0?q:t,ze=E;if(!ze){let st=We.x-Ye;de.shiftKey?(ze="connect",S({x:t+r,y:a+ie/2})):de.ctrlKey||de.metaKey?ze="move":de.altKey?ze=st<r/2?"resize-start":"resize-end":tt?st<r/2?ze="move":ze="resize-end":$e?st<=Ce/2?ze="resize-start":st>=r-Ce/2?ze="resize-end":ze="move":st<=Ce?ze="resize-start":st>=r-Ce?ze="resize-end":ze="move";}l(ze),U(false),Y(null),ze==="move"?y(We.x-Ye):ze==="connect"?S({x:t+r,y:a+ie/2}):y(0),k(Ye),B(r);},[t,r,a,ie]),Ht=react.useCallback(de=>{if(v==="none")return;let E=b.current?.ownerSVGElement;if(!E)return;let q=E.createSVGPoint();q.x=de.clientX,q.y=de.clientY;let ge=q.matrixTransform(E.getScreenCTM()?.inverse());if(v==="connect"){S({x:ge.x,y:ge.y});let Ie=ct(ge.x,ge.y);$(Ie);}else if(v==="move"){let Ie=ge.x-x,We=Lt(Ie);k(We),B(r);let Ye=Math.round((We-t)/s);if(C?.(e.id,Ye,true),e.segments&&e.segments.length>0&&ye!==null){let ze=We-nt;Q(ze);}}else if(v==="resize-start"){let Ie=ge.x,We=Lt(Ie),Ye=t+r-We;Ye>=s&&(k(We),B(Ye));}else if(v==="resize-end"){let Ie=ge.x,Ye=Lt(Ie)-t;Ye>=s&&B(Ye);}},[v,t,r,s,x,e,Lt,ye,nt,ct,$,S,k,B,Q,C]),sa=react.useCallback(()=>{if(v!=="none"){if(v==="connect")z&&g&&g(e,z),S(null),$(null);else {let de=e.endDate.getTime()-e.startDate.getTime(),E,q,ge=true;if(v==="move"){if(E=At(D),q=new Date(E.getTime()+de),e.segments&&e.segments.length>0&&ye!==null){let Ie=Math.round(Ae/s),We=e.segments.map((mt,_)=>{if(_===ye){let ee=new Date(mt.startDate),Pe=new Date(mt.endDate);return ee.setDate(ee.getDate()+Ie),Pe.setDate(Pe.getDate()+Ie),{startDate:ee,endDate:Pe}}return mt}),Ye=We.flatMap(mt=>[mt.startDate,mt.endDate]),ze=new Date(Math.min(...Ye.map(mt=>mt.getTime()))),st=new Date(Math.max(...Ye.map(mt=>mt.getTime())));d?.({...e,segments:We},ze,st),Ne(t,r);return}}else v==="resize-start"?(E=At(D),q=e.endDate,E>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),ge=false)):v==="resize-end"?(E=e.startDate,q=At(D+w),q<E&&(console.warn("Invalid date range: end date must be after or equal to start date"),ge=false)):ge=false;ge&&E&&q&&(q.getTime()<E.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,E,q));}C?.(e.id,0,false),Ne(t,r);}},[v,D,w,e,d,z,g,t,r,s,At,Ae,ye,Ne,C]);react.useEffect(()=>{if(v==="none")return;let de=q=>{Ht(q);},E=()=>{sa();};return window.addEventListener("mousemove",de),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",E);}},[v,Ht,sa]);let ae=R&&!pe?D:t,re=R&&!pe?w:r,Vt=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!R&&p?.(e),onDoubleClick:de=>{R||(de.stopPropagation(),i?.(e));},onContextMenu:de=>{de.preventDefault(),u?.(e,de);},onMouseEnter:()=>!R&&U(true),onMouseLeave:()=>{R||(U(false),Y(null));},children:[W&&!R&&!$e&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ce,height:ie,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-start"),onMouseDown:de=>Xe(de,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ce,y:a,width:r-Ce*2,height:ie,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:de=>Xe(de,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ce,y:a,width:Ce,height:ie,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:de=>Xe(de,"resize-end")})]}),W&&!R&&tt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ie,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:de=>Xe(de,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ie,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:de=>Xe(de,"resize-end")}),W&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ie-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),R&&!pe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:D,y:a,width:w,height:ie,rx:Le,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:ae,y:a,width:re,height:ie,rx:Le,fill:te,"data-task-class":Vt,initial:{opacity:0,scale:.95},animate:{opacity:R&&!pe?.15:e.parentId?.6:W?.9:.8,scale:W&&!R?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:de=>Xe(de),style:{cursor:R?pe?"crosshair":se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ae,y:a,width:re*(e.progress/100),height:ie,rx:Le,fill:te,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((de,E)=>{let q=(de.startDate.getTime()-n.getTime())/864e5*s,Ie=(de.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,We=R&&v==="move"&&ye===E,Ye=L===E,ze=We?q+Ae:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!R&&N(E),onMouseLeave:()=>!R&&N(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:Ie,height:ie,rx:Le,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:We||e.parentId?.6:Ye?.9:.8,scale:Ye&&!R?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:st=>{st.stopPropagation(),Oe(E),_e(q),Xe(st,void 0,q);},style:{cursor:R?pe?"crosshair":se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ze,y:a,width:Ie*(e.progress/100),height:ie,rx:Le,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${E}`)}),He&&(Ee||De)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[De&&!Ee&&jsxRuntime.jsx("rect",{x:ae,y:a,width:re,height:ie,rx:Le,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ee&&jsxRuntime.jsx("rect",{x:ae,y:a,width:re,height:ie,rx:Le,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),re>60&&!e.segments&&(()=>{let de=m.taskLabel(e),E=typeof de=="string"?de:e.name,q=E.length>Math.floor(re/8)?`${E.substring(0,Math.floor(re/8))}...`:E;return jsxRuntime.jsx("text",{x:ae+12,y:a+ie/2,dominantBaseline:"middle",fill:ht?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ht?"line-through":"none"},children:q})})(),re>100&&e.progress>0&&e.progress<100&&!R&&!e.segments&&jsxRuntime.jsxs("text",{x:ae+re-12,y:a+ie/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&&re>80&&!R&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ae+re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ae+re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(W||se)&&!pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:ae-2,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>Y("resize-start"),onMouseLeave:()=>Y(null),onMouseDown:de=>{de.stopPropagation(),Xe(de,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ae+4,y:a+8,width:3,height:ie-16,rx:1.5,fill:K==="resize-start"||v==="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:ae+re-14,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>Y("resize-end"),onMouseLeave:()=>Y(null),onMouseDown:de=>{de.stopPropagation(),Xe(de,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ae+re-7,y:a+8,width:3,height:ie-16,rx:1.5,fill:K==="resize-end"||v==="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:W&&!R&&!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+18,cy:a+ie/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Y("connect"),onMouseLeave:()=>Y(null),onMouseDown:de=>{de.stopPropagation(),Xe(de,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+18,cy:a+ie/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:K==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsxRuntime.jsx("text",{x:t+r+32,y:a+ie/2,dominantBaseline:"middle",fill:K==="connect"?o.accent:o.textTertiary,fontSize:K==="connect"?"11":"10",fontWeight:K==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),pe&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ie/2,x2:M.x,y2:M.y,stroke:z?o.statusCompleted:o.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:z?8:6,fill:z?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(W||R)&&!pe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae-2,y:a-2,width:re+4,height:ie+4,rx:Le+2,fill:"none",stroke:R?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:R?.6:.4,initial:{opacity:0},animate:{opacity:R?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:D+w,y1:0,x2:D+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&!R&&!e.segments&&!T&&(()=>{let q=a<100,ge=q?a+ie+13:a-82-13,Ie=q?`M ${ae+re/2-6} ${a+ie+3} L ${ae+re/2} ${a+ie+13} L ${ae+re/2+6} ${a+ie+3}`:`M ${ae+re/2-6} ${a-13} L ${ae+re/2} ${a-3} L ${ae+re/2+6} ${a-13}`,We=ge+22,Ye=ge+40,ze=ge+55,st=ge+70,mt=q?ge+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ie,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ae+re/2-120,y:ge,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:ae+re/2,y:We,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:ae+re/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ae+re/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xt(e.startDate)}),jsxRuntime.jsx("text",{x:ae+re/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ae+re/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xt(e.endDate)}),jsxRuntime.jsx("text",{x:ae+re/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ae+re/2+65,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Me()}),jsxRuntime.jsx("text",{x:ae+re/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ae+re/2+65,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:ae+re/2-110,y:st,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ae+re/2-50,y:st,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_=>_.name).join(", ").substring(0,30),e.assignees.map(_=>_.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:ae+re/2,y:mt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:tt?"Left: move \u2022 Right: resize":$e?"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 pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,p=82,i=13,u=m?o+n+i:o-p-i,d=m?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,f=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:p,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:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Pn({x1:e,y1:t,x2:a,y2:r,verticalX:o,routeY:s,fromIndex:n,toIndex:m,rowHeight:p,theme:i,onDelete:u,onHoverChange:d,lineStyle:g="curved"}){let[f,C]=react.useState(false),T=a-e,c=e+T/2,b=56,v=5,l=n!==void 0?n*b+44+6:s??t+22,x,y=v,D=o??Math.max(e,a)+20;if(g==="squared")x=`M ${e} ${t} L ${D} ${t} L ${D} ${r} L ${a} ${r}`;else {let K=r>t;if(Math.abs(r-t)<5){let Y=Math.min(Math.abs(T)/3,30);x=`M ${e} ${t} C ${e+Y} ${t}, ${a-Y} ${r}, ${a} ${r}`;}else K?x=`M ${e} ${t} L ${D-y} ${t} Q ${D} ${t} ${D} ${t+y} L ${D} ${r-y} Q ${D} ${r} ${D-y} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${D-y} ${t} Q ${D} ${t} ${D} ${t-y} L ${D} ${r+y} Q ${D} ${r} ${D-y} ${r} L ${a} ${r}`;}let k=5,w=a-k,B=r-k*.5,M=a-k,S=r+k*.5,z=i.dependency;react.useEffect(()=>{d&&u&&d(f?{x1:e,y1:t,x2:a,y2:r,verticalX:D,routeY:l,onDelete:u,lineStyle:g}:null);},[f,e,t,a,r,D,l,u,d,g]);let $=!u&&!d;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!$&&C(true),onMouseLeave:()=>!$&&C(false),style:{pointerEvents:$?"none":"auto"},children:[!$&&jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:x,fill:"none",stroke:z,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:f&&d?0:f?1:.8,strokeWidth:f?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${w} ${B} M ${a} ${r} L ${M} ${S}`,fill:"none",stroke:z,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:f&&d?0:f?1:.8,scale:f?1.1:1,strokeWidth:f?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:z,initial:{scale:0},animate:{scale:f&&d?0:f?1.3:1,opacity:f&&d?0:f?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),f&&u&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:K=>{K.stopPropagation(),u();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:i.bgSecondary,stroke:i.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:i.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:i.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function An({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,p=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:p(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 he={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,m=new Set,p=i=>{if(!n.has(i)){n.add(i),m.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&p(d))return true;if(m.has(d))return true}}return m.delete(i),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=he.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=he.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=he.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=he.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(`
|
|
112
|
+
`)},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=he.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=he.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)=>he.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=he.findTaskById(e,t);return !a||!a.dependencies?[]:he.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>he.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>he.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=he.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=>he.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=he.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"]],m=s.map(p=>{let i=p.startDate&&p.endDate?he.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?he.formatDate(p.startDate):"N/A",p.endDate?he.formatDate(p.endDate):"N/A",i>0?`${i} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:n,body:m,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=he.flattenTasks(e).map(p=>{let i=p.startDate&&p.endDate?he.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?he.formatDate(p.startDate):"","End Date":p.endDate?he.formatDate(p.endDate):"","Duration (days)":i>0?i:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(u=>u.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.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 m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=he.flattenTasks(e),o=new Map;r.forEach((g,f)=>{o.set(g.id,f+1);});let s=g=>g.toISOString().replace("Z",""),n=he.getEarliestStartDate(e)||new Date,m=he.getLatestEndDate(e)||new Date,p=r.map((g,f)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?he.calculateDuration(g.startDate,g.endDate):0,c=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
114
|
<PredecessorUID>${o.get(b)}</PredecessorUID>
|
|
115
115
|
<Type>1</Type>
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
<LagFormat>7</LagFormat>
|
|
119
119
|
</PredecessorLink>`).join("");return `
|
|
120
120
|
<Task>
|
|
121
|
-
<UID>${
|
|
121
|
+
<UID>${C}</UID>
|
|
122
122
|
<ID>${f+1}</ID>
|
|
123
123
|
<Name>${g.name.replace(/[<>&'"]/g,b=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[b]||b)}</Name>
|
|
124
124
|
<Type>0</Type>
|
|
@@ -130,9 +130,9 @@
|
|
|
130
130
|
<Priority>500</Priority>
|
|
131
131
|
<Start>${g.startDate?s(g.startDate):""}</Start>
|
|
132
132
|
<Finish>${g.endDate?s(g.endDate):""}</Finish>
|
|
133
|
-
<Duration>PT${
|
|
133
|
+
<Duration>PT${T*8}H0M0S</Duration>
|
|
134
134
|
<DurationFormat>7</DurationFormat>
|
|
135
|
-
<Work>PT${
|
|
135
|
+
<Work>PT${T*8}H0M0S</Work>
|
|
136
136
|
<Stop>${g.endDate?s(g.endDate):""}</Stop>
|
|
137
137
|
<Resume>${g.startDate?s(g.startDate):""}</Resume>
|
|
138
138
|
<ResumeValid>0</ResumeValid>
|
|
@@ -164,15 +164,15 @@
|
|
|
164
164
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
165
165
|
<ActualStart>${g.progress>0&&g.startDate?s(g.startDate):""}</ActualStart>
|
|
166
166
|
<ActualFinish>${g.progress===100&&g.endDate?s(g.endDate):""}</ActualFinish>
|
|
167
|
-
<ActualDuration>PT${Math.round(
|
|
167
|
+
<ActualDuration>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualDuration>
|
|
168
168
|
<ActualCost>0</ActualCost>
|
|
169
169
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
170
|
-
<ActualWork>PT${Math.round(
|
|
170
|
+
<ActualWork>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualWork>
|
|
171
171
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
172
|
-
<RegularWork>PT${
|
|
173
|
-
<RemainingDuration>PT${Math.round(
|
|
172
|
+
<RegularWork>PT${T*8}H0M0S</RegularWork>
|
|
173
|
+
<RemainingDuration>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
|
|
174
174
|
<RemainingCost>0</RemainingCost>
|
|
175
|
-
<RemainingWork>PT${Math.round(
|
|
175
|
+
<RemainingWork>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingWork>
|
|
176
176
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
177
177
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
178
178
|
<ACWP>0</ACWP>
|
|
@@ -339,9 +339,9 @@
|
|
|
339
339
|
</Calendars>
|
|
340
340
|
<Tasks>${p}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=he.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let T=t.find(N=>N.id===f);if(T){o(T);let N=r.get(f)?.ef||0;d=Math.max(d,N);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,m=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,d=t.filter(T=>T.dependencies&&T.dependencies.includes(i.id)),g=s;if(d.length>0)for(let T of d){m(T);let N=n.get(T.id)?.ls||0;g=Math.min(g,N);}let f=g-u;n.set(i.id,{ls:f,lf:g});};a.forEach(m);let p=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&p.push(i.id);}}return p},calculateSlack:(e,t)=>{let a=he.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(he.calculateCriticalPath(e).includes(t))return 0;let o=he.getDependentTasks(e,t);if(o.length===0){let m=he.getLatestEndDate(e);if(!m)return null;let p=he.calculateDuration(a.endDate,m);return Math.max(0,p)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,p)=>m-p)[0];if(!s)return null;let n=he.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>he.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=he.findTaskById(e,t);if(!r||!r.endDate)return e;let o=he.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=he.calculateDuration(n.startDate,n.endDate),p;a!==void 0?(p=new Date(n.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let i=he.calculateEndDate(p,m),u=d=>d.map(g=>g.id===n.id?{...g,startDate:p,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=he.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let p=[],i=o.getTime(),u=1e3*60*60*24,d=he.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(f,T,N=new Set)=>{if(N.has(f))return;N.add(f);let c=he.getDependentTasks(e,f);for(let b of c){if(!b.startDate||!b.endDate)continue;let v=r.findIndex(S=>S.id===b.id);if(v===-1)continue;let l=b.startDate.getTime(),y=(b.endDate.getTime()-l)/u,x=(l-i)/u*s,w=x+T*s,B=Math.max(y*s,s),M=m+v*n+12;p.push({taskId:b.id,taskName:b.name,originalX:x,previewX:w,width:B,y:M,rowIndex:v,daysDelta:T,color:b.color}),g(b.id,T,N);}};return g(t,a),p},splitTask:(e,t,a,r=3)=>{let o=he.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:m,segments:p}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:m,dependencyLineStyle:p="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:f,onDependencyDelete:T}){let[c,b]=react.useState([]),[v,l]=react.useState(null),[k,y]=react.useState(null),D=react.useCallback(L=>{l(L);},[]),x=react.useCallback((L,C,W,O,R,ne)=>{let ce=Math.min(W,O),De=Math.max(W,O),le=C<L;if(ce===De)return (L+C)/2;if(le){let Se=L;for(let Fe=ce;Fe<=De;Fe++){let xe=R[Fe];if(xe?.startDate&&xe?.endDate){let We=ne(xe),je=We.x+We.width;je>Se&&(Se=je);}}return Se+20}let Be=C;for(let Se=ce;Se<=De;Se++){let Fe=R[Se];if(Fe?.startDate&&Fe?.endDate){let xe=ne(Fe);xe.x<Be&&(Be=xe.x);}}return Math.max(L+8,Be-20)},[]),w=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),B=r==="day"?60:r==="week"?20:8,M=w*B*n,S=L=>{let C=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),W=C.getUTCDay()||7;C.setUTCDate(C.getUTCDate()+4-W);let O=new Date(Date.UTC(C.getUTCFullYear(),0,1));return Math.ceil(((C.getTime()-O.getTime())/864e5+1)/7)},U=L=>{let C=L.getDay();return C===0||C===6},$=react.useCallback(L=>{let C=Math.round(L/(B*n)),W=new Date(o);return W.setDate(W.getDate()+C),W},[o,B,n]),j=react.useCallback((L,C)=>{if(C.startDate&&C.endDate)return;let W=L.currentTarget.ownerSVGElement;if(!W)return;let O=W.createSVGPoint();O.x=L.clientX,O.y=L.clientY;let R=O.matrixTransform(W.getScreenCTM()?.inverse()),ne=$(R.x),ce=new Date(ne);ce.setDate(ce.getDate()+1),g?.(C,ne,ce);},[$,g]),K=react.useMemo(()=>{let L=R=>R.map(ne=>{if(ne.subtasks&&ne.subtasks.length>0){let ce=L(ne.subtasks),De=ce.filter(le=>le.startDate&&le.endDate);if(De.length>0){let le=De.map(xe=>xe.startDate.getTime()),Be=De.map(xe=>xe.endDate.getTime()),Se=new Date(Math.min(...le)),Fe=new Date(Math.max(...Be));return {...ne,subtasks:ce,startDate:Se,endDate:Fe}}return {...ne,subtasks:ce}}return ne}),C=(R,ne=[])=>{for(let ce of R)ne.push(ce),ce.subtasks&&ce.subtasks.length>0&&(ce.isExpanded===void 0||ce.isExpanded)&&C(ce.subtasks,ne);return ne},W=L(e);return C(W)},[e]),be=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let C=L.startDate.getTime(),W=L.endDate.getTime(),O=o.getTime(),R=(C-O)/(1e3*60*60*24),ne=(W-C)/(1e3*60*60*24),ce=R*B*n,De=Math.max(B*n,40),le=Math.max(ne*B*n,De);return {x:ce,width:le}},[o,B,n]),ze=react.useMemo(()=>K.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:C,width:W}=be(L),R=K.findIndex(ne=>ne.id===L.id)*a+12;return {id:L.id,x:C,y:R,width:W,height:32}}),[K,be]),st=react.useCallback((L,C,W)=>{if(!W||C===0){b([]);return}let O=he.calculateCascadePreview(e,L,C,K,o,B*n,a,48);b(O);},[e,K,o,B,n,a,48]),Ve=react.useMemo(()=>{let L=[],C=new Date(o);for(;C<=s;){let R=(C.getTime()-o.getTime())/864e5*B*n;if(r==="day")L.push({date:new Date(C),label:C.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:R}),C.setDate(C.getDate()+1);else if(r==="week"){let ne=S(C);L.push({date:new Date(C),label:`Week ${ne}`,x:R}),C.setDate(C.getDate()+7);}else L.push({date:new Date(C),label:C.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:R}),C.setMonth(C.getMonth()+1);}return L},[o,s,r,B,n]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*B*n,[o,B,n]),Z=Math.max(K.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},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(M,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(M,1e3),height:48,fill:t.bgGrid}),Ve.map((L,C)=>jsxRuntime.jsxs("g",{children:[C>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${C}`)),Ae>=0&&Ae<=M&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(M,1e3),height:Z,style:{display:"block",flexShrink:0,overflow:"visible"},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(M,1e3),height:Z,fill:t.bgPrimary}),Ve.map((L,C)=>{let W=Ve[C+1]?.x||M,O=U(L.date);return jsxRuntime.jsxs("g",{children:[O&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:W-L.x,height:K.length*a,fill:t.bgWeekend,opacity:1}),C>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:K.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},C)}),K.map((L,C)=>{let W=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:C*a,width:M,height:a,fill:C%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:C*a,width:M,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:O=>j(O,L),onMouseEnter:O=>{O.currentTarget.setAttribute("fill",t.accentLight),O.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:O=>{O.currentTarget.setAttribute("fill","transparent"),O.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae:100,y:C*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),K.map((L,C)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(W=>{let O=K.find(je=>je.id===W);if(!O||!O.startDate||!O.endDate)return null;let R=K.findIndex(je=>je.id===W),ne=be(O),ce=be(L),De=ne.x+ne.width,le=R*a+28,Be=ce.x,Se=C*a+28,Fe=R*a+50,xe=x(De,Be,R,C,K,be);return k&&k.x1===De&&k.y1===le&&k.x2===Be&&k.y2===Se?null:jsxRuntime.jsx(Pn,{x1:De,y1:le,x2:Be,y2:Se,verticalX:xe,routeY:Fe,fromIndex:R,toIndex:C,rowHeight:a,theme:t,lineStyle:p},`dep-${W}-${L.id}`)})),K.map((L,C)=>{if(!L.startDate||!L.endDate)return null;let{x:W,width:O}=be(L),R=C*a+12,ne=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(An,{task:L,x:W+O/2,y:R+16,theme:t,onClick:i},L.id):ne?jsxRuntime.jsxs("g",{onClick:()=>i?.(L),onContextMenu:ce=>{ce.preventDefault(),ce.stopPropagation(),d?.(L,ce);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:R,width:O,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:R,x2:W+O,y2:R,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:R,x2:W,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+O,y1:R,x2:W+O,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:R+32,x2:W+O,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),O>60&&jsxRuntime.jsx("text",{x:W+12,y:R+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(Dn,{task:L,x:W,y:R,width:O,theme:t,dayWidth:B*n,startDate:o,templates:m,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:f,allTaskPositions:ze,onDragMove:st,onHoverChange:D},L.id)}),K.map((L,C)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(W=>{let O=K.find(se=>se.id===W);if(!O||!O.startDate||!O.endDate)return null;let R=K.findIndex(se=>se.id===W),ne=be(O),ce=be(L),De=ne.x+ne.width,le=R*a+28,Be=ce.x,Se=C*a+28,Fe=R*a+50,xe=R===C,We=x(De,Be,R,C,K,be),je;if(xe){let se=De+20,Ce=Be-15;je=`M ${se} ${le} L ${Ce} ${Se}`;}else je=`M ${We} ${le+10} L ${We} ${Se-10}`;if(k&&k.x1===De&&k.y1===le&&k.x2===Be&&k.y2===Se)return null;let re=se=>{let Ce=se.currentTarget.ownerSVGElement;if(!Ce)return;let Oe=Ce.getBoundingClientRect(),at=se.clientX-Oe.left,kt=se.clientY-Oe.top;y({x1:De,y1:le,x2:Be,y2:Se,verticalX:We,routeY:Fe,fromIndex:R,toIndex:C,onDelete:()=>T?.(L.id,W),lineStyle:p,mouseX:at,mouseY:kt});};return jsxRuntime.jsx("path",{d:je,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:re,onMouseMove:re},`dep-hover-${W}-${L.id}`)})),c.map(L=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsxRuntime.jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),k&&(()=>{let{x1:L,y1:C,x2:W,y2:O,verticalX:R,onDelete:ne,lineStyle:ce,mouseX:De,mouseY:le}=k,Be=W-L,Se=5,Fe=W<L,xe=R??(Fe?L+20:W-20),We=Se,je=O-C,z=je>0,re=Math.abs(je)<5,se;if(ce==="squared")se=`M ${L} ${C} L ${xe} ${C} L ${xe} ${O} L ${W} ${O}`;else if(re){let yt=Math.min(Math.abs(Be)/3,30);se=`M ${L} ${C} C ${L+yt} ${C}, ${W-yt} ${O}, ${W} ${O}`;}else Fe?z?se=`M ${L} ${C} L ${xe-We} ${C} Q ${xe} ${C} ${xe} ${C+We} L ${xe} ${O-We} Q ${xe} ${O} ${xe-We} ${O} L ${W} ${O}`:se=`M ${L} ${C} L ${xe-We} ${C} Q ${xe} ${C} ${xe} ${C-We} L ${xe} ${O+We} Q ${xe} ${O} ${xe-We} ${O} L ${W} ${O}`:z?se=`M ${L} ${C} L ${xe-We} ${C} Q ${xe} ${C} ${xe} ${C+We} L ${xe} ${O-We} Q ${xe} ${O} ${xe+We} ${O} L ${W} ${O}`:se=`M ${L} ${C} L ${xe-We} ${C} Q ${xe} ${C} ${xe} ${C-We} L ${xe} ${O+We} Q ${xe} ${O} ${xe+We} ${O} L ${W} ${O}`;let Ce=5,Oe=W-Ce,at=O-Ce*.5,kt=W-Ce,Le=O+Ce*.5,It=t.dependency,Mt="#f87171",Dt="rgba(248, 113, 113, 0.15)",Qe=(xe+W)/2,bt=re?(C+O)/2:O,ua=false;De!==void 0&&le!==void 0&&(Fe?Qe=Math.max(W+20,Math.min(xe-10,De)):Qe=Math.max(xe+10,Math.min(W-20,De)),bt=re?(C+O)/2:O);let te=Math.floor(bt/a);if(te>=0&&te<K.length){let yt=K[te];if(yt&&yt.startDate&&yt.endDate){let ie=be(yt),E=te*a+12,q=E+32,ge=ie.x-15,Me=ie.x+ie.width+50;Qe>=ge&&Qe<=Me&&bt>=E-5&&bt<=q+5&&(ua=true);}}return jsxRuntime.jsxs("g",{onMouseLeave:()=>y(null),onMouseMove:yt=>{let ie=yt.currentTarget.ownerSVGElement||yt.currentTarget;if(!ie)return;let E=ie.getBoundingClientRect(),q=yt.clientX-E.left,ge=yt.clientY-E.top;y(Me=>Me?{...Me,mouseX:q,mouseY:ge}:null);},children:[jsxRuntime.jsx("path",{d:se,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:se,fill:"none",stroke:It,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:se,fill:"none",stroke:It,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${W} ${O} L ${Oe} ${at} M ${W} ${O} L ${kt} ${Le}`,fill:"none",stroke:It,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:W,cy:O,r:4,fill:It,opacity:.9,style:{pointerEvents:"none"}}),!ua&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:yt=>{yt.stopPropagation(),y(null),ne();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Qe,cy:bt,r:9,fill:Dt,stroke:Mt,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:Qe-3,y1:bt-3,x2:Qe+3,y2:bt+3,stroke:Mt,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Qe+3,y1:bt-3,x2:Qe-3,y2:bt+3,stroke:Mt,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Ae>=0&&Ae<=M&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:Z,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),v&&jsxRuntime.jsx(pc,{tooltipData:v,theme:t})]})]})}var u0=['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"'],fc=()=>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"})]}),g0=()=>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"})}),f0=()=>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"})}),h0=()=>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"})}),b0=()=>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 In({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:p}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[f,T]=react.useState([]),[N,c]=react.useState(""),[b,v]=react.useState(false),[l,k]=react.useState(true),y=react.useRef(null),D=react.useRef(null),x=react.useRef(null),{enabled:w=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:S,suggestions:U=u0,maxHistory:$=50,persistHistory:j}=a,K=j?.storageKey||"gantt-ai-history",be=j?.maxMessages??5;react.useEffect(()=>{if(j?.enabled)try{let L=localStorage.getItem(K);if(L){let W=JSON.parse(L).map(O=>({...O,timestamp:new Date(O.timestamp)}));T(W.slice(-be));}}catch(L){console.warn("[GanttAIAssistant] Failed to load persisted history:",L);}},[j?.enabled,K,be]),react.useEffect(()=>{if(j?.enabled&&f.length>0)try{let L=f.filter(C=>!C.isLoading).slice(-be);localStorage.setItem(K,JSON.stringify(L));}catch(L){console.warn("[GanttAIAssistant] Failed to persist history:",L);}},[f,j?.enabled,K,be]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&y.current&&setTimeout(()=>y.current?.focus(),100);},[i,d]);let ze=react.useCallback(L=>{if(L.success)switch(L.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":L.taskId&&L.updates&&o?.(L.taskId,L.updates);break;case "create_task":L.newTask&&s?.(L.newTask);break;case "delete_task":L.taskId&&n?.(L.taskId);break;case "link_tasks":L.dependencyFrom&&L.dependencyTo&&m?.(L.dependencyFrom,L.dependencyTo);break;case "unlink_tasks":L.taskId&&L.dependencyFrom&&p?.(L.taskId,L.dependencyFrom);break}},[o,s,n,m,p]),st=react.useCallback(async L=>{if(!L.trim()||b)return;let C={id:`user-${Date.now()}`,role:"user",content:L,timestamp:new Date};T(O=>[...O.slice(-($-1)),C]),c(""),k(false),v(true);let W={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};T(O=>[...O,W]);try{if(S){let O=await S(L,e);T(R=>{let ne=R.filter(De=>!De.isLoading),ce={id:`assistant-${Date.now()}`,role:"assistant",content:O.message,timestamp:new Date,command:O};return [...ne,ce]}),ze(O);}else T(O=>[...O.filter(ne=>!ne.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(O){T(R=>[...R.filter(ce=>!ce.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${O instanceof Error?O.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[b,$,S,e,ze]),Ve=L=>{L.preventDefault(),st(N);},Ae=L=>{c(L),y.current?.focus();};if(react.useEffect(()=>{let L=C=>{(C.metaKey||C.ctrlKey)&&C.key==="k"&&(C.preventDefault(),u(W=>!W),i||g(false)),C.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i]),react.useEffect(()=>{if(!i)return;let L=W=>{let O=W.target;x.current&&!x.current.contains(O)&&u(false);},C=setTimeout(()=>{document.addEventListener("mousedown",L);},100);return ()=>{clearTimeout(C),document.removeEventListener("mousedown",L);}},[i]),!w)return null;let Z={"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(gt,{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 ${Z[M]} 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:()=>u(true),children:[jsxRuntime.jsx(fc,{}),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:x,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 ${Z[M]} 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(fc,{}),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(L=>!L),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(h0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(f0,{})})]})]}),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&&l&&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:U.slice(0,4).map((L,C)=>jsxRuntime.jsx("button",{onClick:()=>Ae(L),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:L.length>30?L.slice(0,30)+"...":L},C))})]}),f.map(L=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${L.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${L.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:L.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:L.role==="user"?"white":t.textPrimary},children:[L.isLoading?jsxRuntime.jsx(b0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content}),L.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:L.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:L.command.success?"#10B981":"#EF4444"},children:[L.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:L.command.type.replace(/_/g," ")})]})]})},L.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:Ve,className:"p-3 border-t",style:{borderColor:t.border},children:[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:y,type:"text",value:N,onChange:L=>c(L.target.value),placeholder:B,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!N.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:N.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:N.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(g0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function hc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let f=[...d.past,d.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 u=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:u,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),p=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function bc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=m?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&p&&n.key==="y"){n.preventDefault(),t();return}if(m&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var k0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${he.formatDate(e.startDate)} - ${he.formatDate(e.endDate)}`);let a=he.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=>he.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function yc(e){return {...k0,...e}}var E0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},kc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:p=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:f,aiAssistant:T,locale:N="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:v,onCreateTask:l,taskFilter:k,onTaskFilterChange:y,onThemeChange:D,onTaskClick:x,onTaskDblClick:w,onTaskContextMenu:B,onTaskUpdate:M,onProgressChange:S,onTaskEdit:U,onTaskAddSubtask:$,onTaskMarkIncomplete:j,onTaskSetInProgress:K,onDependencyCreate:be,onDependencyDelete:ze,onBeforeTaskAdd:st,onAfterTaskAdd:Ve,onBeforeTaskUpdate:Ae,onAfterTaskUpdate:Z,onBeforeTaskDelete:L,onAfterTaskDelete:C}=a,O=react.useContext(yn)?.theme,[R,ne]=react.useState(O||s||"dark"),[ce,De]=react.useState(n),[le,Be]=react.useState(m),[Se,Fe]=react.useState(1),[xe,We]=react.useState("all"),je=k??xe,z=y??We,[re,se]=react.useState(0),[Ce,Oe]=react.useState(false),[at,kt]=react.useState(null),[Le,It]=react.useState({isOpen:false,x:0,y:0,task:null}),[Mt,Dt]=react.useState(null),[Qe,bt]=react.useState(null);react.useEffect(()=>{O&&O!==R&&ne(O);},[O]),react.useEffect(()=>{s&&s!==R&&ne(s);},[s]);let ua=react.useCallback(F=>{ne(F),D?.(F);},[D]),{state:te,setState:ue,undo:yt,redo:ie,canUndo:E,canRedo:q,clearHistory:ge}=hc(t,50),Me=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),Ge=react.useRef(new Map),Xe=react.useRef(false);if(!Xe.current&&f){Xe.current=true;let F=typeof f=="string"?f:"gantt-expanded-tasks";try{let I=localStorage.getItem(F);if(I){let V=JSON.parse(I);Array.isArray(V)&&(Ge.current=new Map(V));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let Ue=react.useCallback(()=>{let F=Me();if(F)try{let I=Array.from(Ge.current.entries());localStorage.setItem(F,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[Me]);react.useEffect(()=>{let F=I=>I.map(V=>{let ae=Ge.current.get(V.id),fe=ae!==void 0?{...V,isExpanded:ae}:V;return fe.subtasks?.length?{...fe,subtasks:F(fe.subtasks)}:fe});Ge.current.size>0?ue(F(t)):ue(t);},[t,ue]);let it=react.useRef(t),mt=react.useRef(true);react.useEffect(()=>{if(mt.current){mt.current=false,it.current=te;return}if(!r)return;let F=JSON.stringify(it.current),I=JSON.stringify(te);F!==I&&(it.current=te,r(te));},[te,r]);let _=react.useMemo(()=>ei(N,c),[N,c]),ee=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Pe,Je]=react.useState(()=>ee(_));react.useEffect(()=>{Je(F=>F.map(I=>({...I,label:_.columns[I.id==="name"?"taskName":I.id]||I.label})));},[_]);let _e=react.useMemo(()=>Pe.filter(I=>I.visible).reduce((I,V)=>I+V.width,0),[Pe]),G=react.useRef(Pe.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Pe.filter(ae=>ae.visible),I=F.map(ae=>ae.id).join(","),V=G.current;if(I!==V){let ae=F.some(Ne=>Ne.id!=="name"),fe=V.includes(",");ae?!fe&&ae&&kt(null):kt(null),G.current=I;}},[Pe]);let de=60,$e=.6,Ft=react.useMemo(()=>{let I=_e+de,V=typeof window<"u"?window.innerWidth*$e:800,ae=Math.max(I,V);return at!==null?Math.max(200,Math.min(at,ae)):Math.max(200,I)},[at,_e]),rt=react.useRef(null),xa=react.useRef(null),fa=react.useRef(null),P=react.useMemo(()=>Ud(R),[R]),ve=react.useMemo(()=>({theme:P,themeName:R}),[P,R]),J=react.useMemo(()=>yc(d),[d]),Ie=react.useMemo(()=>{if(!g)return te;let F=he.calculateCriticalPath(te),I=V=>V.map(ae=>({...ae,isCriticalPath:F.includes(ae.id),subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(te)},[te,g]),lt=react.useMemo(()=>{if(je==="all")return Ie;let F=I=>{let V=[];for(let ae of I){let fe=ae.subtasks?.length?F(ae.subtasks):void 0,Ne=false;switch(je){case "incomplete":Ne=ae.progress<100;break;case "in_progress":Ne=ae.progress>0&&ae.progress<100;break;case "completed":Ne=ae.progress===100;break}(Ne||fe&&fe.length>0)&&V.push({...ae,subtasks:fe});}return V};return F(Ie)},[Ie,je]),oe=E0(le);bc({undo:yt,redo:ie,canUndo:E,canRedo:q,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>he.findTaskById(te,F),addTask:(F,I)=>{ue(V=>{if(!I)return [...V,{...F,level:0}];let ae=fe=>fe.map(Ne=>Ne.id===I?{...Ne,subtasks:[...Ne.subtasks||[],{...F,parentId:I,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:ae(Ne.subtasks)}:Ne);return ae(V)});},updateTask:(F,I)=>{ue(V=>{let ae=fe=>fe.map(Ne=>Ne.id===F?{...Ne,...I}:Ne.subtasks?{...Ne,subtasks:ae(Ne.subtasks)}:Ne);return ae(V)});},deleteTask:F=>{ue(I=>{let V=ae=>ae.filter(fe=>fe.id===F?false:(fe.subtasks&&(fe.subtasks=V(fe.subtasks)),true));return V(I)});},deleteTasks:F=>{ue(I=>ci(I,F));},duplicateTask:F=>{ue(I=>mi(I,[F]));},splitTask:(F,I,V=3)=>{ue(ae=>he.splitTask(ae,F,I,V));},calculateEndDate:he.calculateEndDate,calculateDuration:he.calculateDuration,validateDependency:(F,I)=>!he.validateDependencies(te,F,I),getAllTasks:()=>he.flattenTasks(te),getTasksByStatus:F=>he.flattenTasks(te).filter(I=>I.status===F),getTasksByParent:F=>F?he.findTaskById(te,F)?.subtasks||[]:te.filter(V=>!V.parentId),getCriticalPath:()=>he.flattenTasks(te).filter(F=>F.isCriticalPath),indentTask:F=>{ue(I=>ii(I,[F]));},outdentTask:F=>{ue(I=>li(I,[F]));},moveTask:(F,I)=>{ue(V=>di(V,[F],I));},createSubtask:async F=>{let{tasks:I,newTask:V}=gi(te,F);if(st){let ae=st({...V,parentId:F});if((ae instanceof Promise?await ae:ae)===false)return}ue(I),Ve&&Ve({...V,parentId:F});},scrollToTask:F=>{let V=he.flattenTasks(te).findIndex(ae=>ae.id===F);if(V!==-1&&rt.current){let ae=V*oe;rt.current.scrollTo({top:ae,behavior:"smooth"}),xa.current&&xa.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(F,I=2e3)=>{},expandTask:F=>{ue(I=>{let V=ae=>ae.map(fe=>fe.id===F?{...fe,isExpanded:true}:fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe);return V(I)});},collapseTask:F=>{ue(I=>{let V=ae=>ae.map(fe=>fe.id===F?{...fe,isExpanded:false}:fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe);return V(I)});},expandAll:()=>{ue(F=>{let I=V=>V.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(F)});},collapseAll:()=>{ue(F=>{let I=V=>V.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(F)});},undo:yt,redo:ie,canUndo:()=>E,canRedo:()=>q,clearHistory:ge,exportToPNG:async()=>{if(!fa.current||!rt.current||!xa.current)throw new Error("Gantt container not found");let F=fa.current,I=rt.current.querySelector(".gantt-grid-scroll"),V=xa.current,ae=I?.scrollTop||0,fe=V.scrollTop,Ne=F.style.overflow,wt=F.style.height;try{let ea=I?.querySelector(".gantt-taskgrid-content"),ka=V.querySelector("svg"),wa=ea?.scrollHeight||I?.scrollHeight||600,Aa=ka?.getBoundingClientRect().height||V.scrollHeight,Br=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(wa,Aa)+20;I&&(I.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Br}px`,await new Promise(kr=>setTimeout(kr,100));let xr=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let ro=window.getComputedStyle(kr),Rr=parseInt(ro.zIndex,10);return !isNaN(Rr)&&Rr>=50||ro.position==="fixed"}});return new Promise((kr,ro)=>{xr.toBlob(Rr=>{Rr?kr(Rr):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ne,F.style.height=wt,I&&(I.scrollTop=ae),V.scrollTop=fe;}},exportToPDF:async F=>{await he.exportToPDF(te,F);},exportToExcel:async F=>{await he.exportToExcel(te,F);},exportToJSON:()=>he.exportToJSON(te),exportToCSV:()=>he.exportToCSV(te),importFromJSON:F=>{let I=he.importFromJSON(F);ue(I);},getTasks:()=>te,refresh:()=>{ue(F=>[...F]);},clearAll:()=>{ue([]);}}),[te,yt,ie,E,q,ge,P,oe]);let He=react.useCallback(F=>{Je(I=>I.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),St=react.useCallback((F,I)=>{Je(V=>V.map(ae=>{if(ae.id!==F)return ae;let fe=ae.minWidth??100,Ne=ae.maxWidth??800,wt=Math.max(fe,Math.min(Ne,I));return {...ae,width:wt}}));},[]),Re=react.useCallback(F=>{ue(I=>{let V=ui(I,F),ae=fe=>{for(let Ne of fe){if(Ne.id===F){Ge.current.set(F,Ne.isExpanded??true);return}Ne.subtasks?.length&&ae(Ne.subtasks);}};return ae(V),Ue(),V}),a.onTaskToggleExpand?.(F);},[a,Ue]),Rt=react.useCallback((F,I)=>{if(Ae&&Ae(F,I)===false)return;let ae=he.findTaskById(te,F)?.progress,fe=wt=>wt.map(ea=>ea.id===F?{...ea,...I}:ea.subtasks?{...ea,subtasks:fe(ea.subtasks)}:ea);ue(fe(te));let Ne=he.findTaskById(fe(te),F);Ne&&(M?.(Ne),Z?.(Ne),I.progress!==void 0&&ae!==void 0&&I.progress!==ae&&S?.(F,ae,I.progress));},[te,M,Ae,Z,S]),pt=react.useCallback(F=>{F.length!==0&&(ue(I=>ii(I,F)),a.onTaskIndent?.(F[0]));},[a]),ha=react.useCallback(F=>{F.length!==0&&(ue(I=>li(I,F)),a.onTaskOutdent?.(F[0]));},[a]),Gt=react.useCallback((F,I,V)=>{ue(ae=>oc(ae,F,I,V)),a.onTaskReparent?.(F,I,V);},[a]),qe=react.useCallback((F,I)=>{F.length!==0&&(ue(V=>di(V,F,I)),a.onTaskMove?.(F[0],I));},[a]),Et=react.useCallback(async F=>{let I=[];for(let V of F)L&&await Promise.resolve(L(V))===false||I.push(V);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(ue(V=>ci(V,I)),I.forEach(V=>a.onTaskDelete?.(V))),C&&I.forEach(V=>C(V)));},[a,L,C]),da=react.useCallback(F=>{ue(I=>mi(I,F)),F.forEach(I=>a.onTaskDuplicate?.(I));},[a]),yr=react.useCallback((F,I)=>{ue(V=>{let{tasks:ae,newTask:fe}=rc(V,F,I);return st&&st(fe)===false?V:(a.onTaskCreate?.(fe.parentId,fe.position||0),Ve?.(fe),ae)});},[a,st,Ve]),Um=react.useCallback((F,I)=>{ue(V=>pi(V,F,I)),a.onTaskRename?.(F,I);},[a]),Qn=react.useCallback(F=>{ue(I=>{let{tasks:V}=gi(I,F);return a.onTaskCreate?.(F,0),V});},[a]),Hm=react.useCallback((F,I,V)=>{let ae=F.startDate?Math.round((I.getTime()-F.startDate.getTime())/864e5):0,fe=ea=>ea.map(ka=>ka.id===F.id?{...ka,startDate:I,endDate:V,...F.segments&&{segments:F.segments}}:ka.subtasks?{...ka,subtasks:fe(ka.subtasks)}:ka),Ne=fe(te);Ne=he.autoScheduleDependents(Ne,F.id,ae),ue(Ne);let wt={...F,startDate:I,endDate:V};M?.(wt);},[te,M]),Wm=react.useCallback((F,I)=>{B?.(F,I),It({isOpen:true,x:I.clientX,y:I.clientY,task:F});},[B]),Gm=react.useCallback((F,I)=>{let V=he.splitTask(te,F.id,I);ue(V),It({isOpen:false,x:0,y:0,task:null});},[te]),hl=react.useCallback(F=>{let I=he.findTaskById(te,F.id)||F;w?.(I),U||Dt(I);},[te,w,U]),bl=react.useCallback((F,I,V)=>{let ae=new Map,fe=wa=>{wa.forEach(Aa=>{Aa.dependencies&&ae.set(Aa.id,Aa.dependencies),Aa.subtasks&&fe(Aa.subtasks);});};fe(V);let Ne=ae.get(I)||[];ae.set(I,[...Ne,F]);let wt=new Set,ea=new Set,ka=wa=>{if(!wt.has(wa)){wt.add(wa),ea.add(wa);let Aa=ae.get(wa)||[];for(let vr of Aa){if(!wt.has(vr)&&ka(vr))return true;if(ea.has(vr))return true}}return ea.delete(wa),false};return ka(I)},[]),yl=react.useCallback((F,I)=>{if(bl(F.id,I,te)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=he.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let C=t.find(T=>T.id===f);if(C){o(C);let T=r.get(f)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,m=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){m(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let f=g-u;n.set(i.id,{ls:f,lf:g});};a.forEach(m);let p=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&p.push(i.id);}}return p},calculateSlack:(e,t)=>{let a=he.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(he.calculateCriticalPath(e).includes(t))return 0;let o=he.getDependentTasks(e,t);if(o.length===0){let m=he.getLatestEndDate(e);if(!m)return null;let p=he.calculateDuration(a.endDate,m);return Math.max(0,p)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,p)=>m-p)[0];if(!s)return null;let n=he.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>he.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=he.findTaskById(e,t);if(!r||!r.endDate)return e;let o=he.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=he.calculateDuration(n.startDate,n.endDate),p;a!==void 0?(p=new Date(n.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let i=he.calculateEndDate(p,m),u=d=>d.map(g=>g.id===n.id?{...g,startDate:p,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=he.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let p=[],i=o.getTime(),u=1e3*60*60*24,d=he.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(f,C,T=new Set)=>{if(T.has(f))return;T.add(f);let c=he.getDependentTasks(e,f);for(let b of c){if(!b.startDate||!b.endDate)continue;let v=r.findIndex(S=>S.id===b.id);if(v===-1)continue;let l=b.startDate.getTime(),y=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,B=Math.max(y*s,s),M=m+v*n+12;p.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:B,y:M,rowIndex:v,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),p},splitTask:(e,t,a,r=3)=>{let o=he.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:m,segments:p}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:m,dependencyLineStyle:p="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:f,onDependencyDelete:C}){let[c,b]=react.useState([]),[v,l]=react.useState(null),[x,y]=react.useState(null),D=react.useCallback(L=>{l(L);},[]),k=react.useCallback((L,N,W,U,R,se)=>{let pe=Math.min(W,U),Ne=Math.max(W,U);if(pe===Ne)return (L+N)/2;let ie=Math.max(L,N);for(let Le=pe;Le<=Ne;Le++){let Ee=R[Le];if(Ee?.startDate&&Ee?.endDate){let De=se(Ee),He=De.x+De.width;He>ie&&(ie=He);}}return ie+20},[]),w=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),B=r==="day"?60:r==="week"?20:8,M=w*B*n,S=L=>{let N=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),W=N.getUTCDay()||7;N.setUTCDate(N.getUTCDate()+4-W);let U=new Date(Date.UTC(N.getUTCFullYear(),0,1));return Math.ceil(((N.getTime()-U.getTime())/864e5+1)/7)},z=L=>{let N=L.getDay();return N===0||N===6},$=react.useCallback(L=>{let N=Math.round(L/(B*n)),W=new Date(o);return W.setDate(W.getDate()+N),W},[o,B,n]),K=react.useCallback((L,N)=>{if(N.startDate&&N.endDate)return;let W=L.currentTarget.ownerSVGElement;if(!W)return;let U=W.createSVGPoint();U.x=L.clientX,U.y=L.clientY;let R=U.matrixTransform(W.getScreenCTM()?.inverse()),se=$(R.x),pe=new Date(se);pe.setDate(pe.getDate()+1),g?.(N,se,pe);},[$,g]),Y=react.useMemo(()=>{let L=R=>R.map(se=>{if(se.subtasks&&se.subtasks.length>0){let pe=L(se.subtasks),Ne=pe.filter(ie=>ie.startDate&&ie.endDate);if(Ne.length>0){let ie=Ne.map(He=>He.startDate.getTime()),Le=Ne.map(He=>He.endDate.getTime()),Ee=new Date(Math.min(...ie)),De=new Date(Math.max(...Le));return {...se,subtasks:pe,startDate:Ee,endDate:De}}return {...se,subtasks:pe}}return se}),N=(R,se=[])=>{for(let pe of R)se.push(pe),pe.subtasks&&pe.subtasks.length>0&&(pe.isExpanded===void 0||pe.isExpanded)&&N(pe.subtasks,se);return se},W=L(e);return N(W)},[e]),ye=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let N=L.startDate.getTime(),W=L.endDate.getTime(),U=o.getTime(),R=(N-U)/(1e3*60*60*24),se=(W-N)/(1e3*60*60*24),pe=R*B*n,Ne=Math.max(B*n,40),ie=Math.max(se*B*n,Ne);return {x:pe,width:ie}},[o,B,n]),Oe=react.useMemo(()=>Y.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:N,width:W}=ye(L),R=Y.findIndex(se=>se.id===L.id)*a+12;return {id:L.id,x:N,y:R,width:W,height:32}}),[Y,ye]),nt=react.useCallback((L,N,W)=>{if(!W||N===0){b([]);return}let U=he.calculateCascadePreview(e,L,N,Y,o,B*n,a,48);b(U);},[e,Y,o,B,n,a,48]),_e=react.useMemo(()=>{let L=[],N=new Date(o);for(;N<=s;){let R=(N.getTime()-o.getTime())/864e5*B*n;if(r==="day")L.push({date:new Date(N),label:N.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:R}),N.setDate(N.getDate()+1);else if(r==="week"){let se=S(N);L.push({date:new Date(N),label:`Week ${se}`,x:R}),N.setDate(N.getDate()+7);}else L.push({date:new Date(N),label:N.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:R}),N.setMonth(N.getMonth()+1);}return L},[o,s,r,B,n]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*B*n,[o,B,n]),Q=Math.max(Y.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},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(M,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(M,1e3),height:48,fill:t.bgGrid}),_e.map((L,N)=>jsxRuntime.jsxs("g",{children:[N>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${N}`)),Ae>=0&&Ae<=M&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(M,1e3),height:Q,style:{display:"block",flexShrink:0,overflow:"visible"},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(M,1e3),height:Q,fill:t.bgPrimary}),_e.map((L,N)=>{let W=_e[N+1]?.x||M,U=z(L.date);return jsxRuntime.jsxs("g",{children:[U&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:W-L.x,height:Y.length*a,fill:t.bgWeekend,opacity:1}),N>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:Y.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},N)}),Y.map((L,N)=>{let W=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:N*a,width:M,height:a,fill:N%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:N*a,width:M,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:U=>K(U,L),onMouseEnter:U=>{U.currentTarget.setAttribute("fill",t.accentLight),U.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:U=>{U.currentTarget.setAttribute("fill","transparent"),U.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae:100,y:N*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),Y.map((L,N)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(W=>{let U=Y.find(et=>et.id===W);if(!U||!U.startDate||!U.endDate)return null;let R=Y.findIndex(et=>et.id===W),se=ye(U),pe=ye(L),Ne=se.x+se.width,ie=R*a+28,Le=pe.x,Ee=N*a+28,De=R*a+50,He=k(Ne,Le,R,N,Y,ye);return x&&x.x1===Ne&&x.y1===ie&&x.x2===Le&&x.y2===Ee?null:jsxRuntime.jsx(Pn,{x1:Ne,y1:ie,x2:Le,y2:Ee,verticalX:He,routeY:De,fromIndex:R,toIndex:N,rowHeight:a,theme:t,lineStyle:p},`dep-${W}-${L.id}`)})),Y.map((L,N)=>{if(!L.startDate||!L.endDate)return null;let{x:W,width:U}=ye(L),R=N*a+12,se=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(An,{task:L,x:W+U/2,y:R+16,theme:t,onClick:i},L.id):se?jsxRuntime.jsxs("g",{onClick:()=>i?.(L),onContextMenu:pe=>{pe.preventDefault(),pe.stopPropagation(),d?.(L,pe);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:R,width:U,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:R,x2:W+U,y2:R,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:R,x2:W,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+U,y1:R,x2:W+U,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:R+32,x2:W+U,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),U>60&&jsxRuntime.jsx("text",{x:W+12,y:R+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(Dn,{task:L,x:W,y:R,width:U,theme:t,dayWidth:B*n,startDate:o,templates:m,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:f,allTaskPositions:Oe,onDragMove:nt,onHoverChange:D},L.id)}),Y.map((L,N)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(W=>{let U=Y.find(le=>le.id===W);if(!U||!U.startDate||!U.endDate)return null;let R=Y.findIndex(le=>le.id===W),se=ye(U),pe=ye(L),Ne=se.x+se.width,ie=R*a+28,Le=pe.x,Ee=N*a+28,De=R*a+50,He=R===N,ht=k(Ne,Le,R,N,Y,ye),et;if(He){let le=Ne+20,Ce=Le-15;et=`M ${le} ${ie} L ${Ce} ${Ee}`;}else et=`M ${ht} ${ie+10} L ${ht} ${Ee-10}`;if(x&&x.x1===Ne&&x.y1===ie&&x.x2===Le&&x.y2===Ee)return null;let te=le=>{let Ce=le.currentTarget.ownerSVGElement;if(!Ce)return;let $e=Ce.getBoundingClientRect(),tt=le.clientX-$e.left,xt=le.clientY-$e.top;y({x1:Ne,y1:ie,x2:Le,y2:Ee,verticalX:ht,routeY:De,fromIndex:R,toIndex:N,onDelete:()=>C?.(L.id,W),lineStyle:p,mouseX:tt,mouseY:xt});};return jsxRuntime.jsx("path",{d:et,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:te,onMouseMove:te},`dep-hover-${W}-${L.id}`)})),c.map(L=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsxRuntime.jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),x&&(()=>{let{x1:L,y1:N,x2:W,y2:U,verticalX:R,onDelete:se,lineStyle:pe,mouseX:Ne,mouseY:ie}=x,Le=W-L,Ee=5,De=R??Math.max(L,W)+20,He=Ee,ht=U-N,et=ht>0,O=Math.abs(ht)<5,te;if(pe==="squared")te=`M ${L} ${N} L ${De} ${N} L ${De} ${U} L ${W} ${U}`;else if(O){let re=Math.min(Math.abs(Le)/3,30);te=`M ${L} ${N} C ${L+re} ${N}, ${W-re} ${U}, ${W} ${U}`;}else et?te=`M ${L} ${N} L ${De-He} ${N} Q ${De} ${N} ${De} ${N+He} L ${De} ${U-He} Q ${De} ${U} ${De-He} ${U} L ${W} ${U}`:te=`M ${L} ${N} L ${De-He} ${N} Q ${De} ${N} ${De} ${N-He} L ${De} ${U+He} Q ${De} ${U} ${De-He} ${U} L ${W} ${U}`;let le=5,Ce=W-le,$e=U-le*.5,tt=W-le,xt=U+le*.5,Me=t.dependency,Lt="#f87171",At="rgba(248, 113, 113, 0.15)",ct=(De+W)/2,Xe=O?(N+U)/2:U,Ht=false;Ne!==void 0&&ie!==void 0&&(ct=Math.max(W+20,Math.min(De-10,Ne)),Xe=O?(N+U)/2:U);let sa=Math.floor(Xe/a);if(sa>=0&&sa<Y.length){let re=Y[sa];if(re&&re.startDate&&re.endDate){let Vt=ye(re),de=sa*a+12,E=de+32,q=Vt.x-15,ge=Vt.x+Vt.width+50;ct>=q&&ct<=ge&&Xe>=de-5&&Xe<=E+5&&(Ht=true);}}return jsxRuntime.jsxs("g",{onMouseLeave:()=>y(null),onMouseMove:re=>{let Vt=re.currentTarget.ownerSVGElement||re.currentTarget;if(!Vt)return;let de=Vt.getBoundingClientRect(),E=re.clientX-de.left,q=re.clientY-de.top;y(ge=>ge?{...ge,mouseX:E,mouseY:q}:null);},children:[jsxRuntime.jsx("path",{d:te,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:te,fill:"none",stroke:Me,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:te,fill:"none",stroke:Me,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${W} ${U} L ${Ce} ${$e} M ${W} ${U} L ${tt} ${xt}`,fill:"none",stroke:Me,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:W,cy:U,r:4,fill:Me,opacity:.9,style:{pointerEvents:"none"}}),!Ht&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:re=>{re.stopPropagation(),y(null),se();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:ct,cy:Xe,r:9,fill:At,stroke:Lt,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:ct-3,y1:Xe-3,x2:ct+3,y2:Xe+3,stroke:Lt,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ct+3,y1:Xe-3,x2:ct-3,y2:Xe+3,stroke:Lt,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Ae>=0&&Ae<=M&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:Q,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),v&&jsxRuntime.jsx(pc,{tooltipData:v,theme:t})]})]})}var u0=['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"'],fc=()=>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"})]}),g0=()=>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"})}),f0=()=>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"})}),h0=()=>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"})}),b0=()=>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 In({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:p}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[f,C]=react.useState([]),[T,c]=react.useState(""),[b,v]=react.useState(false),[l,x]=react.useState(true),y=react.useRef(null),D=react.useRef(null),k=react.useRef(null),{enabled:w=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:S,suggestions:z=u0,maxHistory:$=50,persistHistory:K}=a,Y=K?.storageKey||"gantt-ai-history",ye=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let L=localStorage.getItem(Y);if(L){let W=JSON.parse(L).map(U=>({...U,timestamp:new Date(U.timestamp)}));C(W.slice(-ye));}}catch(L){console.warn("[GanttAIAssistant] Failed to load persisted history:",L);}},[K?.enabled,Y,ye]),react.useEffect(()=>{if(K?.enabled&&f.length>0)try{let L=f.filter(N=>!N.isLoading).slice(-ye);localStorage.setItem(Y,JSON.stringify(L));}catch(L){console.warn("[GanttAIAssistant] Failed to persist history:",L);}},[f,K?.enabled,Y,ye]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&y.current&&setTimeout(()=>y.current?.focus(),100);},[i,d]);let Oe=react.useCallback(L=>{if(L.success)switch(L.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":L.taskId&&L.updates&&o?.(L.taskId,L.updates);break;case "create_task":L.newTask&&s?.(L.newTask);break;case "delete_task":L.taskId&&n?.(L.taskId);break;case "link_tasks":L.dependencyFrom&&L.dependencyTo&&m?.(L.dependencyFrom,L.dependencyTo);break;case "unlink_tasks":L.taskId&&L.dependencyFrom&&p?.(L.taskId,L.dependencyFrom);break}},[o,s,n,m,p]),nt=react.useCallback(async L=>{if(!L.trim()||b)return;let N={id:`user-${Date.now()}`,role:"user",content:L,timestamp:new Date};C(U=>[...U.slice(-($-1)),N]),c(""),x(false),v(true);let W={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(U=>[...U,W]);try{if(S){let U=await S(L,e);C(R=>{let se=R.filter(Ne=>!Ne.isLoading),pe={id:`assistant-${Date.now()}`,role:"assistant",content:U.message,timestamp:new Date,command:U};return [...se,pe]}),Oe(U);}else C(U=>[...U.filter(se=>!se.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(U){C(R=>[...R.filter(pe=>!pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${U instanceof Error?U.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[b,$,S,e,Oe]),_e=L=>{L.preventDefault(),nt(T);},Ae=L=>{c(L),y.current?.focus();};if(react.useEffect(()=>{let L=N=>{(N.metaKey||N.ctrlKey)&&N.key==="k"&&(N.preventDefault(),u(W=>!W),i||g(false)),N.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i]),react.useEffect(()=>{if(!i)return;let L=W=>{let U=W.target;k.current&&!k.current.contains(U)&&u(false);},N=setTimeout(()=>{document.addEventListener("mousedown",L);},100);return ()=>{clearTimeout(N),document.removeEventListener("mousedown",L);}},[i]),!w)return null;let Q={"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(gt,{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 ${Q[M]} 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:()=>u(true),children:[jsxRuntime.jsx(fc,{}),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:k,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 ${Q[M]} 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(fc,{}),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(L=>!L),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(h0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(f0,{})})]})]}),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&&l&&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:z.slice(0,4).map((L,N)=>jsxRuntime.jsx("button",{onClick:()=>Ae(L),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:L.length>30?L.slice(0,30)+"...":L},N))})]}),f.map(L=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${L.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${L.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:L.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:L.role==="user"?"white":t.textPrimary},children:[L.isLoading?jsxRuntime.jsx(b0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content}),L.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:L.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:L.command.success?"#10B981":"#EF4444"},children:[L.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:L.command.type.replace(/_/g," ")})]})]})},L.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:_e,className:"p-3 border-t",style:{borderColor:t.border},children:[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:y,type:"text",value:T,onChange:L=>c(L.target.value),placeholder:B,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(g0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function hc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let f=[...d.past,d.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 u=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:u,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),p=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function bc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=m?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&p&&n.key==="y"){n.preventDefault(),t();return}if(m&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var k0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${he.formatDate(e.startDate)} - ${he.formatDate(e.endDate)}`);let a=he.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=>he.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function yc(e){return {...k0,...e}}var E0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},kc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:p=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:f,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:v,onCreateTask:l,taskFilter:x,onTaskFilterChange:y,onThemeChange:D,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:B,onTaskUpdate:M,onProgressChange:S,onTaskEdit:z,onTaskAddSubtask:$,onTaskMarkIncomplete:K,onTaskSetInProgress:Y,onDependencyCreate:ye,onDependencyDelete:Oe,onBeforeTaskAdd:nt,onAfterTaskAdd:_e,onBeforeTaskUpdate:Ae,onAfterTaskUpdate:Q,onBeforeTaskDelete:L,onAfterTaskDelete:N}=a,U=react.useContext(yn)?.theme,[R,se]=react.useState(U||s||"dark"),[pe,Ne]=react.useState(n),[ie,Le]=react.useState(m),[Ee,De]=react.useState(1),[He,ht]=react.useState("all"),et=x??He,O=y??ht,[te,le]=react.useState(0),[Ce,$e]=react.useState(false),[tt,xt]=react.useState(null),[Me,Lt]=react.useState({isOpen:false,x:0,y:0,task:null}),[At,ct]=react.useState(null),[Xe,Ht]=react.useState(null);react.useEffect(()=>{U&&U!==R&&se(U);},[U]),react.useEffect(()=>{s&&s!==R&&se(s);},[s]);let sa=react.useCallback(F=>{se(F),D?.(F);},[D]),{state:ae,setState:re,undo:Vt,redo:de,canUndo:E,canRedo:q,clearHistory:ge}=hc(t,50),Ie=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),We=react.useRef(new Map),Ye=react.useRef(false);if(!Ye.current&&f){Ye.current=true;let F=typeof f=="string"?f:"gantt-expanded-tasks";try{let I=localStorage.getItem(F);if(I){let V=JSON.parse(I);Array.isArray(V)&&(We.current=new Map(V));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let ze=react.useCallback(()=>{let F=Ie();if(F)try{let I=Array.from(We.current.entries());localStorage.setItem(F,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[Ie]);react.useEffect(()=>{let F=I=>I.map(V=>{let oe=We.current.get(V.id),fe=oe!==void 0?{...V,isExpanded:oe}:V;return fe.subtasks?.length?{...fe,subtasks:F(fe.subtasks)}:fe});We.current.size>0?re(F(t)):re(t);},[t,re]);let st=react.useRef(t),mt=react.useRef(true);react.useEffect(()=>{if(mt.current){mt.current=false,st.current=ae;return}if(!r)return;let F=JSON.stringify(st.current),I=JSON.stringify(ae);F!==I&&(st.current=ae,r(ae));},[ae,r]);let _=react.useMemo(()=>ei(T,c),[T,c]),ee=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Pe,qe]=react.useState(()=>ee(_));react.useEffect(()=>{qe(F=>F.map(I=>({...I,label:_.columns[I.id==="name"?"taskName":I.id]||I.label})));},[_]);let Ge=react.useMemo(()=>Pe.filter(I=>I.visible).reduce((I,V)=>I+V.width,0),[Pe]),G=react.useRef(Pe.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Pe.filter(oe=>oe.visible),I=F.map(oe=>oe.id).join(","),V=G.current;if(I!==V){let oe=F.some(Te=>Te.id!=="name"),fe=V.includes(",");oe?!fe&&oe&&xt(null):xt(null),G.current=I;}},[Pe]);let ce=60,Re=.6,Pt=react.useMemo(()=>{let I=Ge+ce,V=typeof window<"u"?window.innerWidth*Re:800,oe=Math.max(I,V);return tt!==null?Math.max(200,Math.min(tt,oe)):Math.max(200,I)},[tt,Ge]),at=react.useRef(null),xa=react.useRef(null),fa=react.useRef(null),P=react.useMemo(()=>Ud(R),[R]),ve=react.useMemo(()=>({theme:P,themeName:R}),[P,R]),J=react.useMemo(()=>yc(d),[d]),Fe=react.useMemo(()=>{if(!g)return ae;let F=he.calculateCriticalPath(ae),I=V=>V.map(oe=>({...oe,isCriticalPath:F.includes(oe.id),subtasks:oe.subtasks?I(oe.subtasks):void 0}));return I(ae)},[ae,g]),it=react.useMemo(()=>{if(et==="all")return Fe;let F=I=>{let V=[];for(let oe of I){let fe=oe.subtasks?.length?F(oe.subtasks):void 0,Te=false;switch(et){case "incomplete":Te=oe.progress<100;break;case "in_progress":Te=oe.progress>0&&oe.progress<100;break;case "completed":Te=oe.progress===100;break}(Te||fe&&fe.length>0)&&V.push({...oe,subtasks:fe});}return V};return F(Fe)},[Fe,et]),ne=E0(ie);bc({undo:Vt,redo:de,canUndo:E,canRedo:q,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>he.findTaskById(ae,F),addTask:(F,I)=>{re(V=>{if(!I)return [...V,{...F,level:0}];let oe=fe=>fe.map(Te=>Te.id===I?{...Te,subtasks:[...Te.subtasks||[],{...F,parentId:I,level:(Te.level||0)+1}],isExpanded:true}:Te.subtasks?{...Te,subtasks:oe(Te.subtasks)}:Te);return oe(V)});},updateTask:(F,I)=>{re(V=>{let oe=fe=>fe.map(Te=>Te.id===F?{...Te,...I}:Te.subtasks?{...Te,subtasks:oe(Te.subtasks)}:Te);return oe(V)});},deleteTask:F=>{re(I=>{let V=oe=>oe.filter(fe=>fe.id===F?false:(fe.subtasks&&(fe.subtasks=V(fe.subtasks)),true));return V(I)});},deleteTasks:F=>{re(I=>ci(I,F));},duplicateTask:F=>{re(I=>mi(I,[F]));},splitTask:(F,I,V=3)=>{re(oe=>he.splitTask(oe,F,I,V));},calculateEndDate:he.calculateEndDate,calculateDuration:he.calculateDuration,validateDependency:(F,I)=>!he.validateDependencies(ae,F,I),getAllTasks:()=>he.flattenTasks(ae),getTasksByStatus:F=>he.flattenTasks(ae).filter(I=>I.status===F),getTasksByParent:F=>F?he.findTaskById(ae,F)?.subtasks||[]:ae.filter(V=>!V.parentId),getCriticalPath:()=>he.flattenTasks(ae).filter(F=>F.isCriticalPath),indentTask:F=>{re(I=>ii(I,[F]));},outdentTask:F=>{re(I=>li(I,[F]));},moveTask:(F,I)=>{re(V=>di(V,[F],I));},createSubtask:async F=>{let{tasks:I,newTask:V}=gi(ae,F);if(nt){let oe=nt({...V,parentId:F});if((oe instanceof Promise?await oe:oe)===false)return}re(I),_e&&_e({...V,parentId:F});},scrollToTask:F=>{let V=he.flattenTasks(ae).findIndex(oe=>oe.id===F);if(V!==-1&&at.current){let oe=V*ne;at.current.scrollTo({top:oe,behavior:"smooth"}),xa.current&&xa.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(F,I=2e3)=>{},expandTask:F=>{re(I=>{let V=oe=>oe.map(fe=>fe.id===F?{...fe,isExpanded:true}:fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe);return V(I)});},collapseTask:F=>{re(I=>{let V=oe=>oe.map(fe=>fe.id===F?{...fe,isExpanded:false}:fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe);return V(I)});},expandAll:()=>{re(F=>{let I=V=>V.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?I(oe.subtasks):void 0}));return I(F)});},collapseAll:()=>{re(F=>{let I=V=>V.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?I(oe.subtasks):void 0}));return I(F)});},undo:Vt,redo:de,canUndo:()=>E,canRedo:()=>q,clearHistory:ge,exportToPNG:async()=>{if(!fa.current||!at.current||!xa.current)throw new Error("Gantt container not found");let F=fa.current,I=at.current.querySelector(".gantt-grid-scroll"),V=xa.current,oe=I?.scrollTop||0,fe=V.scrollTop,Te=F.style.overflow,kt=F.style.height;try{let ea=I?.querySelector(".gantt-taskgrid-content"),ka=V.querySelector("svg"),wa=ea?.scrollHeight||I?.scrollHeight||600,Aa=ka?.getBoundingClientRect().height||V.scrollHeight,Br=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(wa,Aa)+20;I&&(I.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Br}px`,await new Promise(kr=>setTimeout(kr,100));let xr=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let ro=window.getComputedStyle(kr),Rr=parseInt(ro.zIndex,10);return !isNaN(Rr)&&Rr>=50||ro.position==="fixed"}});return new Promise((kr,ro)=>{xr.toBlob(Rr=>{Rr?kr(Rr):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Te,F.style.height=kt,I&&(I.scrollTop=oe),V.scrollTop=fe;}},exportToPDF:async F=>{await he.exportToPDF(ae,F);},exportToExcel:async F=>{await he.exportToExcel(ae,F);},exportToJSON:()=>he.exportToJSON(ae),exportToCSV:()=>he.exportToCSV(ae),importFromJSON:F=>{let I=he.importFromJSON(F);re(I);},getTasks:()=>ae,refresh:()=>{re(F=>[...F]);},clearAll:()=>{re([]);}}),[ae,Vt,de,E,q,ge,P,ne]);let Ue=react.useCallback(F=>{qe(I=>I.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),Nt=react.useCallback((F,I)=>{qe(V=>V.map(oe=>{if(oe.id!==F)return oe;let fe=oe.minWidth??100,Te=oe.maxWidth??800,kt=Math.max(fe,Math.min(Te,I));return {...oe,width:kt}}));},[]),Be=react.useCallback(F=>{re(I=>{let V=ui(I,F),oe=fe=>{for(let Te of fe){if(Te.id===F){We.current.set(F,Te.isExpanded??true);return}Te.subtasks?.length&&oe(Te.subtasks);}};return oe(V),ze(),V}),a.onTaskToggleExpand?.(F);},[a,ze]),It=react.useCallback((F,I)=>{if(Ae&&Ae(F,I)===false)return;let oe=he.findTaskById(ae,F)?.progress,fe=kt=>kt.map(ea=>ea.id===F?{...ea,...I}:ea.subtasks?{...ea,subtasks:fe(ea.subtasks)}:ea);re(fe(ae));let Te=he.findTaskById(fe(ae),F);Te&&(M?.(Te),Q?.(Te),I.progress!==void 0&&oe!==void 0&&I.progress!==oe&&S?.(F,oe,I.progress));},[ae,M,Ae,Q,S]),pt=react.useCallback(F=>{F.length!==0&&(re(I=>ii(I,F)),a.onTaskIndent?.(F[0]));},[a]),ha=react.useCallback(F=>{F.length!==0&&(re(I=>li(I,F)),a.onTaskOutdent?.(F[0]));},[a]),Wt=react.useCallback((F,I,V)=>{re(oe=>oc(oe,F,I,V)),a.onTaskReparent?.(F,I,V);},[a]),Ke=react.useCallback((F,I)=>{F.length!==0&&(re(V=>di(V,F,I)),a.onTaskMove?.(F[0],I));},[a]),Dt=react.useCallback(async F=>{let I=[];for(let V of F)L&&await Promise.resolve(L(V))===false||I.push(V);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(re(V=>ci(V,I)),I.forEach(V=>a.onTaskDelete?.(V))),N&&I.forEach(V=>N(V)));},[a,L,N]),ca=react.useCallback(F=>{re(I=>mi(I,F)),F.forEach(I=>a.onTaskDuplicate?.(I));},[a]),yr=react.useCallback((F,I)=>{re(V=>{let{tasks:oe,newTask:fe}=rc(V,F,I);return nt&&nt(fe)===false?V:(a.onTaskCreate?.(fe.parentId,fe.position||0),_e?.(fe),oe)});},[a,nt,_e]),Um=react.useCallback((F,I)=>{re(V=>pi(V,F,I)),a.onTaskRename?.(F,I);},[a]),Zn=react.useCallback(F=>{re(I=>{let{tasks:V}=gi(I,F);return a.onTaskCreate?.(F,0),V});},[a]),Hm=react.useCallback((F,I,V)=>{let oe=F.startDate?Math.round((I.getTime()-F.startDate.getTime())/864e5):0,fe=ea=>ea.map(ka=>ka.id===F.id?{...ka,startDate:I,endDate:V,...F.segments&&{segments:F.segments}}:ka.subtasks?{...ka,subtasks:fe(ka.subtasks)}:ka),Te=fe(ae);Te=he.autoScheduleDependents(Te,F.id,oe),re(Te);let kt={...F,startDate:I,endDate:V};M?.(kt);},[ae,M]),Wm=react.useCallback((F,I)=>{B?.(F,I),Lt({isOpen:true,x:I.clientX,y:I.clientY,task:F});},[B]),Gm=react.useCallback((F,I)=>{let V=he.splitTask(ae,F.id,I);re(V),Lt({isOpen:false,x:0,y:0,task:null});},[ae]),hl=react.useCallback(F=>{let I=he.findTaskById(ae,F.id)||F;w?.(I),z||ct(I);},[ae,w,z]),bl=react.useCallback((F,I,V)=>{let oe=new Map,fe=wa=>{wa.forEach(Aa=>{Aa.dependencies&&oe.set(Aa.id,Aa.dependencies),Aa.subtasks&&fe(Aa.subtasks);});};fe(V);let Te=oe.get(I)||[];oe.set(I,[...Te,F]);let kt=new Set,ea=new Set,ka=wa=>{if(!kt.has(wa)){kt.add(wa),ea.add(wa);let Aa=oe.get(wa)||[];for(let vr of Aa){if(!kt.has(vr)&&ka(vr))return true;if(ea.has(vr))return true}}return ea.delete(wa),false};return ka(I)},[]),yl=react.useCallback((F,I)=>{if(bl(F.id,I,ae)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
343
343
|
|
|
344
|
-
Task dependencies must flow in one direction only.`);return}let V=ae=>ae.map(fe=>{if(fe.id===I){let Ne=fe.dependencies||[];if(!Ne.includes(F.id))return {...fe,dependencies:[...Ne,F.id]}}return fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe});ue(V(te)),be?.(F.id,I);},[te,be,bl]),vl=react.useCallback((F,I)=>{let V=ae=>ae.map(fe=>{if(fe.id===F&&fe.dependencies){let Ne=fe.dependencies.filter(wt=>wt!==I);return {...fe,dependencies:Ne}}return fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe});ue(V(te)),ze?.(F,I);},[te,ze]),{startDate:_m,endDate:Vm}=react.useMemo(()=>{let F=te.filter(Ne=>Ne.startDate&&Ne.endDate);if(F.length===0){let Ne=new Date,wt=new Date(Ne);wt.setDate(wt.getDate()-30);let ea=new Date(Ne);return ea.setDate(ea.getDate()+60),{startDate:wt,endDate:ea}}let I=F.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),V=new Date(Math.min(...I.map(Ne=>Ne.getTime()))),ae=new Date(Math.max(...I.map(Ne=>Ne.getTime()))),fe=ce==="day"?7:ce==="week"?14:30;return V.setDate(V.getDate()-fe),ae.setDate(ae.getDate()+fe),{startDate:V,endDate:ae}},[te,ce]),jm=react.useCallback(async()=>{if(!fa.current||!rt.current||!xa.current)return;await new Promise(Br=>setTimeout(Br,200));let F=fa.current,I=rt.current.querySelector(".gantt-grid-scroll"),V=xa.current,ae=I?.scrollTop||0,fe=I?.scrollLeft||0,Ne=V.scrollTop,wt=V.scrollLeft,ea=F.style.overflow,ka=F.style.height,wa=I?.style.overflow||"",Aa=V.style.overflow,vr=F.style.width,Jo=V.style.width;try{let Br=I?.querySelector(".gantt-taskgrid-content"),xr=V.querySelector("svg"),kr=xr?.getAttribute("height")?parseInt(xr.getAttribute("height"),10):xr?.getBoundingClientRect().height||0,ro=Br?.scrollHeight||I?.scrollHeight||600,Rr=Math.max(kr,V.scrollHeight),xl=xr?.getAttribute("width")?parseInt(xr.getAttribute("width"),10):xr?.getBoundingClientRect().width||V.scrollWidth,Zm=F.querySelector('[class*="h-12"]')?.offsetHeight||48,Zn=Math.max(ro,Rr,kr),es=Zm+Zn+50,ts=(I?.offsetWidth||300)+xl+10;I&&(I.scrollTop=0,I.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,F.style.overflow="visible",F.style.height=`${es}px`,F.style.width=`${ts}px`,I&&(I.style.overflow="visible",I.style.height=`${Zn+50}px`),V.style.overflow="visible",V.style.height=`${Zn+50}px`,V.style.width=`${xl+10}px`,await new Promise(rs=>setTimeout(rs,150));let ep=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ts,height:es,windowWidth:ts+100,windowHeight:es+100,scrollX:0,scrollY:0,ignoreElements:rs=>{let kl=window.getComputedStyle(rs),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),as=document.createElement("a");as.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,as.href=ep.toDataURL("image/png"),as.click();}finally{F.style.overflow=ea,F.style.height=ka,F.style.width=vr,I&&(I.style.overflow=wa,I.style.height="",I.scrollTop=ae,I.scrollLeft=fe),V.style.overflow=Aa,V.style.height="",V.style.width=Jo,V.scrollTop=Ne,V.scrollLeft=wt;}},[P]),Km=react.useCallback(async()=>{await he.exportToPDF(te);},[te]),Ym=react.useCallback(async()=>{await he.exportToExcel(te);},[te]),qm=react.useCallback(()=>{let F=he.exportToCSV(te),I=new Blob([F],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[te]),Xm=react.useCallback(()=>{let F=he.exportToJSON(te),I=new Blob([F],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[te]),Jm=react.useCallback(()=>{he.exportToMSProject(te,"Gantt Project","project.xml");},[te]),Qm=F=>{F.preventDefault(),Oe(true);},ao=react.useRef(false);return react.useEffect(()=>{let F=xa.current,I=rt.current?.querySelector(".gantt-grid-scroll");if(!F||!I)return;let V=()=>{if(ao.current)return;ao.current=true;let wt=F.scrollTop;se(wt),I.scrollTop=wt,requestAnimationFrame(()=>{ao.current=false;});},ae=()=>{if(ao.current)return;ao.current=true;let wt=I.scrollTop;se(wt),F.scrollTop=wt,requestAnimationFrame(()=>{ao.current=false;});},fe=wt=>{if(Ce&&I){let ka=I.parentElement?.getBoundingClientRect()?.left||0,wa=wt.clientX-ka,Aa=200,vr=_e+de,Jo=window.innerWidth*$e,Br=Math.max(vr,Jo);wa>=Aa&&wa<=Br&&kt(wa);}},Ne=()=>{Oe(false);};return F.addEventListener("scroll",V),I.addEventListener("scroll",ae),document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Ne),()=>{F.removeEventListener("scroll",V),I.removeEventListener("scroll",ae),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Ne);}},[Ce,_e]),jsxRuntime.jsx(ho.Provider,{value:_,children:jsxRuntime.jsx(ls.Provider,{value:ve,children:jsxRuntime.jsxs("div",{ref:fa,className:"flex flex-col h-full w-full",style:{backgroundColor:P.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(kn,{theme:P,timeScale:ce,onTimeScaleChange:De,zoom:Se,onZoomChange:Fe,currentTheme:R,onThemeChange:ua,rowDensity:le,onRowDensityChange:Be,showThemeSelector:p,showCreateTaskButton:b,createTaskLabel:v,onCreateTask:l,taskFilter:je,onTaskFilterChange:z,onExportPNG:i?jm:void 0,onExportPDF:i?Km:void 0,onExportExcel:i?Ym:void 0,onExportCSV:i?qm:void 0,onExportJSON:i?Xm:void 0,onExportMSProject:i?Jm:void 0}),jsxRuntime.jsxs("div",{ref:rt,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Ft,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Nn,{tasks:lt,theme:P,rowHeight:oe,availableUsers:u,templates:J,onTaskClick:x,onTaskDblClick:hl,onTaskContextMenu:B,onTaskToggle:Re,scrollTop:re,columns:Pe,onToggleColumn:He,onColumnResize:St,onTaskUpdate:Rt,onTaskIndent:pt,onTaskOutdent:ha,onTaskMove:qe,onMultiTaskDelete:Et,onTaskDuplicate:da,onTaskCreate:yr,onTaskRename:Um,onCreateSubtask:Qn,onOpenTaskModal:x?F=>x(F):void 0,onDeleteRequest:(F,I)=>bt({taskId:F,taskName:I}),onTaskReparent:Gt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:P.border,zIndex:15},onMouseDown:Qm}),jsxRuntime.jsx("div",{ref:xa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ln,{tasks:lt,theme:P,rowHeight:oe,timeScale:ce,startDate:_m,endDate:Vm,zoom:Se,templates:J,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:x,onTaskDblClick:hl,onTaskContextMenu:Wm,onTaskDateChange:Hm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Le.task&&jsxRuntime.jsx(yo,{isOpen:Le.isOpen,x:Le.x,y:Le.y,theme:P,onClose:()=>It({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Le.task;if(!F)return [];let I=he.findTaskById(te,F.id)||F;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{$?$(I):Qn(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{bt({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{U?U(I):Dt(I);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{$?$(I):Qn(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{j?j(I):Rt(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{K?K(I):Rt(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{Rt(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let ae=I.startDate.getTime(),fe=I.endDate.getTime(),Ne=ae+(fe-ae)/2,wt=new Date(Ne);Gm(I,wt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{bt({taskId:I.id,taskName:I.name});}}]})()}),jsxRuntime.jsx(Gr,{task:Mt,isOpen:!!Mt,onClose:()=>Dt(null),onTaskUpdate:F=>{Mt&&(Rt(Mt.id,F),Dt(null));},theme:R==="light"?"light":"dark",locale:N==="es"?"es":"en",availableUsers:u,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:()=>bt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:P.bgSecondary,border:`1px solid ${P.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${P.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:P.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},children:N==="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:P.textSecondary,fontFamily:"Inter, sans-serif"},children:[N==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:P.textPrimary},children:['"',Qe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:P.bgPrimary,borderTop:`1px solid ${P.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>bt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=P.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:N==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Et([Qe.taskId]),bt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),N==="es"?"Eliminar":"Delete"]})]})]})})}),T?.enabled&&jsxRuntime.jsx(In,{tasks:te,theme:P,config:T,onTasksUpdate:ue,onTaskUpdate:Rt,onTaskCreate:F=>{ue(I=>[...I,F]);},onTaskDelete:F=>{Et([F]);},onDependencyCreate:(F,I)=>{let V=he.findTaskById(te,F);V&&yl(V,I);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{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 Tc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:p="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:T}){let N=[...ki,...i.filter(z=>!ki.some(re=>re.id===z.id))],c=Ze[p]||Ze.dark,[b,v]=react.useState(false),[l,k]=react.useState(false),[y,D]=react.useState(false),[x,w]=react.useState(false),[B,M]=react.useState({top:0,left:0}),[S,U]=react.useState(null),[$,j]=react.useState(new Date),[K,be]=react.useState({top:0,left:0}),[ze,st]=react.useState(false),[Ve,Ae]=react.useState([]),Z=react.useRef(null),L=react.useRef(null),C=react.useRef(null),W=react.useRef(null),O=react.useRef(null),[R,ne]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ce,De]=react.useState({});react.useEffect(()=>{a?(ne({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)&&st(true)):(ne({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),st(false),Ae([]));},[a,e]),react.useEffect(()=>{let z=re=>{Z.current&&!Z.current.contains(re.target)&&v(false),L.current&&!L.current.contains(re.target)&&k(false),C.current&&!C.current.contains(re.target)&&D(false),W.current&&!W.current.contains(re.target)&&w(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let le=()=>{let z={};return R.name.trim()||(z.name="El nombre es requerido"),R.startDate&&R.endDate&&R.startDate>R.endDate&&(z.endDate="La fecha de fin debe ser posterior a la de inicio"),De(z),Object.keys(z).length===0},Be=async z=>{if(z.preventDefault(),!!le())try{let re=m==="create"&&Ve.length>0?{...R,pendingFiles:Ve}:R;await s(re),Ae([]),t();}catch(re){console.error("Error submitting task:",re);}},Se=(z,re)=>{ne(se=>{let Ce={...se,[z]:re};if(z==="status"){let Oe=re;Oe==="todo"?Ce.progress=0:Oe==="in-progress"?(se.progress===0||se.progress===100)&&(Ce.progress=50):Oe==="completed"||Oe==="closed"?Ce.progress=100:(Oe==="in-review"||Oe==="review")&&(Ce.progress=75);}if(z==="progress"){let Oe=typeof re=="number"?re:parseInt(re,10);Oe===100&&se.status!=="completed"?Ce.status="completed":Oe>0&&Oe<100&&se.status==="todo"?Ce.status="in-progress":Oe===0&&se.status!=="todo"&&(Ce.status="todo");}return Ce}),ce[z]&&De(se=>{let Ce={...se};return delete Ce[z],Ce});},Fe=N.find(z=>z.id===R.status)??ki[0],xe=wi.find(z=>z.id===R.priority)??wi[1],We=sr.find(z=>z.value===R.color)??sr[0],je={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.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":p,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Fe.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=c.hoverBg,z.currentTarget.style.color=c.textPrimary;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent",z.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Be,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:R.name,onChange:z=>Se("name",z.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),ce.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"}),ce.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:R.description||"",onChange:z=>Se("description",z.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...je,borderColor:Fe.color,backgroundColor:`${Fe.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Fe.color}}),jsxRuntime.jsx("span",{style:{color:Fe.color},children:Fe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Fe.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:N.map(z=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Se("status",z.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:z.color}}),z.title,R.status===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),jsxRuntime.jsxs("div",{ref:L,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:je,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:xe.color}}),jsxRuntime.jsx("span",{children:xe.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.map(z=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Se("priority",z.id),k(false);},children:[jsxRuntime.jsx("span",{children:z.icon}),z.label,R.priority===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:C,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:je,disabled:n,children:[R.assignees&&R.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:R.assignees.slice(0,3).map((z,re)=>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:z.color||c.accent,borderColor:c.bgSecondary},children:z.initials},re))}),R.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",R.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),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-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(z=>{let re=R.assignees?.some(se=>se.name===z.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:c.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let se=re?(R.assignees||[]).filter(Ce=>Ce.name!==z.name):[...R.assignees||[],{name:z.name,avatar:z.avatar,initials:z.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:c.accent}];Se("assignees",se);},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:c.accent},children:z.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:z.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},z.id)})})})]}),jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(x)w(false);else {if(W.current){let z=W.current.getBoundingClientRect(),re=window.innerHeight,se=120,Oe=re-z.bottom<se?z.top-se-8:z.bottom+8;M({top:Oe,left:z.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:je,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:R.color}}),jsxRuntime.jsx("span",{children:We.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(gt,{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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:z=>z.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sr.slice(0,18).map(z=>{let re=R.color===z.value;return jsxRuntime.jsx("button",{type:"button",onClick:se=>{se.preventDefault(),se.stopPropagation(),Se("color",z.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:z.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:z.value,outline:re?`2px solid ${z.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},z.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(nr,{selectedTags:R.tags||[],availableTags:u,onChange:z=>Se("tags",z),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:O,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!R.isMilestone)if(S==="start")U(null);else {if(O.current){let z=O.current.getBoundingClientRect(),re=window.innerHeight,se=320,Oe=re-z.bottom<se?z.top-se-8:z.bottom+8;be({top:Oe,left:z.left});}U("start"),j(R.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...je,opacity:R.isMilestone?.5:1,cursor:R.isMilestone?"not-allowed":"pointer"},disabled:n||R.isMilestone,children:R.startDate?R.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!R.isMilestone)if(S==="end")U(null);else {if(O.current){let z=O.current.getBoundingClientRect(),re=window.innerHeight,se=320,Oe=re-z.bottom<se?z.top-se-8:z.bottom+8;be({top:Oe,left:z.left});}U("end"),j(R.endDate||R.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...je,opacity:R.isMilestone?.5:1,cursor:R.isMilestone?"not-allowed":"pointer"},disabled:n||R.isMilestone,children:R.endDate?R.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${K.top}px`,left:`${K.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let z=new Date,re=new Date(z);re.setDate(z.getDate()+1);let se=new Date(z);se.setDate(z.getDate()+7);let Ce=new Date(z);return Ce.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:se},{label:"2 semanas",date:Ce}].map((at,kt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{S==="start"?(Se("startDate",at.date),(!R.endDate||at.date>R.endDate)&&Se("endDate",at.date),U("end")):(Se("endDate",at.date),(!R.startDate||at.date<R.startDate)&&Se("startDate",at.date),U(null));},children:at.label},kt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.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:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{Se("startDate",void 0),Se("endDate",void 0),U(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((z,re)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:z},re))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let z=$.getFullYear(),re=$.getMonth(),se=new Date(z,re,1).getDay(),Ce=new Date(z,re+1,0).getDate(),Oe=new Date,at=[];for(let Le=se-1;Le>=0;Le--)at.push({day:new Date(z,re,-Le).getDate(),date:new Date(z,re-1,new Date(z,re,-Le).getDate()),isCurrentMonth:false});for(let Le=1;Le<=Ce;Le++)at.push({day:Le,date:new Date(z,re,Le),isCurrentMonth:true});let kt=42-at.length;for(let Le=1;Le<=kt;Le++)at.push({day:Le,date:new Date(z,re+1,Le),isCurrentMonth:false});return at.map((Le,It)=>{let Mt=Le.date.toDateString()===Oe.toDateString(),Dt=R.startDate?.toDateString()===Le.date.toDateString(),Qe=R.endDate?.toDateString()===Le.date.toDateString(),bt=R.startDate&&R.endDate&&Le.date>=R.startDate&&Le.date<=R.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:Le.isCurrentMonth?Dt||Qe?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:Dt?"#3B82F6":Qe?"#7C3AED":bt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Mt&&!Dt&&!Qe?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{S==="start"?(Se("startDate",Le.date),R.endDate&&Le.date>R.endDate&&Se("endDate",Le.date),U("end")):(Se("endDate",Le.date),R.startDate&&Le.date<R.startDate&&Se("startDate",Le.date),U(null));},children:Le.day},It)})})()})]})]})]})})]}),ce.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ce.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:c.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:R.progress,onChange:z=>Se("progress",parseInt(z.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:R.progress<30?"#EF4444":R.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:`${R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"}20`,color:R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"},children:[R.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>st(!ze),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ze?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&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:[(f||g.length>0||m==="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:c.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:c.textTertiary},children:["Adjuntos ",m==="create"?Ve.length>0&&`(${Ve.length})`:g.length>0&&`(${g.length})`]})]}),m==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:Ve.map((z,re)=>({id:`pending-${re}`,cardId:"pending",name:z.name,size:z.size,type:z.type,url:URL.createObjectURL(z),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:z=>Ae(re=>[...re,...z]),onDelete:z=>{let re=parseInt(z.replace("pending-",""),10);Ae(se=>se.filter((Ce,Oe)=>Oe!==re));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?z=>f(a.id,z):void 0,onDelete:T,maxSizeMB:10,maxFiles:20}),m==="create"&&Ve.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[Ve.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:R.isMilestone,onChange:z=>Se("isMilestone",z.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(z=>z.id!==a?.id).map(z=>{let re=R.dependencies?.includes(z.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let se=re?(R.dependencies||[]).filter(Ce=>Ce!==z.id):[...R.dependencies||[],z.id];Se("dependencies",se);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:re?`${c.accent}30`:c.bgPrimary,color:re?c.accent:c.textSecondary,border:`1px solid ${re?c.accent:c.borderLight}`},disabled:n,children:z.name},z.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.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:c.accent,color:"#FFF"},onMouseEnter:z=>!n&&(z.currentTarget.style.opacity="0.9"),onMouseLeave:z=>!n&&(z.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:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Nc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
344
|
+
Task dependencies must flow in one direction only.`);return}let V=oe=>oe.map(fe=>{if(fe.id===I){let Te=fe.dependencies||[];if(!Te.includes(F.id))return {...fe,dependencies:[...Te,F.id]}}return fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe});re(V(ae)),ye?.(F.id,I);},[ae,ye,bl]),vl=react.useCallback((F,I)=>{let V=oe=>oe.map(fe=>{if(fe.id===F&&fe.dependencies){let Te=fe.dependencies.filter(kt=>kt!==I);return {...fe,dependencies:Te}}return fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe});re(V(ae)),Oe?.(F,I);},[ae,Oe]),{startDate:_m,endDate:Vm}=react.useMemo(()=>{let F=ae.filter(Te=>Te.startDate&&Te.endDate);if(F.length===0){let Te=new Date,kt=new Date(Te);kt.setDate(kt.getDate()-30);let ea=new Date(Te);return ea.setDate(ea.getDate()+60),{startDate:kt,endDate:ea}}let I=F.flatMap(Te=>[Te.startDate,Te.endDate]).filter(Te=>Te!==void 0),V=new Date(Math.min(...I.map(Te=>Te.getTime()))),oe=new Date(Math.max(...I.map(Te=>Te.getTime()))),fe=pe==="day"?7:pe==="week"?14:30;return V.setDate(V.getDate()-fe),oe.setDate(oe.getDate()+fe),{startDate:V,endDate:oe}},[ae,pe]),jm=react.useCallback(async()=>{if(!fa.current||!at.current||!xa.current)return;await new Promise(Br=>setTimeout(Br,200));let F=fa.current,I=at.current.querySelector(".gantt-grid-scroll"),V=xa.current,oe=I?.scrollTop||0,fe=I?.scrollLeft||0,Te=V.scrollTop,kt=V.scrollLeft,ea=F.style.overflow,ka=F.style.height,wa=I?.style.overflow||"",Aa=V.style.overflow,vr=F.style.width,Jo=V.style.width;try{let Br=I?.querySelector(".gantt-taskgrid-content"),xr=V.querySelector("svg"),kr=xr?.getAttribute("height")?parseInt(xr.getAttribute("height"),10):xr?.getBoundingClientRect().height||0,ro=Br?.scrollHeight||I?.scrollHeight||600,Rr=Math.max(kr,V.scrollHeight),xl=xr?.getAttribute("width")?parseInt(xr.getAttribute("width"),10):xr?.getBoundingClientRect().width||V.scrollWidth,Qm=F.querySelector('[class*="h-12"]')?.offsetHeight||48,Qn=Math.max(ro,Rr,kr),es=Qm+Qn+50,ts=(I?.offsetWidth||300)+xl+10;I&&(I.scrollTop=0,I.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,F.style.overflow="visible",F.style.height=`${es}px`,F.style.width=`${ts}px`,I&&(I.style.overflow="visible",I.style.height=`${Qn+50}px`),V.style.overflow="visible",V.style.height=`${Qn+50}px`,V.style.width=`${xl+10}px`,await new Promise(rs=>setTimeout(rs,150));let ep=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ts,height:es,windowWidth:ts+100,windowHeight:es+100,scrollX:0,scrollY:0,ignoreElements:rs=>{let kl=window.getComputedStyle(rs),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),as=document.createElement("a");as.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,as.href=ep.toDataURL("image/png"),as.click();}finally{F.style.overflow=ea,F.style.height=ka,F.style.width=vr,I&&(I.style.overflow=wa,I.style.height="",I.scrollTop=oe,I.scrollLeft=fe),V.style.overflow=Aa,V.style.height="",V.style.width=Jo,V.scrollTop=Te,V.scrollLeft=kt;}},[P]),Km=react.useCallback(async()=>{await he.exportToPDF(ae);},[ae]),Ym=react.useCallback(async()=>{await he.exportToExcel(ae);},[ae]),qm=react.useCallback(()=>{let F=he.exportToCSV(ae),I=new Blob([F],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ae]),Xm=react.useCallback(()=>{let F=he.exportToJSON(ae),I=new Blob([F],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ae]),Jm=react.useCallback(()=>{he.exportToMSProject(ae,"Gantt Project","project.xml");},[ae]),Zm=F=>{F.preventDefault(),$e(true);},ao=react.useRef(false);return react.useEffect(()=>{let F=xa.current,I=at.current?.querySelector(".gantt-grid-scroll");if(!F||!I)return;let V=()=>{if(ao.current)return;ao.current=true;let kt=F.scrollTop;le(kt),I.scrollTop=kt,requestAnimationFrame(()=>{ao.current=false;});},oe=()=>{if(ao.current)return;ao.current=true;let kt=I.scrollTop;le(kt),F.scrollTop=kt,requestAnimationFrame(()=>{ao.current=false;});},fe=kt=>{if(Ce&&I){let ka=I.parentElement?.getBoundingClientRect()?.left||0,wa=kt.clientX-ka,Aa=200,vr=Ge+ce,Jo=window.innerWidth*Re,Br=Math.max(vr,Jo);wa>=Aa&&wa<=Br&&xt(wa);}},Te=()=>{$e(false);};return F.addEventListener("scroll",V),I.addEventListener("scroll",oe),document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Te),()=>{F.removeEventListener("scroll",V),I.removeEventListener("scroll",oe),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Te);}},[Ce,Ge]),jsxRuntime.jsx(ho.Provider,{value:_,children:jsxRuntime.jsx(ls.Provider,{value:ve,children:jsxRuntime.jsxs("div",{ref:fa,className:"flex flex-col h-full w-full",style:{backgroundColor:P.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(kn,{theme:P,timeScale:pe,onTimeScaleChange:Ne,zoom:Ee,onZoomChange:De,currentTheme:R,onThemeChange:sa,rowDensity:ie,onRowDensityChange:Le,showThemeSelector:p,showCreateTaskButton:b,createTaskLabel:v,onCreateTask:l,taskFilter:et,onTaskFilterChange:O,onExportPNG:i?jm:void 0,onExportPDF:i?Km:void 0,onExportExcel:i?Ym:void 0,onExportCSV:i?qm:void 0,onExportJSON:i?Xm:void 0,onExportMSProject:i?Jm:void 0}),jsxRuntime.jsxs("div",{ref:at,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Pt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Nn,{tasks:it,theme:P,rowHeight:ne,availableUsers:u,templates:J,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:B,onTaskToggle:Be,scrollTop:te,columns:Pe,onToggleColumn:Ue,onColumnResize:Nt,onTaskUpdate:It,onTaskIndent:pt,onTaskOutdent:ha,onTaskMove:Ke,onMultiTaskDelete:Dt,onTaskDuplicate:ca,onTaskCreate:yr,onTaskRename:Um,onCreateSubtask:Zn,onOpenTaskModal:k?F=>k(F):void 0,onDeleteRequest:(F,I)=>Ht({taskId:F,taskName:I}),onTaskReparent:Wt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:P.border,zIndex:15},onMouseDown:Zm}),jsxRuntime.jsx("div",{ref:xa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ln,{tasks:it,theme:P,rowHeight:ne,timeScale:pe,startDate:_m,endDate:Vm,zoom:Ee,templates:J,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:Wm,onTaskDateChange:Hm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Me.task&&jsxRuntime.jsx(yo,{isOpen:Me.isOpen,x:Me.x,y:Me.y,theme:P,onClose:()=>Lt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Me.task;if(!F)return [];let I=he.findTaskById(ae,F.id)||F;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:zt.Add,onClick:()=>{$?$(I):Zn(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:zt.Delete,onClick:()=>{Ht({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:zt.Pencil,onClick:()=>{z?z(I):ct(I);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:zt.Add,onClick:()=>{$?$(I):Zn(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:zt.MarkIncomplete,onClick:()=>{K?K(I):It(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:zt.SetInProgress,onClick:()=>{Y?Y(I):It(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:zt.MarkComplete,onClick:()=>{It(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:zt.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let oe=I.startDate.getTime(),fe=I.endDate.getTime(),Te=oe+(fe-oe)/2,kt=new Date(Te);Gm(I,kt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:zt.Delete,onClick:()=>{Ht({taskId:I.id,taskName:I.name});}}]})()}),jsxRuntime.jsx(Gr,{task:At,isOpen:!!At,onClose:()=>ct(null),onTaskUpdate:F=>{At&&(It(At.id,F),ct(null));},theme:R==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&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:()=>Ht(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:P.bgSecondary,border:`1px solid ${P.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${P.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:P.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="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:P.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:P.textPrimary},children:['"',Xe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:P.bgPrimary,borderTop:`1px solid ${P.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ht(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=P.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Dt([Xe.taskId]),Ht(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(In,{tasks:ae,theme:P,config:C,onTasksUpdate:re,onTaskUpdate:It,onTaskCreate:F=>{re(I=>[...I,F]);},onTaskDelete:F=>{Dt([F]);},onDependencyCreate:(F,I)=>{let V=he.findTaskById(ae,F);V&&yl(V,I);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{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 Tc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:p="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:C}){let T=[...ki,...i.filter(O=>!ki.some(te=>te.id===O.id))],c=Je[p]||Je.dark,[b,v]=react.useState(false),[l,x]=react.useState(false),[y,D]=react.useState(false),[k,w]=react.useState(false),[B,M]=react.useState({top:0,left:0}),[S,z]=react.useState(null),[$,K]=react.useState(new Date),[Y,ye]=react.useState({top:0,left:0}),[Oe,nt]=react.useState(false),[_e,Ae]=react.useState([]),Q=react.useRef(null),L=react.useRef(null),N=react.useRef(null),W=react.useRef(null),U=react.useRef(null),[R,se]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[pe,Ne]=react.useState({});react.useEffect(()=>{a?(se({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)&&nt(true)):(se({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),nt(false),Ae([]));},[a,e]),react.useEffect(()=>{let O=te=>{Q.current&&!Q.current.contains(te.target)&&v(false),L.current&&!L.current.contains(te.target)&&x(false),N.current&&!N.current.contains(te.target)&&D(false),W.current&&!W.current.contains(te.target)&&w(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let ie=()=>{let O={};return R.name.trim()||(O.name="El nombre es requerido"),R.startDate&&R.endDate&&R.startDate>R.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Ne(O),Object.keys(O).length===0},Le=async O=>{if(O.preventDefault(),!!ie())try{let te=m==="create"&&_e.length>0?{...R,pendingFiles:_e}:R;await s(te),Ae([]),t();}catch(te){console.error("Error submitting task:",te);}},Ee=(O,te)=>{se(le=>{let Ce={...le,[O]:te};if(O==="status"){let $e=te;$e==="todo"?Ce.progress=0:$e==="in-progress"?(le.progress===0||le.progress===100)&&(Ce.progress=50):$e==="completed"||$e==="closed"?Ce.progress=100:($e==="in-review"||$e==="review")&&(Ce.progress=75);}if(O==="progress"){let $e=typeof te=="number"?te:parseInt(te,10);$e===100&&le.status!=="completed"?Ce.status="completed":$e>0&&$e<100&&le.status==="todo"?Ce.status="in-progress":$e===0&&le.status!=="todo"&&(Ce.status="todo");}return Ce}),pe[O]&&Ne(le=>{let Ce={...le};return delete Ce[O],Ce});},De=T.find(O=>O.id===R.status)??ki[0],He=wi.find(O=>O.id===R.priority)??wi[1],ht=sr.find(O=>O.value===R.color)??sr[0],et={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.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":p,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.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||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=c.hoverBg,O.currentTarget.style.color=c.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Le,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:R.name,onChange:O=>Ee("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:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:R.description||"",onChange:O=>Ee("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:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...et,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:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:T.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:c.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ee("status",O.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,R.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:L,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:He.color}}),jsxRuntime.jsx("span",{children:He.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.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:c.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ee("priority",O.id),x(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,R.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:N,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:n,children:[R.assignees&&R.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:R.assignees.slice(0,3).map((O,te)=>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||c.accent,borderColor:c.bgSecondary},children:O.initials},te))}),R.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",R.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),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-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(O=>{let te=R.assignees?.some(le=>le.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:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=te?(R.assignees||[]).filter(Ce=>Ce.name!==O.name):[...R.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:c.accent}];Ee("assignees",le);},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:c.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:te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)w(false);else {if(W.current){let O=W.current.getBoundingClientRect(),te=window.innerHeight,le=120,$e=te-O.bottom<le?O.top-le-8:O.bottom+8;M({top:$e,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:et,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:R.color}}),jsxRuntime.jsx("span",{children:ht.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(gt,{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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.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:sr.slice(0,18).map(O=>{let te=R.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),Ee("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:te?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(nr,{selectedTags:R.tags||[],availableTags:u,onChange:O=>Ee("tags",O),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:U,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!R.isMilestone)if(S==="start")z(null);else {if(U.current){let O=U.current.getBoundingClientRect(),te=window.innerHeight,le=320,$e=te-O.bottom<le?O.top-le-8:O.bottom+8;ye({top:$e,left:O.left});}z("start"),K(R.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...et,opacity:R.isMilestone?.5:1,cursor:R.isMilestone?"not-allowed":"pointer"},disabled:n||R.isMilestone,children:R.startDate?R.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!R.isMilestone)if(S==="end")z(null);else {if(U.current){let O=U.current.getBoundingClientRect(),te=window.innerHeight,le=320,$e=te-O.bottom<le?O.top-le-8:O.bottom+8;ye({top:$e,left:O.left});}z("end"),K(R.endDate||R.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...et,opacity:R.isMilestone?.5:1,cursor:R.isMilestone?"not-allowed":"pointer"},disabled:n||R.isMilestone,children:R.endDate?R.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(gt,{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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let O=new Date,te=new Date(O);te.setDate(O.getDate()+1);let le=new Date(O);le.setDate(O.getDate()+7);let Ce=new Date(O);return Ce.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:te},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:Ce}].map((tt,xt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Me=>Me.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Me=>Me.currentTarget.style.backgroundColor="transparent",onClick:()=>{S==="start"?(Ee("startDate",tt.date),(!R.endDate||tt.date>R.endDate)&&Ee("endDate",tt.date),z("end")):(Ee("endDate",tt.date),(!R.startDate||tt.date<R.startDate)&&Ee("startDate",tt.date),z(null));},children:tt.label},xt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.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=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ee("startDate",void 0),Ee("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:()=>K(new Date($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,te)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:O},te))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=$.getFullYear(),te=$.getMonth(),le=new Date(O,te,1).getDay(),Ce=new Date(O,te+1,0).getDate(),$e=new Date,tt=[];for(let Me=le-1;Me>=0;Me--)tt.push({day:new Date(O,te,-Me).getDate(),date:new Date(O,te-1,new Date(O,te,-Me).getDate()),isCurrentMonth:false});for(let Me=1;Me<=Ce;Me++)tt.push({day:Me,date:new Date(O,te,Me),isCurrentMonth:true});let xt=42-tt.length;for(let Me=1;Me<=xt;Me++)tt.push({day:Me,date:new Date(O,te+1,Me),isCurrentMonth:false});return tt.map((Me,Lt)=>{let At=Me.date.toDateString()===$e.toDateString(),ct=R.startDate?.toDateString()===Me.date.toDateString(),Xe=R.endDate?.toDateString()===Me.date.toDateString(),Ht=R.startDate&&R.endDate&&Me.date>=R.startDate&&Me.date<=R.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:Me.isCurrentMonth?ct||Xe?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:ct?"#3B82F6":Xe?"#7C3AED":Ht?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:At&&!ct&&!Xe?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{S==="start"?(Ee("startDate",Me.date),R.endDate&&Me.date>R.endDate&&Ee("endDate",Me.date),z("end")):(Ee("endDate",Me.date),R.startDate&&Me.date<R.startDate&&Ee("startDate",Me.date),z(null));},children:Me.day},Lt)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:c.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:R.progress,onChange:O=>Ee("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:R.progress<30?"#EF4444":R.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:`${R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"}20`,color:R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"},children:[R.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>nt(!Oe),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Oe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Oe&&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:[(f||g.length>0||m==="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:c.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:c.textTertiary},children:["Adjuntos ",m==="create"?_e.length>0&&`(${_e.length})`:g.length>0&&`(${g.length})`]})]}),m==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:_e.map((O,te)=>({id:`pending-${te}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>Ae(te=>[...te,...O]),onDelete:O=>{let te=parseInt(O.replace("pending-",""),10);Ae(le=>le.filter((Ce,$e)=>$e!==te));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?O=>f(a.id,O):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),m==="create"&&_e.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[_e.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:R.isMilestone,onChange:O=>Ee("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let te=R.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let le=te?(R.dependencies||[]).filter(Ce=>Ce!==O.id):[...R.dependencies||[],O.id];Ee("dependencies",le);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:te?`${c.accent}30`:c.bgPrimary,color:te?c.accent:c.textSecondary,border:`1px solid ${te?c.accent:c.borderLight}`},disabled:n,children:O.name},O.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.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:c.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:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Nc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
345
345
|
|
|
346
346
|
AVAILABLE COMMANDS:
|
|
347
347
|
1. move_task - Move a task to a different date
|
|
@@ -386,7 +386,7 @@ If ambiguous, ask for clarification in the message field.`;function Dc(e){return
|
|
|
386
386
|
${Sc(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(`
|
|
387
387
|
`)}
|
|
388
388
|
|
|
389
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Sc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=Sc(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(m=>{let p=m.name.toLowerCase();return n.every(i=>p.includes(i))})}function Ci(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 T=new Date(r),N=T.getDay(),c=f-N;return c<=0&&(c+=7),T.setDate(T.getDate()+c),T}}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(),T=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?T.setDate(T.getDate()+g):f==="week"||f==="semana"||f==="semanas"?T.setDate(T.getDate()+g*7):(f==="month"||f==="mes"||f==="meses")&&T.setMonth(T.getMonth()+g),T}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let g=parseInt(m[1],10),f=parseInt(m[2],10)-1,T=parseInt(m[3],10);return new Date(T,f,g)}let p={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=p[i[2].toLowerCase()],T=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(T,f,g)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 g=u[d[1].toLowerCase()],f=parseInt(d[2],10),T=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(T,g,f)}return null}function Ti(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 Ni(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 Ec(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 Pc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),d=br(t,i),g=Ci(u);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(!g)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,T=new Date(g);return T.setDate(T.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:T},message:`Moved "${d.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(),u=o[2].trim(),d=br(t,i),g=Ti(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.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(),u=s[2].trim(),d=br(t,i),g=Ni(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.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(),u=n[2].trim(),d=br(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),u=m[2].trim(),d=br(t,i),g=br(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let i=p[1].trim(),u=br(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Mc(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 z0(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 U0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Rn(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Rn(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},m=n(e.startDate),p=n(e.endDate),i=e.metadata?.isMilestone===true||m&&p&&Math.abs(p.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:p,progress:e.progress||0,status:z0(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 Ac(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:U0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Fc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Rn(r,e,t))}var Di={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},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"}},Si={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},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"}},$n={en:Di,es:Si};function Ei(e){return $n[e]||$n.en}function On(e,t){let a=Ei(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}function Rc(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(...Rc(r.subtasks,t+1));return a}function J0({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function $c({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:m="dark",locale:p="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=On(p,i),f=m==="dark",[T,N]=react.useState(new Set),[c,b]=react.useState("startDate"),[v,l]=react.useState("asc"),[k,y]=react.useState("");react.useMemo(()=>{let M=new Set;function S(U){for(let $ of U)$.subtasks?.length&&(M.add($.id),S($.subtasks));}S(e),N(M);},[e]);let D=react.useCallback(M=>{N(S=>{let U=new Set(S);return U.has(M)?U.delete(M):U.add(M),U}),a.onTaskToggleExpand?.(M);},[a]),x=react.useCallback(M=>{c===M?l(S=>S==="asc"?"desc":"asc"):(b(M),l("asc")),a.onSortChange?.({column:M,direction:v==="asc"?"desc":"asc"});},[c,v,a]),w=react.useMemo(()=>{let M=Rc(e);if(k.trim()){let U=k.toLowerCase();M=M.filter($=>$.name.toLowerCase().includes(U));}let S=[];for(let U of M){let $=U.level===0;U.level>0&&($=true),($||k.trim())&&S.push(U);}return k.trim()&&S.sort((U,$)=>{let j,K;switch(c){case "name":j=U.name.toLowerCase(),K=$.name.toLowerCase();break;case "startDate":j=U.startDate?.getTime()||0,K=$.startDate?.getTime()||0;break;case "endDate":j=U.endDate?.getTime()||0,K=$.endDate?.getTime()||0;break;case "progress":j=U.progress||0,K=$.progress||0;break;case "status":j=U.status||"todo",K=$.status||"todo";break;default:return 0}return j<K?v==="asc"?-1:1:j>K?v==="asc"?1:-1:0}),S},[e,k,c,v]),B=M=>M?(M instanceof Date?M:new Date(M)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",f?"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:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",f?"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:h("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",f?"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:h("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:h("flex-1 flex flex-col w-full h-full overflow-hidden",f?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:h("flex-shrink-0 px-6 py-4 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:h("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:M=>y(M.target.value),placeholder:g.toolbar.searchPlaceholder,className:h("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",f?"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.jsxs("div",{className:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:h("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",f?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>x("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((M,S)=>{let U=T.has(M.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:S*.02},className:h("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",f?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+M.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:$=>{$.stopPropagation(),D(M.id);},className:h("p-0.5 rounded",f?"hover:bg-white/10":"hover:bg-gray-200"),children:U?jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:h("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")})}),d&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:$=>{$.stopPropagation(),a.onTaskUpdate?.({...M,progress:M.progress===100?0:100,status:M.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(J0,{status:M.status,progress:M.progress})}),jsxRuntime.jsx("span",{className:h("truncate",f?"text-white":"text-gray-900",M.progress===100&&(f?"line-through text-[#6B7280]":"line-through text-gray-400")),children:M.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:h("px-2 py-1 rounded-full text-xs font-medium",M.progress===100||M.status==="completed"?"bg-green-500/10 text-green-500":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/10 text-blue-500":f?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:M.progress===100||M.status==="completed"?g.status.completed:M.progress&&M.progress>0||M.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:h("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(M.startDate)]}),jsxRuntime.jsxs("div",{className:h("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),B(M.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:h("flex-1 h-1.5 rounded-full overflow-hidden",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${M.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-xs w-8",f?"text-[#9CA3AF]":"text-gray-500"),children:[M.progress||0,"%"]})]})})]},M.id)})}),w.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:h("w-12 h-12 mx-auto mb-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h(f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Pi={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"},Mi={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"},Ai={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"},Un={dark:Pi,light:Mi,neutral:Ai};function Oc(e){return Un[e]||Un.dark}var Fi={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"}},Li={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"}},Hn={en:Fi,es:Li};function Ho(e){return Hn[e]||Hn.en}function Wn(e,t){let a=Ho(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 zc(e){let t=Ho(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 Uc(e,t=0,a=true){let r=Ho(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 hh(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 zi(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 Vc({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 Kc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:m,availableTags:p=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:f,onTaskOpen:T}){let{theme:N="dark",locale:c="en",customTranslations:b}=t,v=Wn(c,b),l=N==="dark",k={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[y,D]=react.useState(r||new Date),[x,w]=react.useState(null),[B,M]=react.useState(null),[S,U]=react.useState(null),[$,j]=react.useState(new Date),[K,be]=react.useState({}),ze=4,st=3,[Ve,Ae]=react.useState(false),[Z,L]=react.useState(false),[C,W]=react.useState(false),[O,R]=react.useState(false),[ne,ce]=react.useState(null),[De,le]=react.useState(""),[Be,Se]=react.useState(void 0),[Fe,xe]=react.useState(null),[We,je]=react.useState(false),[z,re]=react.useState(false),[se,Ce]=react.useState(null),[Oe,at]=react.useState(false),[kt,Le]=react.useState(new Date),[It,Mt]=react.useState(false),[Dt,Qe]=react.useState(false),[bt,ua]=react.useState(false),[te,ue]=react.useState(""),[yt,ie]=react.useState(false),[E,q]=react.useState(""),[ge,Me]=react.useState(false),Ge=react.useCallback(()=>{D(new Date(y.getFullYear(),y.getMonth()-1,1));},[y]),Xe=react.useCallback(()=>{D(new Date(y.getFullYear(),y.getMonth()+1,1));},[y]),Ue=react.useCallback(()=>{D(new Date);},[]),it=react.useMemo(()=>{let P=y.getFullYear(),ve=y.getMonth(),J=new Date(P,ve,1),Ie=new Date(P,ve+1,0),lt=J.getDay(),oe=Ie.getDate(),He=hh(e),St=new Date;St.setHours(0,0,0,0);let Re=[],Rt=lt,pt=new Date(P,ve,0).getDate();for(let Gt=Rt-1;Gt>=0;Gt--){let qe=new Date(P,ve-1,pt-Gt);Re.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:He.filter(Et=>zi(qe,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}for(let Gt=1;Gt<=oe;Gt++){let qe=new Date(P,ve,Gt),Et=qe.getTime()===St.getTime();Re.push({date:qe,isCurrentMonth:true,isToday:Et,isWeekend:qe.getDay()===0||qe.getDay()===6,events:He.filter(da=>zi(qe,da)).map(da=>({id:da.id,title:da.name,start:da.startDate,end:da.endDate,task:da}))});}let ha=42-Re.length;for(let Gt=1;Gt<=ha;Gt++){let qe=new Date(P,ve+1,Gt);Re.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:He.filter(Et=>zi(qe,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}return Re},[y,e]),mt=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=y.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ee=react.useCallback((P,ve)=>{if(!x)return;let J={...x,[P]:ve};w(J),a.onTaskUpdate?.(J);},[x,a]),Pe=react.useCallback(P=>{if(!x)return;let ve=x.progress||0;P==="completed"?ve=100:P==="todo"&&(ve=0);let J={...x,status:P,progress:ve};w(J),a.onTaskUpdate?.(J),Ae(false);},[x,a]),Je=react.useCallback((P,ve)=>{if(!x)return;let J={...x,startDate:P,endDate:ve};w(J),a.onTaskUpdate?.(J);},[x,a]),_e=react.useCallback(()=>{Ae(false),L(false),W(false),U(null),ua(false),ue(""),ie(false);},[]),G=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),Mt(false),!x||!a.onUploadAttachments)return;let ve=Array.from(P.dataTransfer.files);if(ve.length!==0){Qe(true);try{await a.onUploadAttachments(x.id,ve);}finally{Qe(false);}}},[x,a]),de=react.useCallback(async P=>{if(!x||!a.onUploadAttachments||!P.target.files)return;let ve=Array.from(P.target.files);if(ve.length!==0){Qe(true);try{await a.onUploadAttachments(x.id,ve);}finally{Qe(false);}P.target.value="";}},[x,a]),$e=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),Mt(true);},[]),Ft=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),Mt(false);},[]),rt=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),xa=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]),fa=react.useMemo(()=>!x||!u?[]:u.get(x.id)||[],[x,u]);return o?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,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:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[v.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,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:h("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,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:h("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:v.labels.noEvents}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:v.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:h("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:m,children:[jsxRuntime.jsx("div",{className:h("flex-shrink-0 px-6 py-4 border-b",l?"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:h("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:_}),jsxRuntime.jsx("button",{onClick:Ue,className:h("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:v.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ge,className:h("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:h("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Xe,className:h("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:h("w-5 h-5",l?"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:mt.map(P=>jsxRuntime.jsx("div",{className:h("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:P},P))}),jsxRuntime.jsx("div",{className:h("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:it.map((P,ve)=>{let J=P.date.getDay()===0||P.date.getDay()===6;return jsxRuntime.jsxs("div",{className:h("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?J?"bg-[#1C1F26]":P.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":J?"bg-gray-100":P.isCurrentMonth?"bg-white":"bg-gray-50",P.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ie=K[ve]||ze,lt=P.events.slice(0,Ie),oe=P.events.length-Ie;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[lt.map(He=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{w(He.task),a.onEventClick?.(He),T?.(He.task.id);},whileHover:{scale:1.02},className:h("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",He.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Vc,{task:He.task}),jsxRuntime.jsx("span",{className:"truncate",children:He.title})]})},He.id)),oe>0&&jsxRuntime.jsxs("button",{onClick:He=>{He.stopPropagation(),be(St=>({...St,[ve]:Ie+st}));},className:h("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",oe," ",c==="es"?"M\xC1S":"MORE"]}),Ie>ze&&P.events.length>ze&&jsxRuntime.jsx("button",{onClick:He=>{He.stopPropagation(),be(St=>({...St,[ve]:ze}));},className:h("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:c==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ie=ve>=28,lt=ve%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),ne===ve?ce(null):(ce(ve),le(""),Se(void 0),xe(null),Ce(null),je(false),re(false),at(false),Le(P.date));},className:h("w-5 h-5 rounded flex items-center justify-center transition-all",ne===ve?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:h("w-3.5 h-3.5 transition-transform",ne===ve&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne===ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ce(null),le(""),Se(void 0),xe(null),Ce(null),je(false),re(false),at(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ie?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ie?-5:5,scale:.95},transition:{duration:.12},className:h("absolute w-[320px] rounded-lg shadow-2xl z-50",Ie?"bottom-full mb-1":"top-full mt-1",lt?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>{oe.stopPropagation(),je(false),re(false),at(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:De,onChange:oe=>le(oe.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:h("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:oe=>{if(oe.key==="Enter"&&De.trim()){let He=t.availableUsers?.find(Re=>Re.id===Fe),St=se||P.date;a.onTaskCreate?.({name:De.trim(),startDate:St,endDate:St,priority:Be,assignees:He?[He]:void 0}),le(""),Se(void 0),xe(null),Ce(null),ce(null);}oe.key==="Escape"&&(ce(null),le(""),Se(void 0),xe(null),Ce(null));}})}),jsxRuntime.jsxs("div",{className:h("px-2.5 py-2 flex items-center justify-between border-t",l?"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(),je(!We),re(false);},className:h("p-1 rounded transition-colors",Be?Be==="urgent"||Be==="high"?"text-red-400 bg-red-500/20":Be==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"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:We&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(oe=>jsxRuntime.jsxs("button",{onClick:()=>{Se(oe.id),je(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Be===oe.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",oe.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:oe.label})]},oe.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:oe=>{oe.stopPropagation(),at(!Oe),je(false),re(false),Le(se||P.date);},className:h("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",se?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"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"}),(se||P.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Oe&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsx("div",{className:h("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let oe=new Date,He=new Date(oe);He.setDate(oe.getDate()+1);let St=new Date(oe);St.setDate(oe.getDate()+((6-oe.getDay()+7)%7||7));let Re=new Date(oe);Re.setDate(oe.getDate()+((1-oe.getDay()+7)%7||7));let Rt=new Date(oe);Rt.setDate(oe.getDate()+14);let pt=new Date(oe);return pt.setDate(oe.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:oe,display:oe.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:He,display:He.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:St,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Re,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:Rt,display:Rt.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:pt,display:pt.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Gt,qe)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Ce(Gt.date),at(false);},children:[jsxRuntime.jsx("span",{children:Gt.label}),jsxRuntime.jsx("span",{className:h("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:Gt.display})]},qe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:h("text-xs font-medium",l?"text-white":"text-gray-900"),children:kt.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Le(new Date),className:h("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Le(new Date(kt.getFullYear(),kt.getMonth()-1)),className:h("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Le(new Date(kt.getFullYear(),kt.getMonth()+1)),className:h("p-0.5 rounded",l?"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:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(oe=>jsxRuntime.jsx("div",{className:h("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:oe},oe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let oe=kt.getFullYear(),He=kt.getMonth(),St=new Date(oe,He,1).getDay(),Re=new Date(oe,He+1,0).getDate(),Rt=new Date(oe,He,0).getDate(),pt=new Date,ha=[];for(let qe=St-1;qe>=0;qe--)ha.push({dayNum:Rt-qe,isCurrentMonth:false,date:new Date(oe,He-1,Rt-qe)});for(let qe=1;qe<=Re;qe++)ha.push({dayNum:qe,isCurrentMonth:true,date:new Date(oe,He,qe)});let Gt=42-ha.length;for(let qe=1;qe<=Gt;qe++)ha.push({dayNum:qe,isCurrentMonth:false,date:new Date(oe,He+1,qe)});return ha.map((qe,Et)=>{let da=qe.date.toDateString()===pt.toDateString(),yr=(se||P.date).toDateString()===qe.date.toDateString();return jsxRuntime.jsx("button",{className:h("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!qe.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),qe.isCurrentMonth&&(l?"text-white":"text-gray-900"),da&&"ring-1 ring-[#3B82F6]",yr&&"bg-[#7C3AED] text-white",!yr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Ce(qe.date),at(false);},children:qe.dayNum},Et)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),re(!z),je(false);},className:h("p-1 rounded transition-colors",Fe?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Fe?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===Fe)?.color||"#7C3AED"},children:t.availableUsers?.find(oe=>oe.id===Fe)?.initials||t.availableUsers?.find(oe=>oe.id===Fe)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{xe(null),re(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!Fe&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(oe=>jsxRuntime.jsxs("button",{onClick:()=>{xe(oe.id),re(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Fe===oe.id&&(l?"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:l?"text-white":"text-gray-900",children:oe.name})]},oe.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:h("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(De.trim()){let oe=t.availableUsers?.find(St=>St.id===Fe),He=se||P.date;a.onTaskCreate?.({name:De.trim(),startDate:He,endDate:He,priority:Be,assignees:oe?[oe]:void 0}),le(""),Se(void 0),xe(null),Ce(null),ce(null);}},disabled:!De.trim(),className:h("px-2.5 py-1 rounded text-xs font-medium transition-colors",De.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:h("text-sm font-medium",P.isToday?"text-[#3B82F6]":P.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:P.date.getDate()})]})]},ve)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{w(null),q("");},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:h("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:h("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:h("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:h("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:h("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:x.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{w(null),q("");},className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=x.progress===100?0:100,J={...x,progress:P,status:P===100?"completed":"todo"};w(J),a.onTaskUpdate?.(J);},className:h("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",x.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:x.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:h("text-xl font-semibold flex-1",x.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:x.name})]})}),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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{_e(),Ae(!Ve);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",x.progress===100||x.status==="completed"?"bg-green-500/20 text-green-400":x.progress&&x.progress>0||x.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:x.progress===100||x.status==="completed"?c==="es"?"COMPLETADO":"DONE":x.progress&&x.progress>0||x.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&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:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>Pe(P.id),className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(x.status===P.id||P.id==="completed"&&x.progress===100||P.id==="in-progress"&&x.progress&&x.progress>0&&x.progress<100||P.id==="todo"&&(!x.progress||x.progress===0)&&x.status!=="in-progress"&&x.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",P.id==="completed"?"bg-green-500":P.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ae(false),L(false),U(null),W(!C);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[x.assignees&&x.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[x.assignees.slice(0,3).map((P,ve)=>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()},ve)),x.assignees.length>3&&jsxRuntime.jsxs("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",x.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:h("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(P=>{let ve=x.assignees?.some(J=>J.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let J=x.assignees||[],Ie;ve?Ie=J.filter(lt=>lt.name!==P.name):Ie=[...J,{name:P.name,avatar:P.avatar,initials:P.initials||P.name.slice(0,2).toUpperCase(),color:P.color||"#8B5CF6"}],ee("assignees",Ie);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[P.avatar?jsxRuntime.jsx("img",{src:P.avatar,alt:P.name,className:"w-6 h-6 rounded-full object-cover"}):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"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:h("flex-1 text-left",l?"text-white":"text-gray-900"),children:P.name}),ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.id||P.name)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{U(S?null:"start"),j(x.startDate||new Date);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[x.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:h("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),x.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(x.startDate||x.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:P=>{P.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>U(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:h("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:h("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ve=new Date(P);ve.setDate(P.getDate()+1);let J=new Date(P);J.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ie=new Date(P);Ie.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let lt=new Date(P);lt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let oe=new Date(P);oe.setDate(P.getDate()+14);let He=new Date(P);return He.setDate(P.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:ve,display:ve.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:J,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ie,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:lt,display:lt.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:oe,display:oe.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:He,display:He.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,Rt)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(S==="start"){let pt=x.endDate&&Re.date>x.endDate?Re.date:x.endDate;Je(Re.date,pt),U("end");}else {let pt=x.startDate&&Re.date<x.startDate?Re.date:x.startDate;Je(pt,Re.date),U(null);}},children:[jsxRuntime.jsx("span",{children:Re.label}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},Rt))})(),jsxRuntime.jsx("div",{className:h("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Je(void 0,void 0),U(null);},className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:c==="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:h("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:S==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="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:h("font-medium",l?"text-white":"text-gray-900"),children:$.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>j(new Date),className:h("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>j(new Date($.getFullYear(),$.getMonth()-1)),className:h("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>j(new Date($.getFullYear(),$.getMonth()+1)),className:h("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:h("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=$.getFullYear(),ve=$.getMonth(),J=new Date(P,ve,1).getDay(),Ie=new Date(P,ve+1,0).getDate(),lt=new Date(P,ve,0).getDate(),oe=new Date,He=[];for(let Re=J-1;Re>=0;Re--)He.push({day:lt-Re,isCurrentMonth:false,date:new Date(P,ve-1,lt-Re)});for(let Re=1;Re<=Ie;Re++)He.push({day:Re,isCurrentMonth:true,date:new Date(P,ve,Re)});let St=42-He.length;for(let Re=1;Re<=St;Re++)He.push({day:Re,isCurrentMonth:false,date:new Date(P,ve+1,Re)});return He.map((Re,Rt)=>{let pt=Re.date.toDateString()===oe.toDateString(),ha=x.startDate?.toDateString()===Re.date.toDateString(),Gt=x.endDate?.toDateString()===Re.date.toDateString(),qe=ha||Gt,Et=x.startDate&&x.endDate&&Re.date>=x.startDate&&Re.date<=x.endDate;return jsxRuntime.jsx("button",{className:h("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Re.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Re.isCurrentMonth&&(l?"text-white":"text-gray-900"),pt&&"ring-2 ring-[#3B82F6]",ha&&"bg-[#3B82F6] text-white",Gt&&!ha&&"bg-[#7C3AED] text-white",Et&&!qe&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!qe&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let da=new Date(Re.date);if(S==="start"){let yr=x.endDate&&da>x.endDate?da:x.endDate;Je(da,yr),U("end");}else {let yr=x.startDate&&da<x.startDate?da:x.startDate;Je(yr,da),U(null);}},children:Re.day},Rt)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{_e(),L(!Z);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",x.priority==="high"||x.priority==="urgent"?"bg-red-500/20 text-red-400":x.priority==="medium"?"bg-yellow-500/20 text-yellow-400":x.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:x.priority?x.priority==="high"||x.priority==="urgent"?c==="es"?"Urgente":"Urgent":x.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{ee("priority",P.id),L(false);},className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",x.priority===P.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:l?"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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:x.startDate&&x.endDate?`${Math.ceil((x.endDate.getTime()-x.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[O?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:x.progress||0,onChange:P=>{let ve=parseInt(P.target.value),J=x.status;ve===100?J="completed":ve>0?J="in-progress":J="todo";let Ie={...x,progress:ve,status:J};w(Ie),a.onTaskUpdate?.(Ie);},onBlur:()=>R(false),className:h("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>R(true),className:h("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",x.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${x.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[x.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:x.tags||[],availableTags:p,onChange:P=>{ee("tags",P);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:h("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[x.dependencies&&x.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:x.dependencies.map(P=>{let ve=e.find(J=>J.id===P);return jsxRuntime.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ve?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let J=(x.dependencies||[]).filter(Ie=>Ie!==P);ee("dependencies",J);},className:h("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:()=>{_e(),ua(!bt);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ua(false),ue("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:h("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:te,onChange:P=>ue(P.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:h("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(P=>P.id!==x.id).filter(P=>te===""||P.name.toLowerCase().includes(te.toLowerCase())).map(P=>{let ve=x.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let J=x.dependencies||[],Ie;ve?Ie=J.filter(lt=>lt!==P.id):Ie=[...J,P.id],ee("dependencies",Ie);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ve?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:ve&&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:h("block truncate",l?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{_e(),ie(!yt);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:x.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:sr.find(P=>P.value===x.color)?.name||(c==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:yt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ie(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(P=>{let ve=x.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{ee("color",P.value),ie(false);},className:h("w-7 h-7 rounded-full flex items-center justify-center transition-all",ve&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ve?P.value:void 0},title:P.name,children:ve&&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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:x.isMilestone||false,onChange:P=>ee("isMilestone",P.target.checked),className:h("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",x.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:x.description||"",onChange:P=>ee("description",P.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:h("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),x.subtasks&&x.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:x.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:h("text-sm",P.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:h("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",fa.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",fa.length,")"]})]}),fa.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:fa.map(P=>{let ve=xa(P.type),J=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:h("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[J&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:h("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ve,{className:h("w-5 h-5",l?"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:h("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:rt(P.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(P.id),className:h("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:$e,onDragLeave:Ft,onDrop:G,className:h("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",It?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Dt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:de,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||Dt}),Dt?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:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:h("w-6 h-6 mx-auto mb-2",It?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:It?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="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"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:h("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:h("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:h("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(P=>{let ve=(()=>{let J=new Date,Ie=new Date(P.createdAt),lt=J.getTime()-Ie.getTime(),oe=Math.floor(lt/6e4),He=Math.floor(oe/60),St=Math.floor(He/24);return oe<1?c==="es"?"ahora":"now":oe<60?c==="es"?`hace ${oe}m`:`${oe}m ago`:He<24?c==="es"?`hace ${He}h`:`${He}h ago`:c==="es"?`hace ${St}d`:`${St}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#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:h("text-sm font-medium",l?"text-white":"text-gray-900"),children:P.user?.name||(c==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ve})]}),jsxRuntime.jsx("p",{className:h("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:P.content})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:h("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:h("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[f&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:f.color||"#8B5CF6"},children:f.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:h("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:E,onChange:P=>q(P.target.value),onKeyDown:async P=>{if(P.key==="Enter"&&!P.shiftKey&&x&&E.trim()&&g){P.preventDefault(),Me(true);try{await g(x.id,E.trim()),q("");}finally{Me(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:ge||!g,className:h("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(ge||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(x&&E.trim()&&g){Me(true);try{await g(x.id,E.trim()),q("");}finally{Me(false);}}},disabled:ge||!E.trim()||!g,className:h("p-1.5 rounded transition-colors",E.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",ge&&"opacity-50 cursor-not-allowed"),children:ge?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(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:h("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:h("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:h("font-medium",l?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>M(null),className:h("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:B.events.map(P=>jsxRuntime.jsxs("button",{onClick:()=>{M(null),w(P.task),T?.(P.task.id);},className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Vc,{task:P.task}),jsxRuntime.jsx("span",{className:h("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:P.title}),P.task.priority==="high"||P.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},P.id))})]})]})})]})}var Ui={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"},Hi={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"},Wi={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"},_n={dark:Ui,light:Hi,neutral:Wi};function Yc(e){return _n[e]||_n.dark}function yh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:m}){let[p,i]=react.useState(false),u=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=react.useMemo(()=>{let f=u.length,T=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,N=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:f,uniqueAssignees:T,priorities:N,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:h("card-stack",!e.isExpanded&&"card-stack-collapsed",m),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:h("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"]})]}),p&&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:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(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:T=>{T.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 Xc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function _o(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 Vo(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 Jc(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 Qc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:m}){let p=react.useMemo(()=>({...Xc,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(l=>{let k=l.timestamp.toISOString().split("T")[0],y=v.get(k);y?y.push(l):v.set(k,[l]);}),Array.from(v.entries()).sort((l,k)=>k[0].localeCompare(l[0])).map(([l,k])=>({date:new Date(l),events:k.sort((y,D)=>D.timestamp.getTime()-y.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:f,uniqueTypes:T}=react.useMemo(()=>{let v=new Set,l=new Set;return e.forEach(k=>{v.add(k.userId),l.add(k.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(l)}},[e]),N=v=>{u(l=>{let k=new Set(l);return k.has(v)?k.delete(v):k.add(v),k});},c=v=>{let k=new Date().getTime()-v.getTime(),y=Math.floor(k/6e4),D=Math.floor(k/36e5),x=Math.floor(k/864e5);return y<1?"just now":y<60?`${y}m ago`:D<24?`${D}h ago`:x<7?`${x}d ago`:v.toLocaleDateString()},b=react.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return react.useEffect(()=>{if(s&&d.current){let v=d.current.querySelector(`[data-event-id="${s}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:h("history-timeline-empty",m),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:h("history-timeline",p.compact&&"compact",m),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:v=>{let l=v.target.value;a({...t,types:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),T.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Vo(v)," ",v.replace("_"," ")]},v))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let l=v.target.value;a({...t,users:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>a({...t,searchTerm:v.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((l,k)=>{let y=i.has(l.id),D=s===l.id,x=Jc(l.type);return jsxRuntime.jsxs("div",{"data-event-id":l.id,className:h("history-timeline-event",y&&"expanded",D&&"selected"),onClick:()=>o?.(l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:x},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Vo(l.type)})}),k<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:x}})]}),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:[p.showAvatars&&l.userAvatar&&jsxRuntime.jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:_o(l)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),N(l.id);},children:[y?"\u25BC":"\u25B6"," Show changes"]}),y&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([w,B])=>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(B.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},w)),l.metadata&&Object.keys(l.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(l.metadata).map(([w,B])=>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(B)})]},w))]})]})]})]},l.id)})})]},v.date?.toISOString()||"all"))})]})}function em({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:m,onSpeedChange:p,className:i}){let u=[.5,1,1.5,2,3],d=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:h("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:h("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Vo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&_o(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=>m(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,T)=>jsxRuntime.jsx("div",{className:h("history-replay-progress-marker",T===e.currentIndex&&"active"),style:{left:`${T/(e.totalEvents-1)*100}%`},onClick:()=>m(T),title:_o(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:u.map(f=>jsxRuntime.jsxs("button",{className:h("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>p(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:h("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 Gi(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 _i(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 tm(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 am(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Th(e,t,a,r,o,s=100){let n=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(n.map(p=>[p.id,p]));for(let p=0;p<s;p++){let i=1-p/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(f=>{if(u.id===f.id)return;let T=u.x-f.x,N=u.y-f.y,c=Math.sqrt(T*T+N*N)||1,b=o.chargeStrength*i/(c*c);u.vx+=T/c*b,u.vy+=N/c*b;});}),t.forEach(u=>{let d=m.get(typeof u.source=="string"?u.source:u.source.id),g=m.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let f=g.x-d.x,T=g.y-d.y,N=Math.sqrt(f*f+T*T)||1,c=(N-o.linkDistance)/N*o.forceStrength*i;d.vx+=f*c,d.vy+=T*c,g.vx-=f*c,g.vy-=T*c;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function rm({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:m,className:p}){let i=react.useRef(null),[u,d]=react.useState([]),[g,f]=react.useState(null),[T,N]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(1),[k,y]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=Th(e,t,a.width,a.height,a,150);d($);},[e,t,a]);let D=react.useCallback(($,j)=>{a.enableDragging&&(j.stopPropagation(),f($));},[a.enableDragging]),x=react.useCallback($=>{if(!g||!i.current)return;let K=i.current.getBoundingClientRect(),be=($.clientX-K.left-k.x)/v,ze=($.clientY-K.top-k.y)/v;d(st=>st.map(Ve=>Ve.id===g?{...Ve,x:be,y:ze,fx:be,fy:ze}:Ve));},[g,v,k]),w=react.useCallback(()=>{f(null);},[]),B=react.useCallback(($,j)=>{j.stopPropagation(),m?.({type:"node-click",node:$,position:{x:j.clientX,y:j.clientY}});},[m]),M=react.useCallback(($,j)=>{j.stopPropagation(),m?.({type:"edge-click",edge:$,position:{x:j.clientX,y:j.clientY}});},[m]),S=react.useCallback($=>{let j=u.find(K=>K.id===$);return j?{x:j.x,y:j.y}:{x:0,y:0}},[u]),U=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=$.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:h("relationships-graph-empty",p),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:h("relationships-graph",p),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:()=>l($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),y({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Gi($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[tm($)," ",_i($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:x,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let j=S(typeof $.source=="string"?$.source:$.source.id),K=S(typeof $.target=="string"?$.target:$.target.id),be=am($.type),ze=c===$.id,st=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:h("relationships-graph-edge",ze&&"hovered",st&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:Ve=>M($,Ve),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:K.x,y2:K.y,stroke:Gi($.type),strokeWidth:st?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ze?1:.6,markerEnd:be?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ze&&jsxRuntime.jsx("text",{x:(j.x+K.x)/2,y:(j.y+K.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_i($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map($=>{let j=T===$.id,K=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:h("relationships-graph-node",j&&"hovered",K&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:be=>D($.id,be),onMouseEnter:()=>N($.id),onMouseLeave:()=>N(null),onClick:be=>B($,be),children:[jsxRuntime.jsx("circle",{r:K?a.nodeSize*1.2:a.nodeSize,fill:U($),stroke:K?"#fbbf24":"#ffffff",strokeWidth:K?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function sm({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[m,p]=react.useState(false),[i,u]=react.useState(null),[d,g]=react.useState(null),f=react.useRef(null),T=m||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let v=l=>{l.key==="Escape"&&!T&&N();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,T]);let N=()=>{T||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||T)){p(true),u(null),g(null);try{let v=await r(s.trim());g(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{p(false);}}},b=()=>{d&&(a(d),N());};return e?jsxRuntime.jsxs(gt,{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-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:v=>v.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:N,disabled:T,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((v,l)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},l))})]}),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((v,l)=>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:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},l)),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:v=>n(v.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:T}),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((v,l)=>jsxRuntime.jsx("button",{onClick:()=>n(v),disabled:T,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:v},l))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&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:T,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:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:c,disabled:!s.trim()||T,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:T?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vi={"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 Dh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Sh={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 Eh(e,t,a){let r=Vi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function jo(e){return `$${e.toFixed(4)}`}var ji=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Eh(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,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),m=a.filter(d=>d.success),p=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?p/r:0,successRate:r>0?m.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 m=this.operations.filter(u=>u.timestamp>=n).length,p=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:p,percentUsed:i,isExceeded:m>=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)}},Qr=new ji;function dm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qr.getStats()),[s,n]=react.useState(Qr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Qr.getStats()),n(Qr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let m=Qr.getRecentOperations(5);return jsxRuntime.jsxs(gt,{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:p=>p.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:jo(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(([p,i])=>{let u=r.costsByFeature[p]||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:p.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:jo(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:jo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 pm({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,m]=react.useState(""),[p,i]=react.useState(""),[u,d]=react.useState(""),[g,f]=react.useState(false),[T,N]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(null),k=react.useRef(null),y=g||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let M=S=>{S.key==="Escape"&&!y&&D();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,y]);let D=()=>{y||(m(""),i(""),d(""),N(null),b(null),l(null),t());},x=async()=>{if(!(!n.trim()||y)){f(true),N(null),b(null),l(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:u||void 0});b(M.tasks.tasks),l({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){N(M instanceof Error?M.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{c&&(a(c),D());};if(!e)return null;let B=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:D,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:c?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:[v?.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"}),v?.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 (",B,"% 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:[v?.tokens_used||0," tokens"]}),v?.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:[v.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:[c.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((M,S)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",S+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:M.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:k,value:n,onChange:M=>m(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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:p,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:y})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:y})]})]}),T&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:T}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((M,S)=>jsxRuntime.jsx("button",{onClick:()=>m(M),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},S))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),c?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:x,disabled:!n.trim()||y,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:y?"Generating...":"Generate Tasks"})]})]})]})})]})}function Kn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(c=>{t&&tn(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,v,l)=>{console.warn(`Retry attempt ${v} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(c,b,v)=>{r(l=>{let k=l.cards.find(M=>M.id===c);if(!k)return l;let y=k.columnId,D={...k,columnId:b,position:v},x=l.cards.map(M=>M.id===c?D:M),w=l.columns.map(M=>{if(M.id===y)return {...M,cardIds:M.cardIds.filter(S=>S!==c)};if(M.id===b){let S=x.filter(U=>U.columnId===b).sort((U,$)=>U.position-$.position);return {...M,cardIds:S.map(U=>U.id)}}return M}),B={...l,cards:x,columns:w};return o(B),B});},[o]),n=react.useCallback(async(c,b)=>{r(v=>{let l=v.cards.map(y=>y.id===c?{...y,...b}:y),k={...v,cards:l};return o(k),k});},[o]),m=react.useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let l={...c,id:b},k=v.columns.map(D=>D.id===c.columnId?{...D,cardIds:[...D.cardIds,b]}:D),y={...v,cards:[...v.cards,l],columns:k};return o(y),y});},[o]),p=react.useCallback(async c=>{r(b=>{let v=b.cards.find(D=>D.id===c);if(!v)return b;let l=b.cards.filter(D=>D.id!==c),k=b.columns.map(D=>D.id===v.columnId?{...D,cardIds:D.cardIds.filter(x=>x!==c)}:D),y={...b,cards:l,columns:k};return o(y),y});},[o]),i=react.useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let l={...c,id:b,cardIds:[]},k={...v,columns:[...v.columns,l]};return o(k),k});},[o]),u=react.useCallback(async(c,b)=>{r(v=>{let l=v.columns.map(y=>y.id===c?{...y,...b}:y),k={...v,columns:l};return o(k),k});},[o]),d=react.useCallback(async c=>{r(b=>{let v=b.cards.filter(y=>y.columnId!==c),l=b.columns.filter(y=>y.id!==c),k={...b,cards:v,columns:l};return o(k),k});},[o]),g=react.useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(c),b},[m]),f=react.useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),T=react.useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:m,onCardDelete:p,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:f,deleteCard:p,deleteColumn:d,clearBoard:T}}}function gm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Kn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(p,i,u={})=>{s.addCard({title:i,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...u});},addColumn:(p,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Ko={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},hm={by:"none",order:"asc"};function bm({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Ko,...e}),[s,n]=react.useState({...hm,...t}),m=react.useCallback(N=>{o(c=>({...c,...N}));},[]),p=react.useCallback(N=>{n(c=>({...c,...N}));},[]),i=react.useCallback(()=>{o(Ko),n(hm);},[]),u=react.useCallback(()=>{a&&o({...Ko,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Ko,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Ko,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]),T=react.useCallback(N=>{let c=[...N];if(r.search){let b=r.search.toLowerCase();c=c.filter(v=>v.title.toLowerCase().includes(b)||v.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,v=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),k=String(b.getDate()).padStart(2,"0"),y=`${v}-${l}-${k}`;c=c.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let x=D.endDate||D.dueDate;if(!x)return false;let w;if(typeof x=="string")w=x.split("T")[0]||x;else {let B=x.getUTCFullYear(),M=String(x.getUTCMonth()+1).padStart(2,"0"),S=String(x.getUTCDate()).padStart(2,"0");w=`${B}-${M}-${S}`;}switch(r.dateFilter){case "overdue":return w<y;case "today":return w===y;case "this-week":let B=new Date(y+"T00:00:00"),M=new Date(w+"T00:00:00"),S=new Date(B);return S.setDate(S.getDate()+7),M>=B&&M<=S;case "custom":if(r.dateRange){let U=typeof x=="string"?new Date(x):x;return U>=r.dateRange.start&&U<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(v=>r.labels.includes(v)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,v)=>{let l=0;switch(s.by){case "created":let k=b.createdAt?new Date(b.createdAt).getTime():0,y=v.createdAt?new Date(v.createdAt).getTime():0;l=k-y;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=D[b.priority||"LOW"],w=D[v.priority||"LOW"];l=x-w;break;case "dueDate":let B=b.endDate||b.dueDate,M=v.endDate||v.dueDate;if(!B)return 1;if(!M)return -1;let S=typeof B=="string"?new Date(B).getTime():B.getTime(),U=typeof M=="string"?new Date(M).getTime():M.getTime();l=S-U;break;case "title":l=b.title.localeCompare(v.title);break;case "estimate":let $=b.estimatedTime||0,j=v.estimatedTime||0;l=$-j;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:p,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:T,hasActiveFilters:f}}var vm,xm;if(typeof window<"u")try{let e=Qo("ai");vm=e.generateObject,xm=e.generateText;}catch{}function km(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(vm&&xm&&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(g){let f=g instanceof Error?g:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),m=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(g){let f=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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 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(g){let f=g instanceof Error?g:new Error("Failed to generate subtasks");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("Estimating effort for:",d.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:m,onPredictRisks:p,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Yi(){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 wm(e){let{cards:t}=e,[a,r]=Yi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=g.ctrlKey||g.metaKey,T=g.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(N=>N!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(T&&a.lastSelectedCardId){let N=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(N&&c&&N.columnId===c.columnId){let b=t.filter(w=>w.columnId===N.columnId).sort((w,B)=>w.position-B.position),v=b.findIndex(w=>w.id===a.lastSelectedCardId),l=b.findIndex(w=>w.id===d),[k,y]=v<l?[v,l]:[l,v],D=b.slice(k,y+1).map(w=>w.id),x=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:x,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(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=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]),u=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:m,selectAll:p,toggleCard:i,getSelectedCards:u}}var Cm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Tm(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Cm,...a}),[a]),[s,n]=react.useState([]),m=react.useCallback((N,c,b,v,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:N,cardIds:c,columnId:b,strategy:v,color:l,isExpanded:true,position:s.filter(y=>y.columnId===b).length,createdAt:new Date};n(y=>[...y,k]);},[o.minCardsPerStack,s]),p=react.useCallback(N=>{n(c=>c.filter(b=>b.id!==N));},[]),i=react.useCallback(N=>{n(c=>c.map(b=>b.id===N?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((N,c)=>{n(b=>b.map(v=>v.id===N&&!v.cardIds.includes(c)?{...v,cardIds:[...v.cardIds,c]}:v));},[]),d=react.useCallback((N,c)=>{n(b=>b.map(v=>{if(v.id===N){let l=v.cardIds.filter(k=>k!==c);return l.length<o.minCardsPerStack?null:{...v,cardIds:l}}return v}).filter(v=>v!==null));},[o.minCardsPerStack]),g=react.useCallback(N=>s.filter(c=>c.columnId===N).sort((c,b)=>c.position-b.position),[s]),f=react.useCallback(async N=>{let c=t.filter(y=>y.columnId===N);if(c.length<o.minCardsPerStack*2)return [];let b=[],v=new Map;c.forEach(y=>{y.labels&&y.labels.length>0&&y.labels.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(y);});}),v.forEach((y,D)=>{y.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:y.map(x=>x.id),columnId:N,strategy:"labels",color:"#3b82f6"},reason:`${y.length} cards with label "${D}"`,confidence:.85});});let l=new Map;c.forEach(y=>{y.assignedUserIds&&y.assignedUserIds.length>0&&y.assignedUserIds.forEach(D=>{l.has(D)||l.set(D,[]),l.get(D).push(y);});}),l.forEach((y,D)=>{y.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:y.map(x=>x.id),columnId:N,strategy:"assignee",color:"#8b5cf6"},reason:`${y.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(c.forEach(y=>{y.priority&&(k.has(y.priority)||k.set(y.priority,[]),k.get(y.priority).push(y));}),k.forEach((y,D)=>{if(y.length>=o.minCardsPerStack){let x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${x} ${D} Priority`,cardIds:y.map(w=>w.id),columnId:N,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${y.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let y of c){let x=(await r.findSimilar(y,c)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let w=[y.id,...x.map(M=>M.card.id)],B=x.reduce((M,S)=>M+S.similarity,0)/x.length;b.push({stack:{title:`\u2728 Similar to "${y.title.substring(0,30)}${y.title.length>30?"...":""}"`,cardIds:w,columnId:N,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:B});}}return b.filter(y=>y.confidence>=o.autoStackConfidenceThreshold).sort((y,D)=>D.confidence-y.confidence).slice(0,5)},[t,o,r]),T=react.useCallback(N=>{m(N.stack.title,N.stack.cardIds,N.stack.columnId,N.stack.strategy,N.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await f(c),v=b[0];b.length>0&&v&&v.confidence>=.9&&T(v);});},[]),{stacks:s,createStack:m,deleteStack:p,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:f,applySuggestion:T,config:o}}var Nm=react.createContext(null);function Dm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(p=>{let{Column:i}=Qo("@libxai/core");s.set(p.id,new i(p));}),t?.cards?.forEach(p=>{let{Card:i}=Qo("@libxai/core");n.set(p.id,new i(p));});let m=null;if(t?.board){let{Board:p}=Qo("@libxai/core");m=new p(t.board);}r.current=new core.BoardStore({board:m,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Nm.Provider,{value:{store:o},children:e})}function Yn(){let e=react.useContext(Nm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function qo(){let e=Yn(),[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 m=react.useCallback(v=>{e.updateBoard(v);},[e]),p=react.useCallback(v=>{e.addColumn(v);},[e]),i=react.useCallback((v,l)=>{e.updateColumn(v,l);},[e]),u=react.useCallback(v=>{e.deleteColumn(v);},[e]),d=react.useCallback(v=>e.getColumn(v),[e]),g=react.useCallback(v=>{e.addCard(v);},[e]),f=react.useCallback((v,l)=>{e.updateCard(v,l);},[e]),T=react.useCallback(v=>{e.deleteCard(v);},[e]),N=react.useCallback((v,l,k)=>{e.moveCard(v,l,k);},[e]),c=react.useCallback(v=>e.getCard(v),[e]),b=react.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:p,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:f,deleteCard:T,moveCard:N,getCard:c,getCardsByColumn:b}}function Em(e){let{cards:t}=qo();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 Pm(e="position",t="asc"){let{cards:a}=qo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?m[o.priority]:0,i=s.priority?m[s.priority]:0;n=p-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 qn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nl.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 m=await Promise.resolve(n.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{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);}},Vh=new qn;function Am({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:m=0,getItemKey:p}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:m}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:f,children:d.map(T=>{let N=e[T.index];if(!N)return null;let c=p?p(N,T.index):T.index,b={position:"absolute",top:n?0:T.start,left:n?T.start:0,width:n?T.size:"100%",height:n?"100%":T.size};return jsxRuntime.jsx("div",{style:b,"data-index":T.index,children:r(N,T.index)},c)})})})}function Fm(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 Im({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:m=16,getItemKey:p,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:m}),g=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},T={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:f,className:s,children:jsxRuntime.jsx("div",{style:T,children:g.map(N=>{let c=e[N.index];if(!c)return null;let b=p?p(c,N.index):N.index,v={position:"absolute",top:0,left:N.start,width:N.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":N.index,children:o(c,N.index)},b)})})})}function Bm(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 Rm(e,t=10){return e>t}var Qi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Zi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},el={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},tl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},rl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ol={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},nl={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)"},sl={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)"},il={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ll={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}},dl={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}},Xn={spacing:Qi,borderRadius:Zi,fontSize:el,fontWeight:tl,lineHeight:al,zIndex:rl,duration:ol,easing:nl,shadows:sl,opacity:il,kanban:ll,gantt:dl};function $m(e,t,a){return e[t]??a}function cl(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)?cl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Yh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ml(e="asakaa"){let t=cl(Xn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Yh(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
389
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Sc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=Sc(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(m=>{let p=m.name.toLowerCase();return n.every(i=>p.includes(i))})}function Ci(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 C=new Date(r),T=C.getDay(),c=f-T;return c<=0&&(c+=7),C.setDate(C.getDate()+c),C}}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(),C=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?C.setDate(C.getDate()+g):f==="week"||f==="semana"||f==="semanas"?C.setDate(C.getDate()+g*7):(f==="month"||f==="mes"||f==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let g=parseInt(m[1],10),f=parseInt(m[2],10)-1,C=parseInt(m[3],10);return new Date(C,f,g)}let p={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=p[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(C,f,g)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 g=u[d[1].toLowerCase()],f=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,f)}return null}function Ti(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 Ni(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 Ec(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 Pc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),d=br(t,i),g=Ci(u);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(!g)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(g);return C.setDate(C.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.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(),u=o[2].trim(),d=br(t,i),g=Ti(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.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(),u=s[2].trim(),d=br(t,i),g=Ni(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.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(),u=n[2].trim(),d=br(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),u=m[2].trim(),d=br(t,i),g=br(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let i=p[1].trim(),u=br(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Mc(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 z0(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 U0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Rn(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Rn(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},m=n(e.startDate),p=n(e.endDate),i=e.metadata?.isMilestone===true||m&&p&&Math.abs(p.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:p,progress:e.progress||0,status:z0(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 Ac(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:U0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Fc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Rn(r,e,t))}var Di={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},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"}},Si={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},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"}},$n={en:Di,es:Si};function Ei(e){return $n[e]||$n.en}function On(e,t){let a=Ei(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}function Rc(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(...Rc(r.subtasks,t+1));return a}function J0({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function $c({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:m="dark",locale:p="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=On(p,i),f=m==="dark",[C,T]=react.useState(new Set),[c,b]=react.useState("startDate"),[v,l]=react.useState("asc"),[x,y]=react.useState("");react.useMemo(()=>{let M=new Set;function S(z){for(let $ of z)$.subtasks?.length&&(M.add($.id),S($.subtasks));}S(e),T(M);},[e]);let D=react.useCallback(M=>{T(S=>{let z=new Set(S);return z.has(M)?z.delete(M):z.add(M),z}),a.onTaskToggleExpand?.(M);},[a]),k=react.useCallback(M=>{c===M?l(S=>S==="asc"?"desc":"asc"):(b(M),l("asc")),a.onSortChange?.({column:M,direction:v==="asc"?"desc":"asc"});},[c,v,a]),w=react.useMemo(()=>{let M=Rc(e);if(x.trim()){let z=x.toLowerCase();M=M.filter($=>$.name.toLowerCase().includes(z));}let S=[];for(let z of M){let $=z.level===0;z.level>0&&($=true),($||x.trim())&&S.push(z);}return x.trim()&&S.sort((z,$)=>{let K,Y;switch(c){case "name":K=z.name.toLowerCase(),Y=$.name.toLowerCase();break;case "startDate":K=z.startDate?.getTime()||0,Y=$.startDate?.getTime()||0;break;case "endDate":K=z.endDate?.getTime()||0,Y=$.endDate?.getTime()||0;break;case "progress":K=z.progress||0,Y=$.progress||0;break;case "status":K=z.status||"todo",Y=$.status||"todo";break;default:return 0}return K<Y?v==="asc"?-1:1:K>Y?v==="asc"?1:-1:0}),S},[e,x,c,v]),B=M=>M?(M instanceof Date?M:new Date(M)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",f?"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:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",f?"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:h("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",f?"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:h("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:h("flex-1 flex flex-col w-full h-full overflow-hidden",f?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:h("flex-shrink-0 px-6 py-4 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:h("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:M=>y(M.target.value),placeholder:g.toolbar.searchPlaceholder,className:h("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",f?"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.jsxs("div",{className:h("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:h("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",f?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>k("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((M,S)=>{let z=C.has(M.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:S*.02},className:h("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",f?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+M.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:$=>{$.stopPropagation(),D(M.id);},className:h("p-0.5 rounded",f?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:h("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")})}),d&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:$=>{$.stopPropagation(),a.onTaskUpdate?.({...M,progress:M.progress===100?0:100,status:M.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(J0,{status:M.status,progress:M.progress})}),jsxRuntime.jsx("span",{className:h("truncate",f?"text-white":"text-gray-900",M.progress===100&&(f?"line-through text-[#6B7280]":"line-through text-gray-400")),children:M.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:h("px-2 py-1 rounded-full text-xs font-medium",M.progress===100||M.status==="completed"?"bg-green-500/10 text-green-500":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/10 text-blue-500":f?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:M.progress===100||M.status==="completed"?g.status.completed:M.progress&&M.progress>0||M.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:h("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(M.startDate)]}),jsxRuntime.jsxs("div",{className:h("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),B(M.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:h("flex-1 h-1.5 rounded-full overflow-hidden",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${M.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-xs w-8",f?"text-[#9CA3AF]":"text-gray-500"),children:[M.progress||0,"%"]})]})})]},M.id)})}),w.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:h("w-12 h-12 mx-auto mb-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h(f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Pi={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"},Mi={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"},Ai={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"},Un={dark:Pi,light:Mi,neutral:Ai};function Oc(e){return Un[e]||Un.dark}var Fi={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"}},Li={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"}},Hn={en:Fi,es:Li};function Ho(e){return Hn[e]||Hn.en}function Wn(e,t){let a=Ho(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 zc(e){let t=Ho(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 Uc(e,t=0,a=true){let r=Ho(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 hh(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 zi(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 Vc({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 Kc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:m,availableTags:p=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:f,onTaskOpen:C}){let{theme:T="dark",locale:c="en",customTranslations:b}=t,v=Wn(c,b),l=T==="dark",x={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[y,D]=react.useState(r||new Date),[k,w]=react.useState(null),[B,M]=react.useState(null),[S,z]=react.useState(null),[$,K]=react.useState(new Date),[Y,ye]=react.useState({}),Oe=4,nt=3,[_e,Ae]=react.useState(false),[Q,L]=react.useState(false),[N,W]=react.useState(false),[U,R]=react.useState(false),[se,pe]=react.useState(null),[Ne,ie]=react.useState(""),[Le,Ee]=react.useState(void 0),[De,He]=react.useState(null),[ht,et]=react.useState(false),[O,te]=react.useState(false),[le,Ce]=react.useState(null),[$e,tt]=react.useState(false),[xt,Me]=react.useState(new Date),[Lt,At]=react.useState(false),[ct,Xe]=react.useState(false),[Ht,sa]=react.useState(false),[ae,re]=react.useState(""),[Vt,de]=react.useState(false),[E,q]=react.useState(""),[ge,Ie]=react.useState(false),We=react.useCallback(()=>{D(new Date(y.getFullYear(),y.getMonth()-1,1));},[y]),Ye=react.useCallback(()=>{D(new Date(y.getFullYear(),y.getMonth()+1,1));},[y]),ze=react.useCallback(()=>{D(new Date);},[]),st=react.useMemo(()=>{let P=y.getFullYear(),ve=y.getMonth(),J=new Date(P,ve,1),Fe=new Date(P,ve+1,0),it=J.getDay(),ne=Fe.getDate(),Ue=hh(e),Nt=new Date;Nt.setHours(0,0,0,0);let Be=[],It=it,pt=new Date(P,ve,0).getDate();for(let Wt=It-1;Wt>=0;Wt--){let Ke=new Date(P,ve-1,pt-Wt);Be.push({date:Ke,isCurrentMonth:false,isToday:false,isWeekend:Ke.getDay()===0||Ke.getDay()===6,events:Ue.filter(Dt=>zi(Ke,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}for(let Wt=1;Wt<=ne;Wt++){let Ke=new Date(P,ve,Wt),Dt=Ke.getTime()===Nt.getTime();Be.push({date:Ke,isCurrentMonth:true,isToday:Dt,isWeekend:Ke.getDay()===0||Ke.getDay()===6,events:Ue.filter(ca=>zi(Ke,ca)).map(ca=>({id:ca.id,title:ca.name,start:ca.startDate,end:ca.endDate,task:ca}))});}let ha=42-Be.length;for(let Wt=1;Wt<=ha;Wt++){let Ke=new Date(P,ve+1,Wt);Be.push({date:Ke,isCurrentMonth:false,isToday:false,isWeekend:Ke.getDay()===0||Ke.getDay()===6,events:Ue.filter(Dt=>zi(Ke,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}return Be},[y,e]),mt=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=y.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ee=react.useCallback((P,ve)=>{if(!k)return;let J={...k,[P]:ve};w(J),a.onTaskUpdate?.(J);},[k,a]),Pe=react.useCallback(P=>{if(!k)return;let ve=k.progress||0;P==="completed"?ve=100:P==="todo"&&(ve=0);let J={...k,status:P,progress:ve};w(J),a.onTaskUpdate?.(J),Ae(false);},[k,a]),qe=react.useCallback((P,ve)=>{if(!k)return;let J={...k,startDate:P,endDate:ve};w(J),a.onTaskUpdate?.(J);},[k,a]),Ge=react.useCallback(()=>{Ae(false),L(false),W(false),z(null),sa(false),re(""),de(false);},[]),G=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),At(false),!k||!a.onUploadAttachments)return;let ve=Array.from(P.dataTransfer.files);if(ve.length!==0){Xe(true);try{await a.onUploadAttachments(k.id,ve);}finally{Xe(false);}}},[k,a]),ce=react.useCallback(async P=>{if(!k||!a.onUploadAttachments||!P.target.files)return;let ve=Array.from(P.target.files);if(ve.length!==0){Xe(true);try{await a.onUploadAttachments(k.id,ve);}finally{Xe(false);}P.target.value="";}},[k,a]),Re=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),At(true);},[]),Pt=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),At(false);},[]),at=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),xa=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]),fa=react.useMemo(()=>!k||!u?[]:u.get(k.id)||[],[k,u]);return o?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,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:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[v.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,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:h("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,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:h("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:v.labels.noEvents}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:v.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:h("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:m,children:[jsxRuntime.jsx("div",{className:h("flex-shrink-0 px-6 py-4 border-b",l?"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:h("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:_}),jsxRuntime.jsx("button",{onClick:ze,className:h("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:v.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:We,className:h("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:h("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ye,className:h("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:h("w-5 h-5",l?"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:mt.map(P=>jsxRuntime.jsx("div",{className:h("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:P},P))}),jsxRuntime.jsx("div",{className:h("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:st.map((P,ve)=>{let J=P.date.getDay()===0||P.date.getDay()===6;return jsxRuntime.jsxs("div",{className:h("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?J?"bg-[#1C1F26]":P.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":J?"bg-gray-100":P.isCurrentMonth?"bg-white":"bg-gray-50",P.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Fe=Y[ve]||Oe,it=P.events.slice(0,Fe),ne=P.events.length-Fe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[it.map(Ue=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{w(Ue.task),a.onEventClick?.(Ue),C?.(Ue.task.id);},whileHover:{scale:1.02},className:h("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ue.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Vc,{task:Ue.task}),jsxRuntime.jsx("span",{className:"truncate",children:Ue.title})]})},Ue.id)),ne>0&&jsxRuntime.jsxs("button",{onClick:Ue=>{Ue.stopPropagation(),ye(Nt=>({...Nt,[ve]:Fe+nt}));},className:h("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ne," ",c==="es"?"M\xC1S":"MORE"]}),Fe>Oe&&P.events.length>Oe&&jsxRuntime.jsx("button",{onClick:Ue=>{Ue.stopPropagation(),ye(Nt=>({...Nt,[ve]:Oe}));},className:h("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:c==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Fe=ve>=28,it=ve%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),se===ve?pe(null):(pe(ve),ie(""),Ee(void 0),He(null),Ce(null),et(false),te(false),tt(false),Me(P.date));},className:h("w-5 h-5 rounded flex items-center justify-center transition-all",se===ve?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:h("w-3.5 h-3.5 transition-transform",se===ve&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se===ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{pe(null),ie(""),Ee(void 0),He(null),Ce(null),et(false),te(false),tt(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:h("absolute w-[320px] rounded-lg shadow-2xl z-50",Fe?"bottom-full mb-1":"top-full mt-1",it?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>{ne.stopPropagation(),et(false),te(false),tt(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Ne,onChange:ne=>ie(ne.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:h("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ne=>{if(ne.key==="Enter"&&Ne.trim()){let Ue=t.availableUsers?.find(Be=>Be.id===De),Nt=le||P.date;a.onTaskCreate?.({name:Ne.trim(),startDate:Nt,endDate:Nt,priority:Le,assignees:Ue?[Ue]:void 0}),ie(""),Ee(void 0),He(null),Ce(null),pe(null);}ne.key==="Escape"&&(pe(null),ie(""),Ee(void 0),He(null),Ce(null));}})}),jsxRuntime.jsxs("div",{className:h("px-2.5 py-2 flex items-center justify-between border-t",l?"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:ne=>{ne.stopPropagation(),et(!ht),te(false);},className:h("p-1 rounded transition-colors",Le?Le==="urgent"||Le==="high"?"text-red-400 bg-red-500/20":Le==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"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:ht&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ne=>jsxRuntime.jsxs("button",{onClick:()=>{Ee(ne.id),et(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Le===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",ne.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ne.label})]},ne.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ne=>{ne.stopPropagation(),tt(!$e),et(false),te(false),Me(le||P.date);},className:h("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",le?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"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"}),(le||P.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$e&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsx("div",{className:h("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let ne=new Date,Ue=new Date(ne);Ue.setDate(ne.getDate()+1);let Nt=new Date(ne);Nt.setDate(ne.getDate()+((6-ne.getDay()+7)%7||7));let Be=new Date(ne);Be.setDate(ne.getDate()+((1-ne.getDay()+7)%7||7));let It=new Date(ne);It.setDate(ne.getDate()+14);let pt=new Date(ne);return pt.setDate(ne.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:Ue,display:Ue.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:Nt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Be,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:It,display:It.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:pt,display:pt.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Wt,Ke)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Ce(Wt.date),tt(false);},children:[jsxRuntime.jsx("span",{children:Wt.label}),jsxRuntime.jsx("span",{className:h("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:Wt.display})]},Ke))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:h("text-xs font-medium",l?"text-white":"text-gray-900"),children:xt.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Me(new Date),className:h("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Me(new Date(xt.getFullYear(),xt.getMonth()-1)),className:h("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Me(new Date(xt.getFullYear(),xt.getMonth()+1)),className:h("p-0.5 rounded",l?"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:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ne=>jsxRuntime.jsx("div",{className:h("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:ne},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ne=xt.getFullYear(),Ue=xt.getMonth(),Nt=new Date(ne,Ue,1).getDay(),Be=new Date(ne,Ue+1,0).getDate(),It=new Date(ne,Ue,0).getDate(),pt=new Date,ha=[];for(let Ke=Nt-1;Ke>=0;Ke--)ha.push({dayNum:It-Ke,isCurrentMonth:false,date:new Date(ne,Ue-1,It-Ke)});for(let Ke=1;Ke<=Be;Ke++)ha.push({dayNum:Ke,isCurrentMonth:true,date:new Date(ne,Ue,Ke)});let Wt=42-ha.length;for(let Ke=1;Ke<=Wt;Ke++)ha.push({dayNum:Ke,isCurrentMonth:false,date:new Date(ne,Ue+1,Ke)});return ha.map((Ke,Dt)=>{let ca=Ke.date.toDateString()===pt.toDateString(),yr=(le||P.date).toDateString()===Ke.date.toDateString();return jsxRuntime.jsx("button",{className:h("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Ke.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Ke.isCurrentMonth&&(l?"text-white":"text-gray-900"),ca&&"ring-1 ring-[#3B82F6]",yr&&"bg-[#7C3AED] text-white",!yr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Ce(Ke.date),tt(false);},children:Ke.dayNum},Dt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),te(!O),et(false);},className:h("p-1 rounded transition-colors",De?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:De?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(ne=>ne.id===De)?.color||"#7C3AED"},children:t.availableUsers?.find(ne=>ne.id===De)?.initials||t.availableUsers?.find(ne=>ne.id===De)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{He(null),te(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!De&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ne=>jsxRuntime.jsxs("button",{onClick:()=>{He(ne.id),te(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",De===ne.id&&(l?"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:ne.color||"#7C3AED"},children:ne.initials||ne.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ne.name})]},ne.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:h("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Ne.trim()){let ne=t.availableUsers?.find(Nt=>Nt.id===De),Ue=le||P.date;a.onTaskCreate?.({name:Ne.trim(),startDate:Ue,endDate:Ue,priority:Le,assignees:ne?[ne]:void 0}),ie(""),Ee(void 0),He(null),Ce(null),pe(null);}},disabled:!Ne.trim(),className:h("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ne.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:h("text-sm font-medium",P.isToday?"text-[#3B82F6]":P.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:P.date.getDate()})]})]},ve)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{w(null),q("");},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:h("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:h("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:h("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:h("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:h("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:k.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{w(null),q("");},className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=k.progress===100?0:100,J={...k,progress:P,status:P===100?"completed":"todo"};w(J),a.onTaskUpdate?.(J);},className:h("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",k.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:k.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:h("text-xl font-semibold flex-1",k.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:k.name})]})}),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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ge(),Ae(!_e);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.progress===100||k.status==="completed"?"bg-green-500/20 text-green-400":k.progress&&k.progress>0||k.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:k.progress===100||k.status==="completed"?c==="es"?"COMPLETADO":"DONE":k.progress&&k.progress>0||k.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&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:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>Pe(P.id),className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(k.status===P.id||P.id==="completed"&&k.progress===100||P.id==="in-progress"&&k.progress&&k.progress>0&&k.progress<100||P.id==="todo"&&(!k.progress||k.progress===0)&&k.status!=="in-progress"&&k.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",P.id==="completed"?"bg-green-500":P.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ae(false),L(false),z(null),W(!N);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[k.assignees&&k.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[k.assignees.slice(0,3).map((P,ve)=>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()},ve)),k.assignees.length>3&&jsxRuntime.jsxs("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",k.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:h("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(P=>{let ve=k.assignees?.some(J=>J.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let J=k.assignees||[],Fe;ve?Fe=J.filter(it=>it.name!==P.name):Fe=[...J,{name:P.name,avatar:P.avatar,initials:P.initials||P.name.slice(0,2).toUpperCase(),color:P.color||"#8B5CF6"}],ee("assignees",Fe);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[P.avatar?jsxRuntime.jsx("img",{src:P.avatar,alt:P.name,className:"w-6 h-6 rounded-full object-cover"}):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"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:h("flex-1 text-left",l?"text-white":"text-gray-900"),children:P.name}),ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.id||P.name)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{z(S?null:"start"),K(k.startDate||new Date);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[k.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:h("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),k.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(k.startDate||k.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:P=>{P.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:h("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:h("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ve=new Date(P);ve.setDate(P.getDate()+1);let J=new Date(P);J.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Fe=new Date(P);Fe.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let it=new Date(P);it.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ne=new Date(P);ne.setDate(P.getDate()+14);let Ue=new Date(P);return Ue.setDate(P.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:ve,display:ve.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:J,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Fe,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:it,display:it.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Be,It)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(S==="start"){let pt=k.endDate&&Be.date>k.endDate?Be.date:k.endDate;qe(Be.date,pt),z("end");}else {let pt=k.startDate&&Be.date<k.startDate?Be.date:k.startDate;qe(pt,Be.date),z(null);}},children:[jsxRuntime.jsx("span",{children:Be.label}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Be.display})]},It))})(),jsxRuntime.jsx("div",{className:h("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{qe(void 0,void 0),z(null);},className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:c==="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:h("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:S==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="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:h("font-medium",l?"text-white":"text-gray-900"),children:$.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>K(new Date),className:h("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>K(new Date($.getFullYear(),$.getMonth()-1)),className:h("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>K(new Date($.getFullYear(),$.getMonth()+1)),className:h("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:h("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=$.getFullYear(),ve=$.getMonth(),J=new Date(P,ve,1).getDay(),Fe=new Date(P,ve+1,0).getDate(),it=new Date(P,ve,0).getDate(),ne=new Date,Ue=[];for(let Be=J-1;Be>=0;Be--)Ue.push({day:it-Be,isCurrentMonth:false,date:new Date(P,ve-1,it-Be)});for(let Be=1;Be<=Fe;Be++)Ue.push({day:Be,isCurrentMonth:true,date:new Date(P,ve,Be)});let Nt=42-Ue.length;for(let Be=1;Be<=Nt;Be++)Ue.push({day:Be,isCurrentMonth:false,date:new Date(P,ve+1,Be)});return Ue.map((Be,It)=>{let pt=Be.date.toDateString()===ne.toDateString(),ha=k.startDate?.toDateString()===Be.date.toDateString(),Wt=k.endDate?.toDateString()===Be.date.toDateString(),Ke=ha||Wt,Dt=k.startDate&&k.endDate&&Be.date>=k.startDate&&Be.date<=k.endDate;return jsxRuntime.jsx("button",{className:h("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Be.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Be.isCurrentMonth&&(l?"text-white":"text-gray-900"),pt&&"ring-2 ring-[#3B82F6]",ha&&"bg-[#3B82F6] text-white",Wt&&!ha&&"bg-[#7C3AED] text-white",Dt&&!Ke&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!Ke&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ca=new Date(Be.date);if(S==="start"){let yr=k.endDate&&ca>k.endDate?ca:k.endDate;qe(ca,yr),z("end");}else {let yr=k.startDate&&ca<k.startDate?ca:k.startDate;qe(yr,ca),z(null);}},children:Be.day},It)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ge(),L(!Q);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.priority==="high"||k.priority==="urgent"?"bg-red-500/20 text-red-400":k.priority==="medium"?"bg-yellow-500/20 text-yellow-400":k.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:k.priority?k.priority==="high"||k.priority==="urgent"?c==="es"?"Urgente":"Urgent":k.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{ee("priority",P.id),L(false);},className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",k.priority===P.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:l?"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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:k.startDate&&k.endDate?`${Math.ceil((k.endDate.getTime()-k.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[U?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:k.progress||0,onChange:P=>{let ve=parseInt(P.target.value),J=k.status;ve===100?J="completed":ve>0?J="in-progress":J="todo";let Fe={...k,progress:ve,status:J};w(Fe),a.onTaskUpdate?.(Fe);},onBlur:()=>R(false),className:h("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>R(true),className:h("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:k.tags||[],availableTags:p,onChange:P=>{ee("tags",P);},onCreateTag:i,theme:x})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:h("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[k.dependencies&&k.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.dependencies.map(P=>{let ve=e.find(J=>J.id===P);return jsxRuntime.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ve?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let J=(k.dependencies||[]).filter(Fe=>Fe!==P);ee("dependencies",J);},className:h("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:()=>{Ge(),sa(!Ht);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ht&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{sa(false),re("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:h("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ae,onChange:P=>re(P.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:h("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(P=>P.id!==k.id).filter(P=>ae===""||P.name.toLowerCase().includes(ae.toLowerCase())).map(P=>{let ve=k.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let J=k.dependencies||[],Fe;ve?Fe=J.filter(it=>it!==P.id):Fe=[...J,P.id],ee("dependencies",Fe);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ve?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:ve&&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:h("block truncate",l?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ge(),de(!Vt);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:k.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:sr.find(P=>P.value===k.color)?.name||(c==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Vt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>de(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(P=>{let ve=k.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{ee("color",P.value),de(false);},className:h("w-7 h-7 rounded-full flex items-center justify-center transition-all",ve&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ve?P.value:void 0},title:P.name,children:ve&&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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:k.isMilestone||false,onChange:P=>ee("isMilestone",P.target.checked),className:h("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",k.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:k.description||"",onChange:P=>ee("description",P.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:h("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),k.subtasks&&k.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:k.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:h("text-sm",P.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:h("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",fa.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",fa.length,")"]})]}),fa.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:fa.map(P=>{let ve=xa(P.type),J=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:h("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[J&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:h("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ve,{className:h("w-5 h-5",l?"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:h("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:at(P.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(P.id),className:h("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Re,onDragLeave:Pt,onDrop:G,className:h("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Lt?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ct&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ce,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||ct}),ct?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:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:h("w-6 h-6 mx-auto mb-2",Lt?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:Lt?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="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"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:h("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:h("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:h("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(P=>{let ve=(()=>{let J=new Date,Fe=new Date(P.createdAt),it=J.getTime()-Fe.getTime(),ne=Math.floor(it/6e4),Ue=Math.floor(ne/60),Nt=Math.floor(Ue/24);return ne<1?c==="es"?"ahora":"now":ne<60?c==="es"?`hace ${ne}m`:`${ne}m ago`:Ue<24?c==="es"?`hace ${Ue}h`:`${Ue}h ago`:c==="es"?`hace ${Nt}d`:`${Nt}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#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:h("text-sm font-medium",l?"text-white":"text-gray-900"),children:P.user?.name||(c==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ve})]}),jsxRuntime.jsx("p",{className:h("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:P.content})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:h("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:h("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[f&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:f.color||"#8B5CF6"},children:f.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:h("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:E,onChange:P=>q(P.target.value),onKeyDown:async P=>{if(P.key==="Enter"&&!P.shiftKey&&k&&E.trim()&&g){P.preventDefault(),Ie(true);try{await g(k.id,E.trim()),q("");}finally{Ie(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:ge||!g,className:h("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(ge||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(k&&E.trim()&&g){Ie(true);try{await g(k.id,E.trim()),q("");}finally{Ie(false);}}},disabled:ge||!E.trim()||!g,className:h("p-1.5 rounded transition-colors",E.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",ge&&"opacity-50 cursor-not-allowed"),children:ge?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(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:h("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:h("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:h("font-medium",l?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>M(null),className:h("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:B.events.map(P=>jsxRuntime.jsxs("button",{onClick:()=>{M(null),w(P.task),C?.(P.task.id);},className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Vc,{task:P.task}),jsxRuntime.jsx("span",{className:h("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:P.title}),P.task.priority==="high"||P.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},P.id))})]})]})})]})}var Ui={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"},Hi={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"},Wi={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"},_n={dark:Ui,light:Hi,neutral:Wi};function Yc(e){return _n[e]||_n.dark}function yh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:m}){let[p,i]=react.useState(false),u=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=react.useMemo(()=>{let f=u.length,C=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,T=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:f,uniqueAssignees:C,priorities:T,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:h("card-stack",!e.isExpanded&&"card-stack-collapsed",m),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:h("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"]})]}),p&&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:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(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:C=>{C.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 Xc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function _o(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 Vo(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 Jc(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 Zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:m}){let p=react.useMemo(()=>({...Xc,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(l=>{let x=l.timestamp.toISOString().split("T")[0],y=v.get(x);y?y.push(l):v.set(x,[l]);}),Array.from(v.entries()).sort((l,x)=>x[0].localeCompare(l[0])).map(([l,x])=>({date:new Date(l),events:x.sort((y,D)=>D.timestamp.getTime()-y.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:f,uniqueTypes:C}=react.useMemo(()=>{let v=new Set,l=new Set;return e.forEach(x=>{v.add(x.userId),l.add(x.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(l)}},[e]),T=v=>{u(l=>{let x=new Set(l);return x.has(v)?x.delete(v):x.add(v),x});},c=v=>{let x=new Date().getTime()-v.getTime(),y=Math.floor(x/6e4),D=Math.floor(x/36e5),k=Math.floor(x/864e5);return y<1?"just now":y<60?`${y}m ago`:D<24?`${D}h ago`:k<7?`${k}d ago`:v.toLocaleDateString()},b=react.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return react.useEffect(()=>{if(s&&d.current){let v=d.current.querySelector(`[data-event-id="${s}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:h("history-timeline-empty",m),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:h("history-timeline",p.compact&&"compact",m),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:v=>{let l=v.target.value;a({...t,types:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),C.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Vo(v)," ",v.replace("_"," ")]},v))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let l=v.target.value;a({...t,users:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>a({...t,searchTerm:v.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((l,x)=>{let y=i.has(l.id),D=s===l.id,k=Jc(l.type);return jsxRuntime.jsxs("div",{"data-event-id":l.id,className:h("history-timeline-event",y&&"expanded",D&&"selected"),onClick:()=>o?.(l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Vo(l.type)})}),x<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[p.showAvatars&&l.userAvatar&&jsxRuntime.jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:_o(l)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),T(l.id);},children:[y?"\u25BC":"\u25B6"," Show changes"]}),y&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([w,B])=>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(B.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},w)),l.metadata&&Object.keys(l.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(l.metadata).map(([w,B])=>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(B)})]},w))]})]})]})]},l.id)})})]},v.date?.toISOString()||"all"))})]})}function em({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:m,onSpeedChange:p,className:i}){let u=[.5,1,1.5,2,3],d=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:h("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:h("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Vo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&_o(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=>m(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,C)=>jsxRuntime.jsx("div",{className:h("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>m(C),title:_o(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:u.map(f=>jsxRuntime.jsxs("button",{className:h("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>p(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:h("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 Gi(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 _i(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 tm(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 am(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Th(e,t,a,r,o,s=100){let n=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(n.map(p=>[p.id,p]));for(let p=0;p<s;p++){let i=1-p/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(f=>{if(u.id===f.id)return;let C=u.x-f.x,T=u.y-f.y,c=Math.sqrt(C*C+T*T)||1,b=o.chargeStrength*i/(c*c);u.vx+=C/c*b,u.vy+=T/c*b;});}),t.forEach(u=>{let d=m.get(typeof u.source=="string"?u.source:u.source.id),g=m.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let f=g.x-d.x,C=g.y-d.y,T=Math.sqrt(f*f+C*C)||1,c=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=f*c,d.vy+=C*c,g.vx-=f*c,g.vy-=C*c;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function rm({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:m,className:p}){let i=react.useRef(null),[u,d]=react.useState([]),[g,f]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(1),[x,y]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=Th(e,t,a.width,a.height,a,150);d($);},[e,t,a]);let D=react.useCallback(($,K)=>{a.enableDragging&&(K.stopPropagation(),f($));},[a.enableDragging]),k=react.useCallback($=>{if(!g||!i.current)return;let Y=i.current.getBoundingClientRect(),ye=($.clientX-Y.left-x.x)/v,Oe=($.clientY-Y.top-x.y)/v;d(nt=>nt.map(_e=>_e.id===g?{..._e,x:ye,y:Oe,fx:ye,fy:Oe}:_e));},[g,v,x]),w=react.useCallback(()=>{f(null);},[]),B=react.useCallback(($,K)=>{K.stopPropagation(),m?.({type:"node-click",node:$,position:{x:K.clientX,y:K.clientY}});},[m]),M=react.useCallback(($,K)=>{K.stopPropagation(),m?.({type:"edge-click",edge:$,position:{x:K.clientX,y:K.clientY}});},[m]),S=react.useCallback($=>{let K=u.find(Y=>Y.id===$);return K?{x:K.x,y:K.y}:{x:0,y:0}},[u]),z=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=$.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:h("relationships-graph-empty",p),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:h("relationships-graph",p),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:()=>l($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),y({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Gi($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[tm($)," ",_i($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let K=S(typeof $.source=="string"?$.source:$.source.id),Y=S(typeof $.target=="string"?$.target:$.target.id),ye=am($.type),Oe=c===$.id,nt=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:h("relationships-graph-edge",Oe&&"hovered",nt&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:_e=>M($,_e),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:Y.x,y2:Y.y,stroke:Gi($.type),strokeWidth:nt?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Oe?1:.6,markerEnd:ye?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Oe&&jsxRuntime.jsx("text",{x:(K.x+Y.x)/2,y:(K.y+Y.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_i($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map($=>{let K=C===$.id,Y=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:h("relationships-graph-node",K&&"hovered",Y&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:ye=>D($.id,ye),onMouseEnter:()=>T($.id),onMouseLeave:()=>T(null),onClick:ye=>B($,ye),children:[jsxRuntime.jsx("circle",{r:Y?a.nodeSize*1.2:a.nodeSize,fill:z($),stroke:Y?"#fbbf24":"#ffffff",strokeWidth:Y?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function sm({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[m,p]=react.useState(false),[i,u]=react.useState(null),[d,g]=react.useState(null),f=react.useRef(null),C=m||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let v=l=>{l.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||C)){p(true),u(null),g(null);try{let v=await r(s.trim());g(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{p(false);}}},b=()=>{d&&(a(d),T());};return e?jsxRuntime.jsxs(gt,{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-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:v=>v.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:T,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: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((v,l)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},l))})]}),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((v,l)=>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:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},l)),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:v=>n(v.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."})]}),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((v,l)=>jsxRuntime.jsx("button",{onClick:()=>n(v),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:v},l))})]})]})}),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:T,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"}),d?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:c,disabled:!s.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 Plan"})]})]})]})})]}):null}var Vi={"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 Dh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Sh={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 Eh(e,t,a){let r=Vi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function jo(e){return `$${e.toFixed(4)}`}var ji=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Eh(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,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),m=a.filter(d=>d.success),p=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?p/r:0,successRate:r>0?m.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 m=this.operations.filter(u=>u.timestamp>=n).length,p=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:p,percentUsed:i,isExceeded:m>=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)}},Zr=new ji;function dm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Zr.getStats()),[s,n]=react.useState(Zr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Zr.getStats()),n(Zr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let m=Zr.getRecentOperations(5);return jsxRuntime.jsxs(gt,{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:p=>p.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:jo(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(([p,i])=>{let u=r.costsByFeature[p]||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:p.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:jo(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:jo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 pm({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,m]=react.useState(""),[p,i]=react.useState(""),[u,d]=react.useState(""),[g,f]=react.useState(false),[C,T]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(null),x=react.useRef(null),y=g||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let M=S=>{S.key==="Escape"&&!y&&D();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,y]);let D=()=>{y||(m(""),i(""),d(""),T(null),b(null),l(null),t());},k=async()=>{if(!(!n.trim()||y)){f(true),T(null),b(null),l(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:u||void 0});b(M.tasks.tasks),l({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){T(M instanceof Error?M.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{c&&(a(c),D());};if(!e)return null;let B=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:D,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:c?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:[v?.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"}),v?.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 (",B,"% 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:[v?.tokens_used||0," tokens"]}),v?.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:[v.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:[c.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((M,S)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",S+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:M.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:x,value:n,onChange:M=>m(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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:p,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:y})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:y})]})]}),C&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((M,S)=>jsxRuntime.jsx("button",{onClick:()=>m(M),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},S))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),c?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||y,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:y?"Generating...":"Generate Tasks"})]})]})]})})]})}function Kn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(c=>{t&&tn(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,v,l)=>{console.warn(`Retry attempt ${v} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(c,b,v)=>{r(l=>{let x=l.cards.find(M=>M.id===c);if(!x)return l;let y=x.columnId,D={...x,columnId:b,position:v},k=l.cards.map(M=>M.id===c?D:M),w=l.columns.map(M=>{if(M.id===y)return {...M,cardIds:M.cardIds.filter(S=>S!==c)};if(M.id===b){let S=k.filter(z=>z.columnId===b).sort((z,$)=>z.position-$.position);return {...M,cardIds:S.map(z=>z.id)}}return M}),B={...l,cards:k,columns:w};return o(B),B});},[o]),n=react.useCallback(async(c,b)=>{r(v=>{let l=v.cards.map(y=>y.id===c?{...y,...b}:y),x={...v,cards:l};return o(x),x});},[o]),m=react.useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let l={...c,id:b},x=v.columns.map(D=>D.id===c.columnId?{...D,cardIds:[...D.cardIds,b]}:D),y={...v,cards:[...v.cards,l],columns:x};return o(y),y});},[o]),p=react.useCallback(async c=>{r(b=>{let v=b.cards.find(D=>D.id===c);if(!v)return b;let l=b.cards.filter(D=>D.id!==c),x=b.columns.map(D=>D.id===v.columnId?{...D,cardIds:D.cardIds.filter(k=>k!==c)}:D),y={...b,cards:l,columns:x};return o(y),y});},[o]),i=react.useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let l={...c,id:b,cardIds:[]},x={...v,columns:[...v.columns,l]};return o(x),x});},[o]),u=react.useCallback(async(c,b)=>{r(v=>{let l=v.columns.map(y=>y.id===c?{...y,...b}:y),x={...v,columns:l};return o(x),x});},[o]),d=react.useCallback(async c=>{r(b=>{let v=b.cards.filter(y=>y.columnId!==c),l=b.columns.filter(y=>y.id!==c),x={...b,cards:v,columns:l};return o(x),x});},[o]),g=react.useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(c),b},[m]),f=react.useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),C=react.useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:m,onCardDelete:p,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:f,deleteCard:p,deleteColumn:d,clearBoard:C}}}function gm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Kn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(p,i,u={})=>{s.addCard({title:i,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...u});},addColumn:(p,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Ko={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},hm={by:"none",order:"asc"};function bm({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Ko,...e}),[s,n]=react.useState({...hm,...t}),m=react.useCallback(T=>{o(c=>({...c,...T}));},[]),p=react.useCallback(T=>{n(c=>({...c,...T}));},[]),i=react.useCallback(()=>{o(Ko),n(hm);},[]),u=react.useCallback(()=>{a&&o({...Ko,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Ko,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Ko,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]),C=react.useCallback(T=>{let c=[...T];if(r.search){let b=r.search.toLowerCase();c=c.filter(v=>v.title.toLowerCase().includes(b)||v.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,v=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),x=String(b.getDate()).padStart(2,"0"),y=`${v}-${l}-${x}`;c=c.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let k=D.endDate||D.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let B=k.getUTCFullYear(),M=String(k.getUTCMonth()+1).padStart(2,"0"),S=String(k.getUTCDate()).padStart(2,"0");w=`${B}-${M}-${S}`;}switch(r.dateFilter){case "overdue":return w<y;case "today":return w===y;case "this-week":let B=new Date(y+"T00:00:00"),M=new Date(w+"T00:00:00"),S=new Date(B);return S.setDate(S.getDate()+7),M>=B&&M<=S;case "custom":if(r.dateRange){let z=typeof k=="string"?new Date(k):k;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(v=>r.labels.includes(v)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,v)=>{let l=0;switch(s.by){case "created":let x=b.createdAt?new Date(b.createdAt).getTime():0,y=v.createdAt?new Date(v.createdAt).getTime():0;l=x-y;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=D[b.priority||"LOW"],w=D[v.priority||"LOW"];l=k-w;break;case "dueDate":let B=b.endDate||b.dueDate,M=v.endDate||v.dueDate;if(!B)return 1;if(!M)return -1;let S=typeof B=="string"?new Date(B).getTime():B.getTime(),z=typeof M=="string"?new Date(M).getTime():M.getTime();l=S-z;break;case "title":l=b.title.localeCompare(v.title);break;case "estimate":let $=b.estimatedTime||0,K=v.estimatedTime||0;l=$-K;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:p,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:f}}var vm,xm;if(typeof window<"u")try{let e=Zo("ai");vm=e.generateObject,xm=e.generateText;}catch{}function km(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(vm&&xm&&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(g){let f=g instanceof Error?g:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),m=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(g){let f=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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 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(g){let f=g instanceof Error?g:new Error("Failed to generate subtasks");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("Estimating effort for:",d.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:m,onPredictRisks:p,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Yi(){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 wm(e){let{cards:t}=e,[a,r]=Yi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=g.ctrlKey||g.metaKey,C=g.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(T&&c&&T.columnId===c.columnId){let b=t.filter(w=>w.columnId===T.columnId).sort((w,B)=>w.position-B.position),v=b.findIndex(w=>w.id===a.lastSelectedCardId),l=b.findIndex(w=>w.id===d),[x,y]=v<l?[v,l]:[l,v],D=b.slice(x,y+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=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]),u=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:m,selectAll:p,toggleCard:i,getSelectedCards:u}}var Cm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Tm(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Cm,...a}),[a]),[s,n]=react.useState([]),m=react.useCallback((T,c,b,v,l)=>{if(c.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:T,cardIds:c,columnId:b,strategy:v,color:l,isExpanded:true,position:s.filter(y=>y.columnId===b).length,createdAt:new Date};n(y=>[...y,x]);},[o.minCardsPerStack,s]),p=react.useCallback(T=>{n(c=>c.filter(b=>b.id!==T));},[]),i=react.useCallback(T=>{n(c=>c.map(b=>b.id===T?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((T,c)=>{n(b=>b.map(v=>v.id===T&&!v.cardIds.includes(c)?{...v,cardIds:[...v.cardIds,c]}:v));},[]),d=react.useCallback((T,c)=>{n(b=>b.map(v=>{if(v.id===T){let l=v.cardIds.filter(x=>x!==c);return l.length<o.minCardsPerStack?null:{...v,cardIds:l}}return v}).filter(v=>v!==null));},[o.minCardsPerStack]),g=react.useCallback(T=>s.filter(c=>c.columnId===T).sort((c,b)=>c.position-b.position),[s]),f=react.useCallback(async T=>{let c=t.filter(y=>y.columnId===T);if(c.length<o.minCardsPerStack*2)return [];let b=[],v=new Map;c.forEach(y=>{y.labels&&y.labels.length>0&&y.labels.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(y);});}),v.forEach((y,D)=>{y.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:y.map(k=>k.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${y.length} cards with label "${D}"`,confidence:.85});});let l=new Map;c.forEach(y=>{y.assignedUserIds&&y.assignedUserIds.length>0&&y.assignedUserIds.forEach(D=>{l.has(D)||l.set(D,[]),l.get(D).push(y);});}),l.forEach((y,D)=>{y.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:y.map(k=>k.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${y.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(c.forEach(y=>{y.priority&&(x.has(y.priority)||x.set(y.priority,[]),x.get(y.priority).push(y));}),x.forEach((y,D)=>{if(y.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${k} ${D} Priority`,cardIds:y.map(w=>w.id),columnId:T,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${y.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let y of c){let k=(await r.findSimilar(y,c)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[y.id,...k.map(M=>M.card.id)],B=k.reduce((M,S)=>M+S.similarity,0)/k.length;b.push({stack:{title:`\u2728 Similar to "${y.title.substring(0,30)}${y.title.length>30?"...":""}"`,cardIds:w,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:B});}}return b.filter(y=>y.confidence>=o.autoStackConfidenceThreshold).sort((y,D)=>D.confidence-y.confidence).slice(0,5)},[t,o,r]),C=react.useCallback(T=>{m(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await f(c),v=b[0];b.length>0&&v&&v.confidence>=.9&&C(v);});},[]),{stacks:s,createStack:m,deleteStack:p,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:f,applySuggestion:C,config:o}}var Nm=react.createContext(null);function Dm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(p=>{let{Column:i}=Zo("@libxai/core");s.set(p.id,new i(p));}),t?.cards?.forEach(p=>{let{Card:i}=Zo("@libxai/core");n.set(p.id,new i(p));});let m=null;if(t?.board){let{Board:p}=Zo("@libxai/core");m=new p(t.board);}r.current=new core.BoardStore({board:m,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Nm.Provider,{value:{store:o},children:e})}function Yn(){let e=react.useContext(Nm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function qo(){let e=Yn(),[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 m=react.useCallback(v=>{e.updateBoard(v);},[e]),p=react.useCallback(v=>{e.addColumn(v);},[e]),i=react.useCallback((v,l)=>{e.updateColumn(v,l);},[e]),u=react.useCallback(v=>{e.deleteColumn(v);},[e]),d=react.useCallback(v=>e.getColumn(v),[e]),g=react.useCallback(v=>{e.addCard(v);},[e]),f=react.useCallback((v,l)=>{e.updateCard(v,l);},[e]),C=react.useCallback(v=>{e.deleteCard(v);},[e]),T=react.useCallback((v,l,x)=>{e.moveCard(v,l,x);},[e]),c=react.useCallback(v=>e.getCard(v),[e]),b=react.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:p,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:f,deleteCard:C,moveCard:T,getCard:c,getCardsByColumn:b}}function Em(e){let{cards:t}=qo();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 Pm(e="position",t="asc"){let{cards:a}=qo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?m[o.priority]:0,i=s.priority?m[s.priority]:0;n=p-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 qn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nl.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 m=await Promise.resolve(n.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{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);}},Vh=new qn;function Am({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:m=0,getItemKey:p}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:m}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:f,children:d.map(C=>{let T=e[C.index];if(!T)return null;let c=p?p(T,C.index):C.index,b={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsxRuntime.jsx("div",{style:b,"data-index":C.index,children:r(T,C.index)},c)})})})}function Fm(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 Im({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:m=16,getItemKey:p,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:m}),g=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:f,className:s,children:jsxRuntime.jsx("div",{style:C,children:g.map(T=>{let c=e[T.index];if(!c)return null;let b=p?p(c,T.index):T.index,v={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":T.index,children:o(c,T.index)},b)})})})}function Bm(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 Rm(e,t=10){return e>t}var Zi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Qi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},el={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},tl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},rl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ol={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},nl={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)"},sl={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)"},il={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ll={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}},dl={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}},Xn={spacing:Zi,borderRadius:Qi,fontSize:el,fontWeight:tl,lineHeight:al,zIndex:rl,duration:ol,easing:nl,shadows:sl,opacity:il,kanban:ll,gantt:dl};function $m(e,t,a){return e[t]??a}function cl(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)?cl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Yh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ml(e="asakaa"){let t=cl(Xn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Yh(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
390
390
|
${a.join(`
|
|
391
391
|
`)}
|
|
392
392
|
}`}function Xo(e,t="asakaa"){let a=[],r=cl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
@@ -416,5 +416,5 @@ ${Xo(ul,"asakaa").split(`
|
|
|
416
416
|
`)}
|
|
417
417
|
}
|
|
418
418
|
`}var qh=({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 zm({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=go();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,m])=>{let p=n,i=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":i,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(qh,{theme:p})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},p)})})}
|
|
419
|
-
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=dm;exports.AI_FEATURES=Sh;exports.AI_MODELS=Vi;exports.AddCardButton=Ns;exports.AddColumnButton=Ts;exports.AttachmentUploader=dr;exports.BoardProvider=Dm;exports.BulkOperationsToolbar=fn;exports.BurnDownChart=$s;exports.CalendarBoard=Kc;exports.Card=pr;exports.CardDetailModal=As;exports.CardDetailModalV2=Is;exports.CardHistoryReplay=em;exports.CardHistoryTimeline=
|
|
419
|
+
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=dm;exports.AI_FEATURES=Sh;exports.AI_MODELS=Vi;exports.AddCardButton=Ns;exports.AddColumnButton=Ts;exports.AttachmentUploader=dr;exports.BoardProvider=Dm;exports.BulkOperationsToolbar=fn;exports.BurnDownChart=$s;exports.CalendarBoard=Kc;exports.Card=pr;exports.CardDetailModal=As;exports.CardDetailModalV2=Is;exports.CardHistoryReplay=em;exports.CardHistoryTimeline=Zc;exports.CardRelationshipsGraph=rm;exports.CardStack=yh;exports.CardTemplateSelector=_s;exports.CircuitBreaker=ns;exports.Column=io;exports.ColumnManager=wn;exports.CommandPalette=Es;exports.ConfigMenu=Ys;exports.ContextMenu=yo;exports.DEFAULT_SHORTCUTS=Io;exports.DEFAULT_TEMPLATES=Gs;exports.DateRangePicker=No;exports.DependenciesSelector=So;exports.DependencyLine=Pn;exports.DistributionCharts=Os;exports.EditableColumnTitle=us;exports.ErrorBoundary=co;exports.ExportImportModal=js;exports.FilterBar=Ks;exports.GANTT_AI_SYSTEM_PROMPT=Nc;exports.GanttAIAssistant=In;exports.GanttBoard=kc;exports.GanttI18nContext=ho;exports.GanttMilestone=An;exports.GanttToolbar=kn;exports.GenerateGanttTasksDialog=pm;exports.GeneratePlanModal=sm;exports.GroupBySelector=Hs;exports.KanbanBoard=Sr;exports.KanbanToolbar=ws;exports.KanbanViewAdapter=Ao;exports.KeyboardShortcutsHelp=Ws;exports.ListView=$c;exports.MenuIcons=zt;exports.PluginManager=qn;exports.PrioritySelector=Or;exports.RATE_LIMITS=Dh;exports.SwimlaneBoardView=zs;exports.TagBadge=fs;exports.TagList=td;exports.TagPicker=nr;exports.TaskBar=Dn;exports.TaskDetailModal=Gr;exports.TaskFormModal=Tc;exports.TaskGrid=Nn;exports.ThemeModal=Zs;exports.ThemeProvider=zd;exports.ThemeSwitcher=zm;exports.Timeline=Ln;exports.UserAssignmentSelector=Ur;exports.VelocityChart=Rs;exports.VirtualGrid=Im;exports.VirtualList=Am;exports.aiUsageTracker=Zr;exports.borderRadius=Qi;exports.calculatePosition=en;exports.calendarDarkTheme=Ui;exports.calendarEnTranslations=Fi;exports.calendarEsTranslations=Li;exports.calendarLightTheme=Hi;exports.calendarNeutralTheme=Wi;exports.calendarThemes=_n;exports.calendarTranslations=Hn;exports.cardToGanttTask=Rn;exports.cardsToGanttTasks=Fc;exports.cn=h;exports.createKanbanView=yd;exports.createRetryWrapper=ip;exports.darkTheme=qs;exports.darkTokenTheme=Jn;exports.defaultTheme=bn;exports.designTokens=Xn;exports.duration=ol;exports.easing=nl;exports.exportTokensToCSS=Om;exports.findTaskByName=br;exports.fontSize=el;exports.fontWeight=tl;exports.formatCost=jo;exports.ganttEnTranslations=vn;exports.ganttEsTranslations=Hd;exports.ganttTaskToCardUpdate=Ac;exports.ganttThemes=Je;exports.ganttTokens=dl;exports.ganttTranslations=Qs;exports.ganttUtils=he;exports.generateCSSVariables=ml;exports.generateCompleteCSS=gl;exports.generateInitialPositions=rp;exports.generateTasksContext=Dc;exports.generateThemeVariables=Xo;exports.getCalendarTheme=Yc;exports.getCalendarTranslations=Ho;exports.getListViewTheme=Oc;exports.getListViewTranslations=Ei;exports.getMonthNames=zc;exports.getToken=$m;exports.getTranslations=Wd;exports.getWeekdayNames=Uc;exports.kanbanTokens=ll;exports.lightTheme=Xs;exports.lightTokenTheme=pl;exports.lineHeight=al;exports.listViewDarkTheme=Pi;exports.listViewEnTranslations=Di;exports.listViewEsTranslations=Si;exports.listViewLightTheme=Mi;exports.listViewNeutralTheme=Ai;exports.listViewThemes=Un;exports.listViewTranslations=$n;exports.mergeCalendarTranslations=Wn;exports.mergeListViewTranslations=On;exports.mergeTranslations=ei;exports.neutralTheme=Js;exports.neutralTokenTheme=ul;exports.opacity=il;exports.parseLocalCommand=Pc;exports.parseNaturalDate=Ci;exports.parseNaturalDuration=Ti;exports.parseProgress=Ni;exports.parseStatus=Ec;exports.pluginManager=Vh;exports.retrySyncOperation=sp;exports.retryWithBackoff=tn;exports.shadows=sl;exports.shouldVirtualizeGrid=Rm;exports.spacing=Zi;exports.themes=jr;exports.useAI=km;exports.useBoard=gm;exports.useBoardCore=qo;exports.useBoardStore=Yn;exports.useCardStacking=Tm;exports.useDragState=xs;exports.useFilteredCards=Em;exports.useFilters=bm;exports.useGanttI18n=bo;exports.useKanbanState=Kn;exports.useKeyboardShortcuts=Rd;exports.useMultiSelect=wm;exports.useSelectionState=Yi;exports.useSortedCards=Pm;exports.useTheme=go;exports.useVirtualGrid=Bm;exports.useVirtualList=Fm;exports.validateAIResponse=Mc;exports.withErrorBoundary=Ds;exports.wouldCreateCircularDependency=rn;exports.zIndex=rl;//# sourceMappingURL=index.cjs.map
|
|
420
420
|
//# sourceMappingURL=index.cjs.map
|