@libxai/board 0.17.123 → 0.17.125
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 +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +141 -141
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'),rd=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),ep=require('react-markdown'),tp=require('remark-gfm'),ap=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rd__default=/*#__PURE__*/_interopDefault(rd);var ep__default=/*#__PURE__*/_interopDefault(ep);var tp__default=/*#__PURE__*/_interopDefault(tp);var ap__default=/*#__PURE__*/_interopDefault(ap);var so=(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 io=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 [io.Translate.toString(e),io.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function k(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function lo(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
|
|
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'),rd=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),ep=require('react-markdown'),tp=require('remark-gfm'),ap=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rd__default=/*#__PURE__*/_interopDefault(rd);var ep__default=/*#__PURE__*/_interopDefault(ep);var tp__default=/*#__PURE__*/_interopDefault(tp);var ap__default=/*#__PURE__*/_interopDefault(ap);var so=(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 io=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 [io.Translate.toString(e),io.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function k(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function lo(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 zc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function cn(e,t){return e.length===0?1e3:t===0?lo(null,e[0].position):t>=e.length?lo(e[e.length-1].position,null):lo(e[t-1].position,e[t].position)}function bi(e,t=100){return e>t}var $c=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 Wc(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 co(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:d=$c,onRetry:c}=t,m,n=0;for(let p=1;p<=a;p++){n=p;try{return {data:await e(),attempts:n,success:!0}}catch(l){if(m=l,p===a||!d(m,p))return {error:m,attempts:n,success:false};let u=Wc(p,r,o,s);if(c)try{c(m,p,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:m||new Error("Unknown error"),attempts:n,success:false}}function Gc(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 Hc(e,t={}){return async(...a)=>co(()=>e(...a),t)}var mn=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 hi=(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))(hi||{}),Ka=class Ka{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...d}=t,c=`[${a}] [${r}] [${s}]`,m=Object.keys(d).length>0;switch(r){case "DEBUG":console.debug(c,o,m?d:"");break;case "INFO":console.info(c,o,m?d:"");break;case "WARN":console.warn(c,o,m?d:"");break;case "ERROR":console.error(c,o,m?d:""),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",...Ka.globalOptions};}static configure(t){Ka.globalOptions={...Ka.globalOptions,...t};}child(t){return new Ka({...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 mo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new mo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:hi[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ka.globalOptions={};var pn=Ka,mo=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}},yi=new pn;function Vc(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 jc(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 d=e.columns.find(c=>c.id===s.columnId);return [s.id,un(s.title),un(s.description||""),un(d?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
2
|
`)}async function Kc(e,t,a){let r=t;if(!r){let d=document.querySelector(".asakaa-board");d&&(r=d.parentElement||d);}if(r)try{let d=await rd__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=d.toDataURL("image/png"),m=297,n=210,p=d.width/d.height,l=m-20,i=l/p;i>n-20&&(i=n-20,l=i*p);let u=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});u.setFontSize(16),u.setTextColor(255,255,255),u.setFillColor(10,10,10),u.rect(0,0,m,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(m-l)/2;return u.addImage(c,"PNG",v,20,l,i),u}catch(d){console.error("Error capturing board:",d);}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(d=>{let c=e.cards.filter(m=>m.columnId===d.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(d.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(m.description,160);o.text(p,25,s),s+=p.length*5;}let n=[];if(m.priority&&n.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&n.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&n.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let p=[];m.startDate&&p.push(`Start: ${m.startDate}`),m.endDate&&p.push(`End: ${m.endDate}`),n.push(p.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function un(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function xi(e,t,a,r){switch(t){case "json":return Vc(e,r);case "csv":return jc(e);case "pdf":return await Kc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ki(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,d={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:d[t]}),m=URL.createObjectURL(c),n=document.createElement("a");n.href=m,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(m);}function Yc(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 qc(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=wi(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=wi(t[d]||"");if(c.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let p=n.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let l=o.get(p),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(c){s.push(`Line ${d+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function wi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Ci(e,t){switch(t){case "json":return Yc(e);case "csv":return qc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Ti(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 gn=react.createContext(null);function Di(){return react.useContext(gn)}var Ni=react.createContext(null);function Si({children:e,themeName:t}){return jsxRuntime.jsx(Ni.Provider,{value:{themeName:t},children:e})}function pr(){return react.useContext(Ni)}function Ke({children:e,container:t}){let[a,r]=react.useState(false),o=Di(),s=pr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:m}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:n,children:e}),d)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var Ii={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},rm="#BDC3C7",om=({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 Ya({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null),n=()=>{if(!m.current)return;let u=m.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let C=v-u.bottom,D=u.top,h;C>=x+b?h=u.bottom+b:D>=x+b?h=u.top-x-b:h=C>=D?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};react.useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!m.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},l=e?Ii[e]:null,i=l?.color||rm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):n(),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?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Ii).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>p(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter: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(om,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&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"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.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 nm=[{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 Fr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),i=(pr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),C=window.innerHeight,D=window.innerWidth,h=320,A=380,w=4,L=g.left;L+h>D-10&&(L=D-h-10),L<10&&(L=10);let T=C-g.bottom,$=g.top,H;T>=A+w?H=g.bottom+w:$>=A+w?H=g.top-A-w:H=T>=$?g.bottom+w:Math.max(10,g.top-A-w),c({top:H,left:L}),s(true);};react.useEffect(()=>{let g=C=>{m.current&&!m.current.contains(C.target)&&!n.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let C=new Date,D=L=>{let T=L.getFullYear(),$=String(L.getMonth()+1).padStart(2,"0"),H=String(L.getDate()).padStart(2,"0");return `${T}-${$}-${H}`},h=D(C),A=new Date(C);A.setDate(A.getDate()+g);let w=D(A);a(h,w),s(false);},f=()=>{if(!e||!t)return "Set date";let g=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=A.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let L=w[0],T=w[1],$=w[2];return L===void 0||T===void 0||$===void 0?null:new Date(L,T-1,$)},C=g(e),D=g(t);if(!C||!D||isNaN(C.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[C.getMonth()]} ${C.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),g<C})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"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:i?"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:i?"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:nm.map(g=>jsxRuntime.jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"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:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Xa({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=react.useState(false),[c,m]=react.useState(""),[n,p]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,C=window.innerWidth,D=300,h=380,A=4,w=b.right-D;w<10&&(w=b.left),w+D>C-10&&(w=C-D-10);let L=g-b.bottom,T=b.top,$;L>=h+A?$=b.bottom+A:T>=h+A?$=b.top-h-A:$=L>=T?b.bottom+A:Math.max(10,b.top-h-A),p({top:$,left:w}),d(true);};react.useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),m(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),m(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(C=>C.id===b.id);a(g?e.filter(C=>C.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?d(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[y.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(Ke,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:f.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"}):f.map(b=>{let g=e.some(C=>C.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),g&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(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 po(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let n=m.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(m.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,c=m=>{if(!s.has(m)){s.add(m),d.add(m);let n=r.get(m)||[];for(let p of n){if(!s.has(p)&&c(p))return true;if(d.has(p))return true}}return d.delete(m),false};return c(a)}function Rr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[c,m]=react.useState(false),[n,p]=react.useState(""),[l,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[f,y]=react.useState(null),x=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,$=300,H=l?380:120,U=4,E=w.right-$;E<10&&(E=w.left),E+$>T-10&&(E=T-$-10);let J=L-w.bottom,ge=w.top,ke;J>=H+U?ke=w.bottom+U:ge>=H+U?ke=w.top-H-U:ke=J>=ge?w.bottom+U:Math.max(10,w.top-H-U),v({top:ke,left:E}),m(true);};react.useEffect(()=>{if(!c||!b.current)return;let w=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,$=300,H=l?380:120,U=4,E=w.right-$;E<10&&(E=w.left),E+$>T-10&&(E=T-$-10);let J=L-w.bottom,ge=w.top,ke;J>=H+U?ke=w.bottom+U:ge>=H+U?ke=w.top-H-U:ke=J>=ge?w.bottom+U:Math.max(10,w.top-H-U),v({top:ke,left:E});},[l,c]),react.useEffect(()=>{let w=L=>{x.current&&!x.current.contains(L.target)&&!b.current?.contains(L.target)&&(m(false),p(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=L=>{L.key==="Escape"&&(m(false),p(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let C=w=>{let L=t.includes(w),T=a.find($=>$.id===w);if(y(null),L){let $=t.filter(H=>H!==w);r($),$.length===0&&i(false);}else {if(s&&po(a,w,e)){let H=`Cannot add "${T?.title||w}" as dependency - would create circular reference`;y(H),d?.(w,T?.title||w),setTimeout(()=>y(null),3e3);return}r([...t,w]),i(true);}},D=()=>{let w=!l;i(w),w||r([]);},h=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(n.toLowerCase())||w.id.toLowerCase().includes(n.toLowerCase())),A=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?m(false):g(),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:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),c&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.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:[f&&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:f})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:w=>p(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:h.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"}):h.map(w=>{let L=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>C(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.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([]),i(false),m(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 Sa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:c=[],allCards:m=[]})=>{let{attributes:n,listeners:p,setNodeRef:l,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:io.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:l,style:f,...n,...p,onClick:()=>a?.(e),children:t(e)});let y=c.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:b,className:k("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...p,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.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:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ya,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Fr,{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:(g,C)=>d?.(e.id,{startDate:g,endDate:C})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Xa,{assignedUsers:y,availableUsers:c,onChange:g=>d?.(e.id,{assignedUserIds:g.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Rr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:m,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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));Sa.displayName="Card";var uo={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"}},Gi=({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 Hi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),p=[...Object.entries(uo).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(uo).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=uo[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...uo.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,C=280,D=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let A=x-y.bottom,w=y.top,L;A>=C+D?L=y.bottom+D:w>=C+D?L=y.top-C-D:L=A>=w?y.bottom+D:Math.max(10,y.top-C-D),c({top:L,left:h}),s(true);};react.useEffect(()=>{let y=x=>{m.current&&!m.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsxRuntime.jsx(Gi,{icon:v.icon,color:f})}),o&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(y=>jsxRuntime.jsxs("button",{onClick:()=>u(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Gi,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function _i({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=react.useState(false),[c,m]=react.useState(false),[n,p]=react.useState(e),[l,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=C=>{u.current&&!u.current.contains(C.target)&&!v.current?.contains(C.target)&&(d(false),m(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=C=>{C.key==="Escape"&&(d(false),m(false),p(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]);let y=()=>{m(true),p(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),m(false),d(false),p(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(m(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>d(!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(Ke,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:f,type:"text",value:n,onChange:g=>p(g.target.value),onKeyDown:b,onBlur:x,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:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),d(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var fr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:c,availableUsers:m,allCards:n,enableVirtualization:p,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),D=p??bi(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:x,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),L=w.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:k("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",x),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:k(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||f)&&jsxRuntime.jsx(_i,{columnTitle:e.title,onRename:$=>v?.(e.id,$),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map($=>$.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map($=>{let H=t[$.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsxRuntime.jsx(Sa,{card:H,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:n})},H.id):null})}):t.map($=>jsxRuntime.jsx(Sa,{card:$,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:n},$.id))})})]})});fr.displayName="Column";function vn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let p=s.trim();p&&p!==e?t(p):d(e),o(false);},n=p=>{p.key==="Enter"?m():p.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:p=>d(p.target.value),onBlur:m,onKeyDown:n,className:k("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:k("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function kn(){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 Ua({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:m,error:n,children:p}){let[l,i]=kn(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=react.useCallback((T,$)=>{t.onCardUpdate?.(T,$);},[t]),x=react.useCallback((T,$)=>{t.onColumnUpdate?.(T,{title:$});},[t]),b=react.useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],C=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let T=new Map;return e.columns.forEach($=>{let H=$.cardIds.map(U=>e.cards.find(E=>E.id===U)).filter(U=>U!==void 0).sort((U,E)=>U.position-E.position);T.set($.id,H);}),T},[e.cards,e.columns]),h=react.useCallback(T=>{let{active:$}=T,H=e.cards.find(U=>U.id===$.id);H&&i({isDragging:true,draggedCardId:H.id,sourceColumnId:H.columnId,targetColumnId:H.columnId});},[e.cards,i]),A=react.useCallback(T=>{let{active:$,over:H}=T;if(!H||!e.cards.find(J=>J.id===$.id))return;let E=null;H.data.current?.type==="column"?E=H.id:H.data.current?.type==="card"&&(E=e.cards.find(ge=>ge.id===H.id)?.columnId||null),E&&E!==l.targetColumnId&&i({...l,targetColumnId:E});},[e.cards,l,i]),w=react.useCallback(async T=>{let{active:$,over:H}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!H)return;let U=e.cards.find(ke=>ke.id===$.id);if(!U)return;let E,J;if(H.data.current?.type==="column"){E=H.id;let ke=D.get(E)||[];J=cn(ke,0);}else {let ke=e.cards.find(de=>de.id===H.id);if(!ke)return;E=ke.columnId;let Le=D.get(E)||[],Ee=Le.findIndex(de=>de.id===H.id);J=cn(Le,Ee);}let ge=e.columns.find(ke=>ke.id===E);if(ge&&ge.wipLimit&&ge.wipLimitType==="hard"){let ke=D.get(E)||[];if(U.columnId!==E&&ke.length>=ge.wipLimit){t.onWipLimitExceeded?.(ge,U);return}}(U.columnId!==E||U.position!==J)&&await t.onCardMove?.(U.id,E,J);},[e.cards,e.columns,D,t,i]),L=react.useCallback(T=>{a?.(T);},[a]);return m?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:c,children:jsxRuntime.jsx(Pm,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Si,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:C,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:A,onDragEnd:w,children:[jsxRuntime.jsxs("div",{className:k("asakaa-board",f,d),style:c,"data-theme":u,children:[e.columns.sort((T,$)=>T.position-$.position).map(T=>{let $=D.get(T.id)||[],H=!g.includes(T.id);return jsxRuntime.jsx(fr,{column:T,cards:$,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:L,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:H,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(Sa,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Pm({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 Fm={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)"},Bm={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)"},Rm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Om={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Um({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=p=>{c.current&&!c.current.contains(p.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let m=n=>{t(n),d(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!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((n,p)=>n.position-p.position).map((n,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.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:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function $m({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=react.useState(false),[c,m]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){m(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{m(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===u.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"})}):u.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:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function zm({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 Cn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:c,onExportExcel:m,translations:n}){let p=r==="dark"?Fm:Bm,l={...o==="es"?Rm:Om,...n},i=d||c||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($m,{theme:p,t:l,onExportCSV:d,onExportJSON:c,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(Um,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsxRuntime.jsx(zm,{onClick:()=>t(),label:a||l.newTask}))]})})}function Dn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=react.useState(false),[c,m]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),m(""),d(false));},[c,e]),p=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(m(""),d(false));},[n]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:k("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>m(i.target.value),onKeyDown:p,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),d(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:k("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>d(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 Nn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:c="dark",locale:m="es"}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState([]),[x,b]=react.useState(""),[g,C]=react.useState(""),[D,h]=react.useState(""),[A,w]=react.useState(false),[L,T]=react.useState(false),[$,H]=react.useState(false),U=react.useRef(null),E=react.useRef(null),J={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ge=react.useCallback(()=>{v(""),y([]),b(""),C(""),h(""),w(false),T(false),H(false),p(false);},[]);react.useEffect(()=>{n&&U.current&&U.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let S=F=>{E.current&&!E.current.contains(F.target)&&(u.trim()||ge());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n,u,ge]);let ke=react.useCallback(async()=>{let S=u.trim();if(!(!S||l)){i(true);try{await t({name:S,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),v(""),y([]),b(""),C(""),h(""),w(!1),T(!1),H(!1),U.current?.focus();}catch(F){console.error("Error creating card:",F);}finally{i(false);}}},[u,e,f,x,g,D,t,l]),Le=react.useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),ke()):S.key==="Escape"&&ge();},[ke,ge]),Ee=react.useCallback(S=>{y(F=>F.includes(S)?F.filter(M=>M!==S):[...F,S]);},[]),de=c==="dark";return n?jsxRuntime.jsxs("div",{ref:E,className:k("rounded-lg overflow-hidden shadow-lg",de?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:U,type:"text",value:u,onChange:S=>v(S.target.value),onKeyDown:Le,placeholder:J.placeholder,disabled:l,className:k("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",de?"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(!A),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||f.length>0?"bg-emerald-500/20 text-emerald-400":de?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:J.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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>T(!L),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||x||g?"bg-blue-500/20 text-blue-400":de?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:J.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!$),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",$||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":de?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:J.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:ke,disabled:!u.trim()||l,className:k("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):J.save})]})]}),A&&a.length>0&&jsxRuntime.jsx("div",{className:k("px-3 pb-3 pt-0","border-t",de?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(S=>jsxRuntime.jsxs("button",{onClick:()=>Ee(S.id),className:k("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(S.id)?"bg-emerald-500 text-white":de?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[S.avatar?jsxRuntime.jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),L&&jsxRuntime.jsx("div",{className:k("px-3 pb-3 pt-0","border-t",de?"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:k("block text-[10px] uppercase tracking-wide mb-1",de?"text-gray-500":"text-gray-400"),children:J.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:S=>b(S.target.value),className:k("w-full px-2 py-1.5 rounded text-xs border",de?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:k("block text-[10px] uppercase tracking-wide mb-1",de?"text-gray-500":"text-gray-400"),children:J.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:S=>C(S.target.value),className:k("w-full px-2 py-1.5 rounded text-xs border",de?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),$&&jsxRuntime.jsx("div",{className:k("px-3 pb-3 pt-0","border-t",de?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(S=>jsxRuntime.jsx("button",{onClick:()=>h(D===S?"":S),className:k("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:de?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:J[S]},S))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:d,className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",de?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"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:J.buttonLabel})]})}var Wr=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(Ua,{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(d=>{d?o(d):s(new Error("Failed to create PNG blob"));},"image/png");})}};function rl(e={}){return new Wr(e)}var br=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(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:d}=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:d?`Error in ${d}`:"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 Sn(e,t){let a=r=>jsxRuntime.jsx(br,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Pn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:m,shortcut:n="k",className:p=""}){let[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState("home"),[x,b]=react.useState(""),[g,C]=react.useState("");react.useEffect(()=>{let w=L=>{(L.metaKey||L.ctrlKey)&&L.key===n&&(L.preventDefault(),i(T=>!T)),L.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),react.useEffect(()=>{l||(y("home"),v(""),b(""),C(""));},[l]);let D=react.useCallback(()=>{i(false);},[]),h=react.useCallback(w=>{let[L,T]=w.split(":");switch(L){case "create-card":y("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(a?.(T),D()):y("navigate");break;case "search":r?.(u),D();break;case "priority":y("priority");break;case "set-priority":g&&T&&(o?.(g,T),D());break;case "assign":y("assign");break;case "assign-user":g&&T&&(s?.(g,T),D());break;case "ai":y("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":m?.(),D();break;case "back":y("home");break;}},[u,g,t,a,r,o,s,d,c,m,D]),A=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),D());},[x,u,t,D]);return l?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&f==="create-card"&&x&&A();}}),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."}),f==="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:h,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:h,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:h,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:h,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:h,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(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},w.id))})]}),f==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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))})]}),f==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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 L=e.columns.find(T=>T.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:h,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:L?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},w.id)})})]}),f==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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:h,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:h,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 Km(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 Ym(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 qm(e){return e.startsWith("image/")}function Hr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[d,c]=react.useState(false),[m,n]=react.useState(false),[p,l]=react.useState(null),i=react.useRef(null),u=react.useCallback(h=>{let A=[],w=[];return e.length+h.length>s?(w.push(`Maximum ${s} files allowed`),{valid:A,errors:w}):(h.forEach(L=>{if(L.size/1048576>r){w.push(`${L.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>L.type.match($))){w.push(`${L.name} has invalid file type`);return}A.push(L);}),{valid:A,errors:w})},[e.length,s,r,o]),v=react.useCallback(async h=>{let{valid:A,errors:w}=u(h);if(w.length>0){l(w.join(", ")),setTimeout(()=>l(null),5e3);return}if(A.length!==0){n(true),l(null);try{await t?.(A);}catch(L){l(L instanceof Error?L.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{n(false);}}},[u,t]),f=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),y=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),x=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let A=Array.from(h.dataTransfer.files);v(A);},[v]),g=react.useCallback(h=>{let A=h.target.files?Array.from(h.target.files):[];v(A),i.current&&(i.current.value="");},[v]),C=react.useCallback(()=>{i.current?.click();},[]),D=react.useCallback(h=>{confirm("Are you sure you want to delete this attachment?")&&a?.(h);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${m?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:C,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?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:d?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(h=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:qm(h.type)&&h.url?jsxRuntime.jsx("img",{src:h.thumbnailUrl||h.url,alt:h.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Ym(h.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:h.name,children:h.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Km(h.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(h.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(h.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"})})})]},h.id))})]})}function An({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:m=[],attachments:n=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=react.useState("details"),[C,D]=react.useState(false),[h,A]=react.useState({}),[w,L]=react.useState(""),[T,$]=react.useState(false),[H,U]=react.useState({});if(!t||!e)return null;let E=react.useCallback(()=>{D(false),A({}),g("details"),L(""),U({}),a();},[a]),J=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),A({}),D(false));},[e.id,h,r]),ge=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),E());},[e.id,o,E]),ke=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),L(""));},[e.id,w,p]),Le=react.useCallback(async()=>{if(v){$(true);try{let M=await v(e);U(V=>({...V,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{$(false);}}},[e,v]),Ee=react.useCallback(async()=>{if(f){$(true);try{let M=await f(e);U(V=>({...V,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{$(false);}}},[e,f]),de=react.useCallback(async()=>{if(y){$(true);try{let M=await y(e);U(V=>({...V,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{$(false);}}},[e,y]),S={...e,...h},F=s.filter(M=>S.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:E,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:h.title??S.title,onChange:M=>A({...h,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:S.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:J,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),A({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ge,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:E,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:()=>g("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),C?jsxRuntime.jsx("textarea",{value:h.description??S.description??"",onChange:M=>A({...h,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:S.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??S.assignedUserIds??[],onChange:M=>{let V=Array.from(M.target.selectedOptions,P=>P.value);A({...h,assignedUserIds:V});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:F.length>0?F.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxRuntime.jsxs("select",{value:h.priority??S.priority??"",onChange:M=>A({...h,priority:M.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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:S.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:S.labels&&S.labels.length>0?S.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:"",onChange:M=>A({...h,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.startDate?new Date(S.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:"",onChange:M=>A({...h,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.endDate?new Date(S.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??S.estimatedTime??"",onChange:M=>A({...h,estimatedTime:M.target.value?parseFloat(M.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:S.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:S.dependencies&&S.dependencies.length>0?S.dependencies.map(M=>{let V=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",V.slice(-4)]},V)}):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:S.createdAt?new Date(S.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:M=>L(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ke,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(M=>{let V=s.find(P=>P.id===M.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:[V&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:V.color},children:V.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:V?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(M.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:M.content})]},M.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(M=>{let V=s.find(P=>P.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:V?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Hr,{cardId:e.id,attachments:n,onUpload:i?M=>i(e.id,M):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Le,disabled:T||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Ee,disabled:T||!f,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:de,disabled:T||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((M,V)=>{let P=s.find(W=>W.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[P&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:P?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},V)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((M,V)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},V))]}),H.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&m.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 _r({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:d=""}){let[c,m]=react.useState({top:0,left:0}),n=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,f=l.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let y=i-l.bottom,x=l.top,b;return y>=s+v?b=l.bottom+v:x>=s+v?b=l.top-s-v:y>=x?b=l.bottom+v:b=Math.max(10,l.top-s-v),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&m(p());},[t,p]),react.useEffect(()=>{if(!t)return;let l=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${d}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var rp=["LOW","MEDIUM","HIGH","URGENT"],op=["todo","in-progress","review","done"];function Fn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:m,onDeleteComment:n,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:f=[],onUploadCoverImage:y,unsplashAccessKey:x,theme:b,onSubtasksChange:g}){let C=pr(),D=b||C?.themeName||"dark",[h,A]=react.useState(e),[w,L]=react.useState(false),[T,$]=react.useState(e?.subtasks||[]),[H,U]=react.useState(false),[E,J]=react.useState(""),[ge,ke]=react.useState(""),[Le,Ee]=react.useState("all"),[de,S]=react.useState(false),[F,M]=react.useState(false),[V,P]=react.useState(false),[W,le]=react.useState(false),[te,Se]=react.useState(false),[ne,Ve]=react.useState(false),be=react.useRef(null),tt=react.useRef(null),Tt=react.useRef(null),Dt=react.useRef(null),yt=react.useRef(null),Nt=react.useRef(null),Mt=react.useRef(null),ra=react.useRef(null),mt=react.useRef(null),rt=react.useRef(null),Lt=react.useRef(null),Ht=react.useRef(null);react.useEffect(()=>{e&&!h?(A({...e}),$(e.subtasks||[])):e&&h&&e.id!==h.id&&(A({...e}),$(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let R=ie=>{let Ae=ie.target;Dt.current&&!Dt.current.contains(Ae)&&S(false),yt.current&&!yt.current.contains(Ae)&&M(false),Nt.current&&!Nt.current.contains(Ae)&&P(false),Mt.current&&!Mt.current.contains(Ae)&&le(false);};if(de||F||V||W)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[de,F,V,W]),react.useEffect(()=>{if(!t)return;let R=ie=>{let Ae=ie.target,at=Ae.tagName==="INPUT"||Ae.tagName==="TEXTAREA"||Ae.isContentEditable;if(ie.key==="Escape"){ie.preventDefault(),de||F||V||W||te||ne?(S(false),M(false),P(false),le(false),Se(false),Ve(false)):at||a();return}if(at&&ie.key!=="Escape")return;let De=ie.metaKey||ie.ctrlKey;switch(ie.key.toLowerCase()){case "s":ie.preventDefault(),S(true);break;case "a":ie.preventDefault(),P(true);break;case "p":ie.preventDefault(),M(true);break;case "l":ie.preventDefault(),le(true);break;case "d":De||(ie.preventDefault(),Se(true),setTimeout(()=>ra.current?.focus(),0));break;case "e":De||(ie.preventDefault(),Ve(true));break;case "i":ie.preventDefault(),L(true),setTimeout(()=>tt.current?.focus(),0);break;case "t":ie.preventDefault(),U(true);break;case "c":ie.preventDefault(),Tt.current?.focus();break}};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t,a,de,F,V,W,te,ne]);let we=react.useCallback(R=>{let ie=R.currentTarget.textContent?.trim()||"";if(h&&ie!==h.title){let Ae={...h,title:ie};A(Ae),r?.(h.id,{title:ie});}},[h,r]),O=react.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),R.currentTarget.blur()),R.key==="Escape"&&(R.preventDefault(),R.currentTarget.textContent=h?.title||"",R.currentTarget.blur());},[h]),Te=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),L(false);},[h,e,r]),$e=react.useCallback(R=>{if(h){let ie={...h,columnId:R};A(ie),r?.(h.id,{columnId:R}),S(false);}},[h,r]),Ue=react.useCallback(R=>{if(h){let ie={...h,priority:R};A(ie),r?.(h.id,{priority:R}),M(false);}},[h,r]),pt=react.useCallback(R=>{if(h){let ie=h.assignedUserIds||[],Ae=ie.includes(R)?ie.filter(De=>De!==R):[...ie,R],at={...h,assignedUserIds:Ae};A(at),r?.(h.id,{assignedUserIds:Ae});}},[h,r]),X=react.useCallback(R=>{if(h){let ie=h.labels||[],Ae=ie.includes(R)?ie.filter(De=>De!==R):[...ie,R],at={...h,labels:Ae};A(at),r?.(h.id,{labels:Ae});}},[h,r]),Q=react.useCallback(R=>{if(h){let ie=R.target.value,Ae={...h,endDate:ie};A(Ae),r?.(h.id,{endDate:ie}),Se(false);}},[h,r]),ve=react.useCallback(R=>{if(h){let ie={...h,estimatedTime:parseFloat(R)||0};A(ie),r?.(h.id,{estimatedTime:parseFloat(R)||0});}},[h,r]),fe=react.useCallback(()=>{if(E.trim()&&h){let R={id:`subtask-${Date.now()}`,title:E.trim(),completed:false,createdAt:new Date},ie=[...T,R];$(ie),J(""),U(false),g?.(h.id,ie);}},[E,T,h,g]),ee=react.useCallback(R=>{let ie=T.map(Ae=>Ae.id===R?{...Ae,completed:!Ae.completed,updatedAt:new Date}:Ae);$(ie),h&&g?.(h.id,ie);},[T,h,g]),Ce=react.useCallback(R=>{let ie=T.filter(Ae=>Ae.id!==R);$(ie),h&&g?.(h.id,ie);},[T,h,g]),B=react.useCallback(()=>{ge.trim()&&h&&m&&(m(h.id,ge.trim()),ke(""));},[ge,h,m]),G=react.useCallback(R=>{(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),B());},[B]),K=R=>jsxRuntime.jsx(ep__default.default,{remarkPlugins:[tp__default.default],rehypePlugins:[ap__default.default],components:{a:({node:ie,...Ae})=>jsxRuntime.jsx("a",{...Ae,target:"_blank",rel:"noopener noreferrer"})},children:R}),oe=c.filter(R=>Le==="comments"?R.type.includes("COMMENT"):Le==="history"?!R.type.includes("COMMENT"):true);if(!t||!e)return null;let q=h||e,xe=s.filter(R=>q.assignedUserIds?.includes(R.id)),se=T.filter(R=>R.completed).length;return jsxRuntime.jsx(Ke,{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:R=>R.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:be,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:we,onKeyDown:O,children:q.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:Dt,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>S(!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("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:q.columnId||"No status"})]}),jsxRuntime.jsx(_r,{triggerRef:mt,isOpen:de,onClose:()=>S(false),width:250,estimatedHeight:200,children:(v.length>0?v:op.map(R=>({id:R,title:R}))).map(R=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===R.id?"active":""}`,onClick:()=>$e(R.id),children:R.title},R.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Nt,children:[jsxRuntime.jsxs("button",{ref:rt,className:"modal-v2-field",onClick:()=>P(!V),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:xe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:xe.map(R=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:R.color},title:R.name,children:R.initials},R.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(_r,{triggerRef:rt,isOpen:V,onClose:()=>P(false),width:280,estimatedHeight:300,children:s.map(R=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(R.id)?"active":""}`,onClick:()=>pt(R.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:R.color},children:R.initials}),R.name,q.assignedUserIds?.includes(R.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"})})]},R.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:yt,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>M(!F),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:q.priority||"None"})]}),jsxRuntime.jsxs(_r,{triggerRef:Lt,isOpen:F,onClose:()=>M(false),width:180,estimatedHeight:220,children:[rp.map(R=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${R.toLowerCase()} ${q.priority===R?"active":""}`,onClick:()=>Ue(R),children:R},R)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ue(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Mt,children:[jsxRuntime.jsxs("button",{ref:Ht,className:"modal-v2-field",onClick:()=>le(!W),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:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(_r,{triggerRef:Ht,isOpen:W,onClose:()=>le(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(R=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(R)?"active":""}`,onClick:()=>X(R),children:[R,q.labels?.includes(R)&&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"})})]},R))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Se(!te),setTimeout(()=>ra.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:q.endDate?new Date(q.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ra,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let R=new Date(q.endDate),ie=R.getUTCFullYear(),Ae=String(R.getUTCMonth()+1).padStart(2,"0"),at=String(R.getUTCDate()).padStart(2,"0");return `${ie}-${Ae}-${at}`})():"",onChange:Q,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ve(!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("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:q.estimatedTime?`${q.estimatedTime}h`:"Not set"})]}),ne&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:R=>ve(R.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ve(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"})]}),w?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:R=>{if(h){let ie={...h,description:R.target.value};A(ie);}},onBlur:Te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>L(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:K(q.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"}),T.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[se,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>U(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:[T.map(R=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${R.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ee(R.id),children:R.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:R.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ce(R.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"})]})})]},R.id)),H&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:E,onChange:R=>J(R.target.value),onKeyDown:R=>{R.key==="Enter"&&fe(),R.key==="Escape"&&(U(false),J(""));},onBlur:fe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${Le==="all"?"active":""}`,onClick:()=>Ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="comments"?"active":""}`,onClick:()=>Ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="history"?"active":""}`,onClick:()=>Ee("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ge,onChange:R=>ke(R.target.value),onKeyDown:G,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:B,disabled:!ge.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[oe.map(R=>{let ie=s.find(at=>at.id===R.userId);if(R.type.includes("COMMENT")){let at=d.find(De=>De.id===R.metadata?.commentId);return at?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ie&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ie.color},children:ie.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:ie?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:at.content})]})]},R.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[R.type.includes("CREATED")&&"\u2795",R.type.includes("UPDATED")&&"\u270F\uFE0F",R.type.includes("MOVED")&&"\u27A1\uFE0F",R.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",R.type.includes("ASSIGNED")&&"\u{1F464}",R.type.includes("PRIORITY")&&"\u{1F3AF}",R.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:ie?.name||"Unknown"})," ",R.type.replace(/_/g," ").toLowerCase(),R.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:R.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]})]},R.id)}),oe.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 up({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 Rn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(d=>({...d,average:d.average??e.reduce((c,m)=>c+m.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(up,{})}),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((d,c)=>d+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.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((d,c)=>d+(c.planned||0),0)})]})]})]})}function wp({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 On({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,m=s>0?(s-d)/s*100:0,n=d<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wp,{})}),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:n?"#10B981":"#EF4444",fill:n?"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:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#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:m>=50?"#10B981":"#F59E0B"},children:[m.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:n?"#10B981":"#EF4444"},children:d})]}),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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ap={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},ul=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ip({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),m=t+d*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function gl({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 Un({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,n)=>m+n.value,0),d=e.map(m=>({...m,totalValue:s,color:m.color||Ap[m.name]||ul[e.indexOf(m)%ul.length]})),c=d.map(m=>m.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:d,cx:"50%",cy:"50%",labelLine:false,label:o?Ip:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,n)=>{let p=n.payload,l=s>0?(p.value/s*100).toFixed(0):"0";return `${m} (${p.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:d,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(gl,{})}),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:d.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),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((m,n)=>n.value>m.value?n:m).name})]})]})]})}var xo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[d,c]=react.useState(false),[m,n]=react.useState(false),[p,l]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(C=>C.id),f=C=>{r.onBulkUpdate?.(v,{priority:C}),c(false);},y=C=>{r.onBulkMove?.(v,C),n(false),a();},x=C=>{r.onBulkUpdate?.(v,{assignedUserIds:C}),l(false);},b=C=>{let D=new Set;e.forEach(A=>{A.labels?.forEach(w=>D.add(w));});let h=Array.from(new Set([...D,...C]));r.onBulkUpdate?.(v,{labels:h}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!d),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(C),children:[jsxRuntime.jsx("span",{className:k("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(C.id),children:C.title},C.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([C.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,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"})})]})]})})});xo.displayName="BulkOperationsToolbar";function Op(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,d,c,m,n;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let v=a?.find(f=>f.id===u);d=`assignee-${u}`,c=v?.name||`User ${u}`,m=v?.color,n=v?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m,icon:n}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",m="#6b7280",n="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m,icon:n}),r.get(d).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",d=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,m=i.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:s,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function $n({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),c=react.useMemo(()=>Op(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(n=>{d(p=>{let l=new Set(p);return l.has(n)?l.delete(n):l.add(n),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Ua,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:k("asakaa-swimlane-view",o),children:[c.map(n=>{let p=s.has(n.id),l=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Ua,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var zn=[{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 Wn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),c=zn.find(n=>n.value===e)||zn[0];react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:k("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:k("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:zn.map(n=>jsxRuntime.jsxs("button",{onClick:()=>m(n.value),className:k("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.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:n.label}),e===n.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:n.description})]})]},n.value))})]})]})}var Vr=[{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 zp(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&d&&c&&m}function vl(e={}){let{shortcuts:t=Vr,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 d=react.useCallback(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(n=>n.action!==m);},[]);return react.useEffect(()=>{function m(n){if(!s.current)return;let p=n.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let l of o.current)if(zp(n,l)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Gp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Hp(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 _p(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Hp(e),r=t?Gp(t):"";return a?`${a} + ${r}`:r}function Vp(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 Gn({shortcuts:e=Vr,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=Vp(e);return jsxRuntime.jsxs("div",{className:k("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(d).map(([c,m])=>m.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"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(n=>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:n.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:_p(n)})]},n.action))})]},c))})}),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 Hn=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=wi(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=wi(t[d]||"");if(c.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let p=n.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let l=o.get(p),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(c){s.push(`Line ${d+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function wi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Ci(e,t){switch(t){case "json":return Yc(e);case "csv":return qc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Ti(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 gn=react.createContext(null);function Di(){return react.useContext(gn)}var Ni=react.createContext(null);function Si({children:e,themeName:t}){return jsxRuntime.jsx(Ni.Provider,{value:{themeName:t},children:e})}function pr(){return react.useContext(Ni)}function Ke({children:e,container:t}){let[a,r]=react.useState(false),o=Di(),s=pr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:m}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:n,children:e}),d)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var Ii={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},rm="#BDC3C7",om=({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 Ya({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null),n=()=>{if(!m.current)return;let u=m.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let C=v-u.bottom,D=u.top,h;C>=x+b?h=u.bottom+b:D>=x+b?h=u.top-x-b:h=C>=D?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};react.useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!m.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},l=e?Ii[e]:null,i=l?.color||rm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):n(),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?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Ii).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>p(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter: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(om,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&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"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.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 nm=[{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 Fr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),i=(pr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),C=window.innerHeight,D=window.innerWidth,h=320,A=380,w=4,L=g.left;L+h>D-10&&(L=D-h-10),L<10&&(L=10);let T=C-g.bottom,z=g.top,H;T>=A+w?H=g.bottom+w:z>=A+w?H=g.top-A-w:H=T>=z?g.bottom+w:Math.max(10,g.top-A-w),c({top:H,left:L}),s(true);};react.useEffect(()=>{let g=C=>{m.current&&!m.current.contains(C.target)&&!n.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let C=new Date,D=L=>{let T=L.getFullYear(),z=String(L.getMonth()+1).padStart(2,"0"),H=String(L.getDate()).padStart(2,"0");return `${T}-${z}-${H}`},h=D(C),A=new Date(C);A.setDate(A.getDate()+g);let w=D(A);a(h,w),s(false);},f=()=>{if(!e||!t)return "Set date";let g=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=A.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let L=w[0],T=w[1],z=w[2];return L===void 0||T===void 0||z===void 0?null:new Date(L,T-1,z)},C=g(e),D=g(t);if(!C||!D||isNaN(C.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[C.getMonth()]} ${C.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),g<C})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"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:i?"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:i?"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:nm.map(g=>jsxRuntime.jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"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:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Xa({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=react.useState(false),[c,m]=react.useState(""),[n,p]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,C=window.innerWidth,D=300,h=380,A=4,w=b.right-D;w<10&&(w=b.left),w+D>C-10&&(w=C-D-10);let L=g-b.bottom,T=b.top,z;L>=h+A?z=b.bottom+A:T>=h+A?z=b.top-h-A:z=L>=T?b.bottom+A:Math.max(10,b.top-h-A),p({top:z,left:w}),d(true);};react.useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),m(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),m(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(C=>C.id===b.id);a(g?e.filter(C=>C.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?d(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[y.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(Ke,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:f.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"}):f.map(b=>{let g=e.some(C=>C.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),g&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(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 po(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let n=m.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(m.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,c=m=>{if(!s.has(m)){s.add(m),d.add(m);let n=r.get(m)||[];for(let p of n){if(!s.has(p)&&c(p))return true;if(d.has(p))return true}}return d.delete(m),false};return c(a)}function Rr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[c,m]=react.useState(false),[n,p]=react.useState(""),[l,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[f,y]=react.useState(null),x=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,z=300,H=l?380:120,U=4,E=w.right-z;E<10&&(E=w.left),E+z>T-10&&(E=T-z-10);let J=L-w.bottom,ge=w.top,ke;J>=H+U?ke=w.bottom+U:ge>=H+U?ke=w.top-H-U:ke=J>=ge?w.bottom+U:Math.max(10,w.top-H-U),v({top:ke,left:E}),m(true);};react.useEffect(()=>{if(!c||!b.current)return;let w=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,z=300,H=l?380:120,U=4,E=w.right-z;E<10&&(E=w.left),E+z>T-10&&(E=T-z-10);let J=L-w.bottom,ge=w.top,ke;J>=H+U?ke=w.bottom+U:ge>=H+U?ke=w.top-H-U:ke=J>=ge?w.bottom+U:Math.max(10,w.top-H-U),v({top:ke,left:E});},[l,c]),react.useEffect(()=>{let w=L=>{x.current&&!x.current.contains(L.target)&&!b.current?.contains(L.target)&&(m(false),p(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=L=>{L.key==="Escape"&&(m(false),p(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let C=w=>{let L=t.includes(w),T=a.find(z=>z.id===w);if(y(null),L){let z=t.filter(H=>H!==w);r(z),z.length===0&&i(false);}else {if(s&&po(a,w,e)){let H=`Cannot add "${T?.title||w}" as dependency - would create circular reference`;y(H),d?.(w,T?.title||w),setTimeout(()=>y(null),3e3);return}r([...t,w]),i(true);}},D=()=>{let w=!l;i(w),w||r([]);},h=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(n.toLowerCase())||w.id.toLowerCase().includes(n.toLowerCase())),A=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?m(false):g(),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:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),c&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.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:[f&&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:f})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:w=>p(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:h.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"}):h.map(w=>{let L=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>C(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.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([]),i(false),m(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 Sa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:c=[],allCards:m=[]})=>{let{attributes:n,listeners:p,setNodeRef:l,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:io.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:l,style:f,...n,...p,onClick:()=>a?.(e),children:t(e)});let y=c.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:b,className:k("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...p,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.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:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ya,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Fr,{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:(g,C)=>d?.(e.id,{startDate:g,endDate:C})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Xa,{assignedUsers:y,availableUsers:c,onChange:g=>d?.(e.id,{assignedUserIds:g.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Rr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:m,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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));Sa.displayName="Card";var uo={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"}},Gi=({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 Hi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),p=[...Object.entries(uo).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(uo).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=uo[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...uo.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,C=280,D=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let A=x-y.bottom,w=y.top,L;A>=C+D?L=y.bottom+D:w>=C+D?L=y.top-C-D:L=A>=w?y.bottom+D:Math.max(10,y.top-C-D),c({top:L,left:h}),s(true);};react.useEffect(()=>{let y=x=>{m.current&&!m.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsxRuntime.jsx(Gi,{icon:v.icon,color:f})}),o&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(y=>jsxRuntime.jsxs("button",{onClick:()=>u(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Gi,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function _i({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=react.useState(false),[c,m]=react.useState(false),[n,p]=react.useState(e),[l,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=C=>{u.current&&!u.current.contains(C.target)&&!v.current?.contains(C.target)&&(d(false),m(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=C=>{C.key==="Escape"&&(d(false),m(false),p(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]);let y=()=>{m(true),p(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),m(false),d(false),p(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(m(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>d(!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(Ke,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:f,type:"text",value:n,onChange:g=>p(g.target.value),onKeyDown:b,onBlur:x,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:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),d(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var fr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:c,availableUsers:m,allCards:n,enableVirtualization:p,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),D=p??bi(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:x,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let z=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:z}:z>=80?{state:"warning",percentage:z}:z>=60?{state:"approaching",percentage:z}:{state:"ok",percentage:z}})(),L=w.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:k("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",x),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:k(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||f)&&jsxRuntime.jsx(_i,{columnTitle:e.title,onRename:z=>v?.(e.id,z),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(z=>z.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map(z=>{let H=t[z.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${z.start}px)`},children:jsxRuntime.jsx(Sa,{card:H,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:n})},H.id):null})}):t.map(z=>jsxRuntime.jsx(Sa,{card:z,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:n},z.id))})})]})});fr.displayName="Column";function vn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let p=s.trim();p&&p!==e?t(p):d(e),o(false);},n=p=>{p.key==="Enter"?m():p.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:p=>d(p.target.value),onBlur:m,onKeyDown:n,className:k("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:k("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function kn(){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 Ua({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:m,error:n,children:p}){let[l,i]=kn(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=react.useCallback((T,z)=>{t.onCardUpdate?.(T,z);},[t]),x=react.useCallback((T,z)=>{t.onColumnUpdate?.(T,{title:z});},[t]),b=react.useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],C=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let T=new Map;return e.columns.forEach(z=>{let H=z.cardIds.map(U=>e.cards.find(E=>E.id===U)).filter(U=>U!==void 0).sort((U,E)=>U.position-E.position);T.set(z.id,H);}),T},[e.cards,e.columns]),h=react.useCallback(T=>{let{active:z}=T,H=e.cards.find(U=>U.id===z.id);H&&i({isDragging:true,draggedCardId:H.id,sourceColumnId:H.columnId,targetColumnId:H.columnId});},[e.cards,i]),A=react.useCallback(T=>{let{active:z,over:H}=T;if(!H||!e.cards.find(J=>J.id===z.id))return;let E=null;H.data.current?.type==="column"?E=H.id:H.data.current?.type==="card"&&(E=e.cards.find(ge=>ge.id===H.id)?.columnId||null),E&&E!==l.targetColumnId&&i({...l,targetColumnId:E});},[e.cards,l,i]),w=react.useCallback(async T=>{let{active:z,over:H}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!H)return;let U=e.cards.find(ke=>ke.id===z.id);if(!U)return;let E,J;if(H.data.current?.type==="column"){E=H.id;let ke=D.get(E)||[];J=cn(ke,0);}else {let ke=e.cards.find(de=>de.id===H.id);if(!ke)return;E=ke.columnId;let Le=D.get(E)||[],Ee=Le.findIndex(de=>de.id===H.id);J=cn(Le,Ee);}let ge=e.columns.find(ke=>ke.id===E);if(ge&&ge.wipLimit&&ge.wipLimitType==="hard"){let ke=D.get(E)||[];if(U.columnId!==E&&ke.length>=ge.wipLimit){t.onWipLimitExceeded?.(ge,U);return}}(U.columnId!==E||U.position!==J)&&await t.onCardMove?.(U.id,E,J);},[e.cards,e.columns,D,t,i]),L=react.useCallback(T=>{a?.(T);},[a]);return m?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:c,children:jsxRuntime.jsx(Pm,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Si,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:C,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:A,onDragEnd:w,children:[jsxRuntime.jsxs("div",{className:k("asakaa-board",f,d),style:c,"data-theme":u,children:[e.columns.sort((T,z)=>T.position-z.position).map(T=>{let z=D.get(T.id)||[],H=!g.includes(T.id);return jsxRuntime.jsx(fr,{column:T,cards:z,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:L,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:H,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(Sa,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Pm({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 Fm={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)"},Bm={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)"},Rm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Om={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Um({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=p=>{c.current&&!c.current.contains(p.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let m=n=>{t(n),d(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!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((n,p)=>n.position-p.position).map((n,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.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:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function zm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=react.useState(false),[c,m]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){m(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{m(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===u.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"})}):u.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:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function $m({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 Cn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:c,onExportExcel:m,translations:n}){let p=r==="dark"?Fm:Bm,l={...o==="es"?Rm:Om,...n},i=d||c||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zm,{theme:p,t:l,onExportCSV:d,onExportJSON:c,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(Um,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsxRuntime.jsx($m,{onClick:()=>t(),label:a||l.newTask}))]})})}function Dn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=react.useState(false),[c,m]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),m(""),d(false));},[c,e]),p=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(m(""),d(false));},[n]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:k("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>m(i.target.value),onKeyDown:p,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),d(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:k("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>d(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 Nn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:c="dark",locale:m="es"}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState([]),[x,b]=react.useState(""),[g,C]=react.useState(""),[D,h]=react.useState(""),[A,w]=react.useState(false),[L,T]=react.useState(false),[z,H]=react.useState(false),U=react.useRef(null),E=react.useRef(null),J={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ge=react.useCallback(()=>{v(""),y([]),b(""),C(""),h(""),w(false),T(false),H(false),p(false);},[]);react.useEffect(()=>{n&&U.current&&U.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let S=F=>{E.current&&!E.current.contains(F.target)&&(u.trim()||ge());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n,u,ge]);let ke=react.useCallback(async()=>{let S=u.trim();if(!(!S||l)){i(true);try{await t({name:S,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),v(""),y([]),b(""),C(""),h(""),w(!1),T(!1),H(!1),U.current?.focus();}catch(F){console.error("Error creating card:",F);}finally{i(false);}}},[u,e,f,x,g,D,t,l]),Le=react.useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),ke()):S.key==="Escape"&&ge();},[ke,ge]),Ee=react.useCallback(S=>{y(F=>F.includes(S)?F.filter(M=>M!==S):[...F,S]);},[]),de=c==="dark";return n?jsxRuntime.jsxs("div",{ref:E,className:k("rounded-lg overflow-hidden shadow-lg",de?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:U,type:"text",value:u,onChange:S=>v(S.target.value),onKeyDown:Le,placeholder:J.placeholder,disabled:l,className:k("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",de?"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(!A),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||f.length>0?"bg-emerald-500/20 text-emerald-400":de?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:J.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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>T(!L),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||x||g?"bg-blue-500/20 text-blue-400":de?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:J.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!z),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",z||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":de?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:J.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:ke,disabled:!u.trim()||l,className:k("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):J.save})]})]}),A&&a.length>0&&jsxRuntime.jsx("div",{className:k("px-3 pb-3 pt-0","border-t",de?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(S=>jsxRuntime.jsxs("button",{onClick:()=>Ee(S.id),className:k("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(S.id)?"bg-emerald-500 text-white":de?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[S.avatar?jsxRuntime.jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),L&&jsxRuntime.jsx("div",{className:k("px-3 pb-3 pt-0","border-t",de?"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:k("block text-[10px] uppercase tracking-wide mb-1",de?"text-gray-500":"text-gray-400"),children:J.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:S=>b(S.target.value),className:k("w-full px-2 py-1.5 rounded text-xs border",de?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:k("block text-[10px] uppercase tracking-wide mb-1",de?"text-gray-500":"text-gray-400"),children:J.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:S=>C(S.target.value),className:k("w-full px-2 py-1.5 rounded text-xs border",de?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),z&&jsxRuntime.jsx("div",{className:k("px-3 pb-3 pt-0","border-t",de?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(S=>jsxRuntime.jsx("button",{onClick:()=>h(D===S?"":S),className:k("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:de?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:J[S]},S))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:d,className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",de?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"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:J.buttonLabel})]})}var Wr=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(Ua,{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(d=>{d?o(d):s(new Error("Failed to create PNG blob"));},"image/png");})}};function rl(e={}){return new Wr(e)}var br=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(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:d}=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:d?`Error in ${d}`:"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 Sn(e,t){let a=r=>jsxRuntime.jsx(br,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Pn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:m,shortcut:n="k",className:p=""}){let[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState("home"),[x,b]=react.useState(""),[g,C]=react.useState("");react.useEffect(()=>{let w=L=>{(L.metaKey||L.ctrlKey)&&L.key===n&&(L.preventDefault(),i(T=>!T)),L.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),react.useEffect(()=>{l||(y("home"),v(""),b(""),C(""));},[l]);let D=react.useCallback(()=>{i(false);},[]),h=react.useCallback(w=>{let[L,T]=w.split(":");switch(L){case "create-card":y("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(a?.(T),D()):y("navigate");break;case "search":r?.(u),D();break;case "priority":y("priority");break;case "set-priority":g&&T&&(o?.(g,T),D());break;case "assign":y("assign");break;case "assign-user":g&&T&&(s?.(g,T),D());break;case "ai":y("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":m?.(),D();break;case "back":y("home");break;}},[u,g,t,a,r,o,s,d,c,m,D]),A=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),D());},[x,u,t,D]);return l?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&f==="create-card"&&x&&A();}}),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."}),f==="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:h,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:h,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:h,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:h,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:h,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(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},w.id))})]}),f==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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))})]}),f==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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 L=e.columns.find(T=>T.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:h,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:L?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},w.id)})})]}),f==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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:h,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:h,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 Km(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 Ym(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 qm(e){return e.startsWith("image/")}function Hr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[d,c]=react.useState(false),[m,n]=react.useState(false),[p,l]=react.useState(null),i=react.useRef(null),u=react.useCallback(h=>{let A=[],w=[];return e.length+h.length>s?(w.push(`Maximum ${s} files allowed`),{valid:A,errors:w}):(h.forEach(L=>{if(L.size/1048576>r){w.push(`${L.name} is too large (max ${r}MB)`);return}if(o&&!o.some(z=>L.type.match(z))){w.push(`${L.name} has invalid file type`);return}A.push(L);}),{valid:A,errors:w})},[e.length,s,r,o]),v=react.useCallback(async h=>{let{valid:A,errors:w}=u(h);if(w.length>0){l(w.join(", ")),setTimeout(()=>l(null),5e3);return}if(A.length!==0){n(true),l(null);try{await t?.(A);}catch(L){l(L instanceof Error?L.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{n(false);}}},[u,t]),f=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),y=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),x=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let A=Array.from(h.dataTransfer.files);v(A);},[v]),g=react.useCallback(h=>{let A=h.target.files?Array.from(h.target.files):[];v(A),i.current&&(i.current.value="");},[v]),C=react.useCallback(()=>{i.current?.click();},[]),D=react.useCallback(h=>{confirm("Are you sure you want to delete this attachment?")&&a?.(h);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${m?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:C,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?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:d?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(h=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:qm(h.type)&&h.url?jsxRuntime.jsx("img",{src:h.thumbnailUrl||h.url,alt:h.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Ym(h.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:h.name,children:h.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Km(h.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(h.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(h.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"})})})]},h.id))})]})}function An({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:m=[],attachments:n=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=react.useState("details"),[C,D]=react.useState(false),[h,A]=react.useState({}),[w,L]=react.useState(""),[T,z]=react.useState(false),[H,U]=react.useState({});if(!t||!e)return null;let E=react.useCallback(()=>{D(false),A({}),g("details"),L(""),U({}),a();},[a]),J=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),A({}),D(false));},[e.id,h,r]),ge=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),E());},[e.id,o,E]),ke=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),L(""));},[e.id,w,p]),Le=react.useCallback(async()=>{if(v){z(true);try{let M=await v(e);U(V=>({...V,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{z(false);}}},[e,v]),Ee=react.useCallback(async()=>{if(f){z(true);try{let M=await f(e);U(V=>({...V,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{z(false);}}},[e,f]),de=react.useCallback(async()=>{if(y){z(true);try{let M=await y(e);U(V=>({...V,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{z(false);}}},[e,y]),S={...e,...h},F=s.filter(M=>S.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:E,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:h.title??S.title,onChange:M=>A({...h,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:S.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:J,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),A({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ge,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:E,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:()=>g("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),C?jsxRuntime.jsx("textarea",{value:h.description??S.description??"",onChange:M=>A({...h,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:S.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??S.assignedUserIds??[],onChange:M=>{let V=Array.from(M.target.selectedOptions,P=>P.value);A({...h,assignedUserIds:V});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:F.length>0?F.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxRuntime.jsxs("select",{value:h.priority??S.priority??"",onChange:M=>A({...h,priority:M.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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:S.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:S.labels&&S.labels.length>0?S.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:"",onChange:M=>A({...h,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.startDate?new Date(S.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:"",onChange:M=>A({...h,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.endDate?new Date(S.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??S.estimatedTime??"",onChange:M=>A({...h,estimatedTime:M.target.value?parseFloat(M.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:S.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:S.dependencies&&S.dependencies.length>0?S.dependencies.map(M=>{let V=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",V.slice(-4)]},V)}):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:S.createdAt?new Date(S.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:M=>L(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ke,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(M=>{let V=s.find(P=>P.id===M.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:[V&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:V.color},children:V.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:V?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(M.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:M.content})]},M.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(M=>{let V=s.find(P=>P.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:V?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Hr,{cardId:e.id,attachments:n,onUpload:i?M=>i(e.id,M):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Le,disabled:T||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Ee,disabled:T||!f,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:de,disabled:T||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((M,V)=>{let P=s.find(W=>W.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[P&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:P?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},V)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((M,V)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},V))]}),H.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&m.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 _r({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:d=""}){let[c,m]=react.useState({top:0,left:0}),n=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,f=l.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let y=i-l.bottom,x=l.top,b;return y>=s+v?b=l.bottom+v:x>=s+v?b=l.top-s-v:y>=x?b=l.bottom+v:b=Math.max(10,l.top-s-v),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&m(p());},[t,p]),react.useEffect(()=>{if(!t)return;let l=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${d}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var rp=["LOW","MEDIUM","HIGH","URGENT"],op=["todo","in-progress","review","done"];function Fn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:m,onDeleteComment:n,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:f=[],onUploadCoverImage:y,unsplashAccessKey:x,theme:b,onSubtasksChange:g}){let C=pr(),D=b||C?.themeName||"dark",[h,A]=react.useState(e),[w,L]=react.useState(false),[T,z]=react.useState(e?.subtasks||[]),[H,U]=react.useState(false),[E,J]=react.useState(""),[ge,ke]=react.useState(""),[Le,Ee]=react.useState("all"),[de,S]=react.useState(false),[F,M]=react.useState(false),[V,P]=react.useState(false),[W,ie]=react.useState(false),[te,Se]=react.useState(false),[ne,Ve]=react.useState(false),be=react.useRef(null),tt=react.useRef(null),Tt=react.useRef(null),Dt=react.useRef(null),yt=react.useRef(null),Nt=react.useRef(null),Mt=react.useRef(null),ra=react.useRef(null),mt=react.useRef(null),rt=react.useRef(null),Lt=react.useRef(null),Ht=react.useRef(null);react.useEffect(()=>{e&&!h?(A({...e}),z(e.subtasks||[])):e&&h&&e.id!==h.id&&(A({...e}),z(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let R=se=>{let Ae=se.target;Dt.current&&!Dt.current.contains(Ae)&&S(false),yt.current&&!yt.current.contains(Ae)&&M(false),Nt.current&&!Nt.current.contains(Ae)&&P(false),Mt.current&&!Mt.current.contains(Ae)&&ie(false);};if(de||F||V||W)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[de,F,V,W]),react.useEffect(()=>{if(!t)return;let R=se=>{let Ae=se.target,at=Ae.tagName==="INPUT"||Ae.tagName==="TEXTAREA"||Ae.isContentEditable;if(se.key==="Escape"){se.preventDefault(),de||F||V||W||te||ne?(S(false),M(false),P(false),ie(false),Se(false),Ve(false)):at||a();return}if(at&&se.key!=="Escape")return;let De=se.metaKey||se.ctrlKey;switch(se.key.toLowerCase()){case "s":se.preventDefault(),S(true);break;case "a":se.preventDefault(),P(true);break;case "p":se.preventDefault(),M(true);break;case "l":se.preventDefault(),ie(true);break;case "d":De||(se.preventDefault(),Se(true),setTimeout(()=>ra.current?.focus(),0));break;case "e":De||(se.preventDefault(),Ve(true));break;case "i":se.preventDefault(),L(true),setTimeout(()=>tt.current?.focus(),0);break;case "t":se.preventDefault(),U(true);break;case "c":se.preventDefault(),Tt.current?.focus();break}};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t,a,de,F,V,W,te,ne]);let we=react.useCallback(R=>{let se=R.currentTarget.textContent?.trim()||"";if(h&&se!==h.title){let Ae={...h,title:se};A(Ae),r?.(h.id,{title:se});}},[h,r]),O=react.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),R.currentTarget.blur()),R.key==="Escape"&&(R.preventDefault(),R.currentTarget.textContent=h?.title||"",R.currentTarget.blur());},[h]),Te=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),L(false);},[h,e,r]),ze=react.useCallback(R=>{if(h){let se={...h,columnId:R};A(se),r?.(h.id,{columnId:R}),S(false);}},[h,r]),Ue=react.useCallback(R=>{if(h){let se={...h,priority:R};A(se),r?.(h.id,{priority:R}),M(false);}},[h,r]),pt=react.useCallback(R=>{if(h){let se=h.assignedUserIds||[],Ae=se.includes(R)?se.filter(De=>De!==R):[...se,R],at={...h,assignedUserIds:Ae};A(at),r?.(h.id,{assignedUserIds:Ae});}},[h,r]),X=react.useCallback(R=>{if(h){let se=h.labels||[],Ae=se.includes(R)?se.filter(De=>De!==R):[...se,R],at={...h,labels:Ae};A(at),r?.(h.id,{labels:Ae});}},[h,r]),Q=react.useCallback(R=>{if(h){let se=R.target.value,Ae={...h,endDate:se};A(Ae),r?.(h.id,{endDate:se}),Se(false);}},[h,r]),ve=react.useCallback(R=>{if(h){let se={...h,estimatedTime:parseFloat(R)||0};A(se),r?.(h.id,{estimatedTime:parseFloat(R)||0});}},[h,r]),fe=react.useCallback(()=>{if(E.trim()&&h){let R={id:`subtask-${Date.now()}`,title:E.trim(),completed:false,createdAt:new Date},se=[...T,R];z(se),J(""),U(false),g?.(h.id,se);}},[E,T,h,g]),ee=react.useCallback(R=>{let se=T.map(Ae=>Ae.id===R?{...Ae,completed:!Ae.completed,updatedAt:new Date}:Ae);z(se),h&&g?.(h.id,se);},[T,h,g]),Ce=react.useCallback(R=>{let se=T.filter(Ae=>Ae.id!==R);z(se),h&&g?.(h.id,se);},[T,h,g]),B=react.useCallback(()=>{ge.trim()&&h&&m&&(m(h.id,ge.trim()),ke(""));},[ge,h,m]),G=react.useCallback(R=>{(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),B());},[B]),K=R=>jsxRuntime.jsx(ep__default.default,{remarkPlugins:[tp__default.default],rehypePlugins:[ap__default.default],components:{a:({node:se,...Ae})=>jsxRuntime.jsx("a",{...Ae,target:"_blank",rel:"noopener noreferrer"})},children:R}),oe=c.filter(R=>Le==="comments"?R.type.includes("COMMENT"):Le==="history"?!R.type.includes("COMMENT"):true);if(!t||!e)return null;let q=h||e,xe=s.filter(R=>q.assignedUserIds?.includes(R.id)),le=T.filter(R=>R.completed).length;return jsxRuntime.jsx(Ke,{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:R=>R.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:be,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:we,onKeyDown:O,children:q.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:Dt,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>S(!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("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:q.columnId||"No status"})]}),jsxRuntime.jsx(_r,{triggerRef:mt,isOpen:de,onClose:()=>S(false),width:250,estimatedHeight:200,children:(v.length>0?v:op.map(R=>({id:R,title:R}))).map(R=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===R.id?"active":""}`,onClick:()=>ze(R.id),children:R.title},R.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Nt,children:[jsxRuntime.jsxs("button",{ref:rt,className:"modal-v2-field",onClick:()=>P(!V),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:xe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:xe.map(R=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:R.color},title:R.name,children:R.initials},R.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(_r,{triggerRef:rt,isOpen:V,onClose:()=>P(false),width:280,estimatedHeight:300,children:s.map(R=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(R.id)?"active":""}`,onClick:()=>pt(R.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:R.color},children:R.initials}),R.name,q.assignedUserIds?.includes(R.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"})})]},R.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:yt,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>M(!F),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:q.priority||"None"})]}),jsxRuntime.jsxs(_r,{triggerRef:Lt,isOpen:F,onClose:()=>M(false),width:180,estimatedHeight:220,children:[rp.map(R=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${R.toLowerCase()} ${q.priority===R?"active":""}`,onClick:()=>Ue(R),children:R},R)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ue(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Mt,children:[jsxRuntime.jsxs("button",{ref:Ht,className:"modal-v2-field",onClick:()=>ie(!W),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:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(_r,{triggerRef:Ht,isOpen:W,onClose:()=>ie(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(R=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(R)?"active":""}`,onClick:()=>X(R),children:[R,q.labels?.includes(R)&&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"})})]},R))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Se(!te),setTimeout(()=>ra.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:q.endDate?new Date(q.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ra,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let R=new Date(q.endDate),se=R.getUTCFullYear(),Ae=String(R.getUTCMonth()+1).padStart(2,"0"),at=String(R.getUTCDate()).padStart(2,"0");return `${se}-${Ae}-${at}`})():"",onChange:Q,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ve(!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("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:q.estimatedTime?`${q.estimatedTime}h`:"Not set"})]}),ne&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:R=>ve(R.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ve(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"})]}),w?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:R=>{if(h){let se={...h,description:R.target.value};A(se);}},onBlur:Te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>L(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:K(q.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"}),T.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[le,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>U(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:[T.map(R=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${R.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ee(R.id),children:R.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:R.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ce(R.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"})]})})]},R.id)),H&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:E,onChange:R=>J(R.target.value),onKeyDown:R=>{R.key==="Enter"&&fe(),R.key==="Escape"&&(U(false),J(""));},onBlur:fe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${Le==="all"?"active":""}`,onClick:()=>Ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="comments"?"active":""}`,onClick:()=>Ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="history"?"active":""}`,onClick:()=>Ee("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ge,onChange:R=>ke(R.target.value),onKeyDown:G,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:B,disabled:!ge.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[oe.map(R=>{let se=s.find(at=>at.id===R.userId);if(R.type.includes("COMMENT")){let at=d.find(De=>De.id===R.metadata?.commentId);return at?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[se&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:se.color},children:se.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:se?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:at.content})]})]},R.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[R.type.includes("CREATED")&&"\u2795",R.type.includes("UPDATED")&&"\u270F\uFE0F",R.type.includes("MOVED")&&"\u27A1\uFE0F",R.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",R.type.includes("ASSIGNED")&&"\u{1F464}",R.type.includes("PRIORITY")&&"\u{1F3AF}",R.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:se?.name||"Unknown"})," ",R.type.replace(/_/g," ").toLowerCase(),R.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:R.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]})]},R.id)}),oe.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 up({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 Rn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(d=>({...d,average:d.average??e.reduce((c,m)=>c+m.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(up,{})}),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((d,c)=>d+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.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((d,c)=>d+(c.planned||0),0)})]})]})]})}function wp({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 On({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,m=s>0?(s-d)/s*100:0,n=d<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wp,{})}),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:n?"#10B981":"#EF4444",fill:n?"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:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#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:m>=50?"#10B981":"#F59E0B"},children:[m.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:n?"#10B981":"#EF4444"},children:d})]}),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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ap={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},ul=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ip({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),m=t+d*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function gl({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 Un({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,n)=>m+n.value,0),d=e.map(m=>({...m,totalValue:s,color:m.color||Ap[m.name]||ul[e.indexOf(m)%ul.length]})),c=d.map(m=>m.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:d,cx:"50%",cy:"50%",labelLine:false,label:o?Ip:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,n)=>{let p=n.payload,l=s>0?(p.value/s*100).toFixed(0):"0";return `${m} (${p.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:d,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(gl,{})}),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:d.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),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((m,n)=>n.value>m.value?n:m).name})]})]})]})}var xo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[d,c]=react.useState(false),[m,n]=react.useState(false),[p,l]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(C=>C.id),f=C=>{r.onBulkUpdate?.(v,{priority:C}),c(false);},y=C=>{r.onBulkMove?.(v,C),n(false),a();},x=C=>{r.onBulkUpdate?.(v,{assignedUserIds:C}),l(false);},b=C=>{let D=new Set;e.forEach(A=>{A.labels?.forEach(w=>D.add(w));});let h=Array.from(new Set([...D,...C]));r.onBulkUpdate?.(v,{labels:h}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!d),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(C),children:[jsxRuntime.jsx("span",{className:k("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(C.id),children:C.title},C.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([C.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,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"})})]})]})})});xo.displayName="BulkOperationsToolbar";function Op(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,d,c,m,n;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let v=a?.find(f=>f.id===u);d=`assignee-${u}`,c=v?.name||`User ${u}`,m=v?.color,n=v?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m,icon:n}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",m="#6b7280",n="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m,icon:n}),r.get(d).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",d=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,m=i.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:s,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function zn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),c=react.useMemo(()=>Op(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(n=>{d(p=>{let l=new Set(p);return l.has(n)?l.delete(n):l.add(n),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Ua,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:k("asakaa-swimlane-view",o),children:[c.map(n=>{let p=s.has(n.id),l=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Ua,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var $n=[{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 Wn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),c=$n.find(n=>n.value===e)||$n[0];react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:k("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:k("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:$n.map(n=>jsxRuntime.jsxs("button",{onClick:()=>m(n.value),className:k("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.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:n.label}),e===n.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:n.description})]})]},n.value))})]})]})}var Vr=[{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 $p(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&d&&c&&m}function vl(e={}){let{shortcuts:t=Vr,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 d=react.useCallback(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(n=>n.action!==m);},[]);return react.useEffect(()=>{function m(n){if(!s.current)return;let p=n.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let l of o.current)if($p(n,l)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Gp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Hp(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 _p(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Hp(e),r=t?Gp(t):"";return a?`${a} + ${r}`:r}function Vp(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 Gn({shortcuts:e=Vr,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=Vp(e);return jsxRuntime.jsxs("div",{className:k("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(d).map(([c,m])=>m.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"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(n=>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:n.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:_p(n)})]},n.action))})]},c))})}),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 Hn=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
6
6
|
1.
|
|
7
7
|
|
|
8
8
|
**Expected behavior:**
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _n({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},m=e.reduce((n,p)=>{let l=p.category||"Other";return n[l]||(n[l]=[]),n[l].push(p),n},{});return jsxRuntime.jsxs("div",{className:k("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:k("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(m).map(([n,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:p.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),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 jn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[m,n]=react.useState("json"),[p,l]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await xi(e,m,f);ki(y,m);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Ti(y),b=y.name.endsWith(".json")?"json":"csv",g=Ci(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:k("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:k("p-4 rounded-lg border-2 transition-all text-center",m===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:u,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"})]}),d==="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:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:k("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:k("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((f,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var Xp=["URGENT","HIGH","MEDIUM","LOW"],Jp=[{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"}],Zp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:m=[],availableLabels:n=[],availableColumns:p=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=react.useState(true),x=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=react.useCallback(h=>{r({by:h.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let A=h.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Xp.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let A=h.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let A=h.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:Jp.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Zp.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yn({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:m}){let[n,p]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&p(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:k("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 qn={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"}},Xn={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"}},Jn={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"}},er={dark:qn,light:Xn,neutral:Jn},wo="dark";var Co=react.createContext(void 0),lu="asakaa-theme";function wl({children:e,defaultTheme:t=wo,storageKey:a=lu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=er[r];Object.entries(m.colors).forEach(([p,l])=>{l&&c.style.setProperty(`--theme-${du(p)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,l])=>{let i=m.colors[p];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:er};return jsxRuntime.jsx(Co.Provider,{value:d,children:e})}function xr(){let e=react.useContext(Co);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function du(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=xr();return e?jsxRuntime.jsxs("div",{className:k("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(er).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:k("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:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.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}var Oe={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:"#06B6D4",todayLight:"rgba(6, 182, 212, 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:"#0891B2",todayLight:"rgba(8, 145, 178, 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"}};function Cl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Oe[e]||Oe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Oe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Oe[e].bgSecondary),bgGrid:r("--theme-bg-card",Oe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Oe[e].bgWeekend),border:r("--theme-border-primary",Oe[e].border),borderLight:r("--theme-border-subtle",Oe[e].borderLight),textPrimary:r("--theme-text-primary",Oe[e].textPrimary),textSecondary:r("--theme-text-secondary",Oe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Oe[e].textTertiary),accent:r("--theme-accent-primary",Oe[e].accent),accentHover:r("--theme-accent-hover",Oe[e].accentHover),accentLight:r("--theme-accent-primary",Oe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Oe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Oe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Oe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Oe[e].dependency),dependencyHover:r("--theme-border-secondary",Oe[e].dependencyHover),criticalPath:r("--theme-error",Oe[e].criticalPath),criticalPathLight:r("--theme-error",Oe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Oe[e].today):e==="neutral"?r("--theme-text-primary",Oe[e].today):r("--theme-error",Oe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Oe[e].todayLight):e==="neutral"?r("--theme-text-primary",Oe[e].todayLight):r("--theme-error",Oe[e].todayLight),milestone:r("--theme-warning",Oe[e].milestone),milestoneLight:r("--theme-warning",Oe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Oe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Oe[e].statusInProgress),statusCompleted:r("--theme-success",Oe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Oe[e].hoverBg),focusRing:r("--theme-accent-primary",Oe[e].focusRing)}}var To={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"},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"}},Tl={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"},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"}},Qn={en:To,es:Tl};function Dl(e){return Qn[e]||Qn.en}function es(e,t){let a=Dl(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 wr=react.createContext(To);function jr(){return react.useContext(wr)}function Nu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,m]=react.useState(false),[n,p]=react.useState(null),l=react.useRef(null),i=jr();if(react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&m(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){p(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===y.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"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Su({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 d=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:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&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:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Eu({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 Pu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=jr();react.useEffect(()=>{let n=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],m=c.find(n=>n.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:`${d.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,p)=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Do({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=jr(),C=u||v||f||y||x||b,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{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(Eu,{options:D,value:t,onChange:A=>a(A),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(Pu,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||g.toolbar.createTask})]}),(C||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Su,{options:h,value:s,onChange:A=>d(A),theme:e})]})]})}function No({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,d]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let n=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let p=m.current.getBoundingClientRect();d({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Cr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+p+i>u&&(f=t-p,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),m({x:f,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:l=>{p.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var it={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 Ul({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),f=react.useCallback(g=>{let C=[],D=h=>{for(let A of h)C.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&D(A.subtasks);};return D(g),C},[]),y=react.useCallback(()=>{let g=f(e);for(let C of g)if(t.has(C.id))return C;return null},[e,t,f]),x=react.useCallback((g,C)=>{let D=f(e);if(D.length===0)return;let h=y();if(!h){a(D[0].id,false);return}let A=D.findIndex(T=>T.id===h.id);if(A===-1)return;let w=g==="up"?A-1:A+1;if(w<0||w>=D.length)return;let L=D[w];a(L.id,C);},[e,y,f,a]),b=react.useCallback(g=>{if(!i)return;let C=g.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||u.current){g.key==="Escape"&&(C.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,w=Array.from(t),L=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(L&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!L.isExpanded||g.key==="ArrowLeft"&&L.isExpanded)&&p(L.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){w.length>0&&(g.preventDefault(),d(w,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){w.length>0&&(g.preventDefault(),c(w));return}if(g.key==="Tab"&&g.shiftKey){w.length>0&&(g.preventDefault(),m(w));return}if(g.key==="Enter"&&!g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"above"));return}if(g.key==="Enter"&&A){L&&(g.preventDefault(),l(L.id));return}if(g.key==="F2"){L&&(g.preventDefault(),n(L.id));return}if(g.key==="Delete"||g.key==="Backspace"&&A){w.length>0&&(g.preventDefault(),o(w));return}if(g.key==="d"&&A&&!g.shiftKey){w.length>0&&(g.preventDefault(),s(w));return}},[i,t,y,x,r,o,s,d,c,m,n,p,l]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function zl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=react.useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=react.useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),m=react.useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:p}}function Tr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Wl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Wl(a.subtasks,t);if(r)return r}}return null}function rs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=rs(a.subtasks,t);if(r)return r}return null}function os(e,t){if(t.length===0)return e;let a=Tr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),m=new Set(t),{tasks:n,removed:p}=d(e,m);return c(n,s.id,p)}function ns(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=rs(a,r);if(!o)continue;let s=rs(a,o.id),d=(n,p,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===p&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,p,l);if(v)return v}}return null},c=(n,p,l)=>{let i=n.findIndex(u=>u.id===p);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,p,l);return n},m=d(a,o.id,r);m&&(s&&s.subtasks?c(s.subtasks,o.id,m):c(a,o.id,m));}return a}function ss(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,m)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,m))return true;return false}let p=m==="up"?n-1:n+1;return p<0||p>=d.length?false:([d[n],d[p]]=[d[p],d[n]],true)};return s(r,o,a),r}function is(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 ls(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(p=>p.id===r);if(c===-1){for(let p of d)if(p.subtasks&&o(p.subtasks))return true;return false}let m=d[c],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Gl(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=m=>{let n=m.findIndex(l=>l.id===t);if(n===-1){for(let l of m)if(l.subtasks&&c(l.subtasks))return true;return false}let p=a==="above"?n:n+1;return m.splice(p,0,d),true};return c(r),{tasks:r,newTask:d}}function ds(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ds(r.subtasks,t,a)}:r)}function cs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:cs(a.subtasks,t)}:a)}function ms(e,t){let a=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=p=>p.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,m],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:m}}function Hl(e,t,a,r){if(t===a)return e;let o=Wl(e,t);if(!o)return e;if(a){let c=(m,n)=>{if(!m.subtasks)return false;for(let p of m.subtasks)if(p.id===n||c(p,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(n=>{if(n.id===a){let p=n.subtasks||[],l=r!==void 0?r:p.length,i=[...p];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function Po({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:m,scrollTop:n,columns:p,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:C,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:A,onTaskReparent:w}){let L=react.useContext(wr),[T,$]=react.useState(null),[H,U]=react.useState(false),[E,J]=react.useState(null),[ge,ke]=react.useState(""),Le=react.useRef(null),Ee=react.useRef(null),[de,S]=react.useState(null),[F,M]=react.useState(0),[V,P]=react.useState(0),[W,le]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[te,Se]=react.useState(null),[ne,Ve]=react.useState(null),[be,tt]=react.useState(null),Tt=react.useRef(0),Dt=5,yt=react.useRef(false);react.useEffect(()=>{function B(G){Le.current&&!Le.current.contains(G.target)&&U(false);}if(H)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[H]),react.useEffect(()=>{E&&Ee.current&&(Ee.current.focus(),Ee.current.select());},[E]),react.useEffect(()=>{if(!de)return;let B=K=>{let oe=K.clientX-F,q=V+oe;i?.(de,q);},G=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",G),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",G),document.body.style.cursor="",document.body.style.userSelect="";}},[de,F,V,i]);let{selectedTaskIds:Nt,handleTaskClick:Mt,isTaskSelected:ra}=zl(),{setIsEditing:mt}=Ul({tasks:e,selectedTaskIds:Nt,onTaskSelect:(B,G)=>{let oe=Tr(e).map(q=>q.id);Mt(B,oe,G||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:B=>{let G=Tr(e).find(K=>K.id===B);G&&O(G);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:B=>{let G=Tr(e).find(K=>K.id===B);G&&h&&h(G);},enableKeyboard:true}),rt=(B,G=0)=>{let K=[];for(let oe of B)K.push({task:oe,level:G}),oe.subtasks&&oe.subtasks.length>0&&oe.isExpanded&&K.push(...rt(oe.subtasks,G+1));return K},Lt=rt(e),Ht=48,we=B=>!B.startDate||!B.endDate?"-":`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))}d`,O=B=>{J(B.id),ke(B.name),mt(true);},Te=B=>{ge.trim()&&ge!==e.find(G=>G.id===B)?.name&&C?.(B,ge.trim()),J(null),ke(""),mt(false);},$e=()=>{J(null),ke(""),mt(false);},Ue=(B,G)=>{G.stopPropagation(),D?.(B.id);},pt=(B,G)=>{G.preventDefault(),Tt.current=G.clientY,Se(B),yt.current=false;},X=B=>{if(!te||(Math.abs(B.clientY-Tt.current)>Dt&&(yt.current=true),!yt.current))return;let K=document.querySelectorAll("[data-task-row]"),oe=null,q=null;K.forEach(xe=>{let se=xe.getBoundingClientRect(),R=xe.getAttribute("data-task-row");if(R&&R!==te&&B.clientY>=se.top&&B.clientY<=se.bottom){oe=R;let ie=B.clientY-se.top,Ae=se.height;ie<Ae*.25?q="above":ie>Ae*.75?q="below":q="child";}}),Ve(oe),tt(q);},Q=()=>{if(yt.current&&te&&ne&&be){if(be==="child")w?.(te,ne);else if(be==="above"||be==="below"){let B=(oe,q,xe=null)=>{for(let se of oe){if(se.id===q)return xe;if(se.subtasks){let R=B(se.subtasks,q,se.id);if(R!==void 0)return R}}},G=B(e,ne,null),K=(oe,q)=>{let xe=oe.findIndex(se=>se.id===q);return be==="below"?xe+1:xe};if(G===null){let oe=K(e,ne);w?.(te,null,oe);}else {let oe=Lt.find(q=>q.task.id===G)?.task;if(oe?.subtasks){let q=K(oe.subtasks,ne);w?.(te,G,q);}}}}Se(null),Ve(null),tt(null),yt.current=false;};react.useEffect(()=>{if(te)return document.addEventListener("mousemove",X),document.addEventListener("mouseup",Q),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",Q),document.body.style.cursor="",document.body.style.userSelect="";}},[te,ne,be]);let ve=(B,G,K)=>{switch(B.id){case "name":let oe=E===G.id,q=T===G.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${K*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:q?1:.3},onMouseDown:De=>pt(G.id,De),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),G.subtasks&&G.subtasks.length>0?jsxRuntime.jsx("button",{onClick:De=>{De.stopPropagation(),m?.(G.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:G.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"}),!(G.subtasks&&G.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:G.color||"#3B82F6",opacity:G.parentId?.6:1,borderColor:G.isMilestone?t.accent:"transparent",borderWidth:G.isMilestone?"2px":"0px"},title:G.isMilestone?"Milestone":G.parentId?"Subtask":"Task"}),oe?jsxRuntime.jsx("input",{ref:Ee,type:"text",value:ge,onChange:De=>ke(De.target.value),onKeyDown:De=>{De.key==="Enter"?Te(G.id):De.key==="Escape"&&$e();},onBlur:()=>Te(G.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:De=>De.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:G.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:G.parentId?"13px":"14px",fontWeight:G.isMilestone?600:G.parentId?400:600,letterSpacing:G.parentId?"0":"-0.01em"},title:G.name,children:G.name}),q&&!oe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:De=>Ue(G,De),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:De=>{De.stopPropagation(),O(G);},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":let xe=G.startDate?typeof G.startDate=="string"?G.startDate:G.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:xe||"",onChange:De=>{u?.(G.id,{startDate:De.target.value?new Date(De.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let se=G.endDate?typeof G.endDate=="string"?G.endDate:G.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:se||"",onChange:De=>{u?.(G.id,{endDate:De.target.value?new Date(De.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:we(G)})});case "assignees":let R=r.filter(De=>G.assignees?.some(ja=>ja.name===De.name||ja.initials===De.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(Xa,{assignedUsers:R,availableUsers:r,onChange:De=>{let ja=De.map(cr=>({id:cr.id,name:cr.name,initials:cr.initials,color:cr.color}));u?.(G.id,{assignees:ja.length>0?ja:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(Hi,{status:G.status||"todo",onChange:De=>{u?.(G.id,{status:De,progress:De==="completed"?100:G.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:`${G.progress}%`,backgroundColor:G.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:[G.progress,"%"]})]});case "priority":let ie={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ae={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},at=ie[G.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(Ya,{priority:at,onChange:De=>{De&&u?.(G.id,{priority:Ae[De]||"medium"});}})});default:return null}},fe=B=>[{id:"hide",label:"Hide Column",icon:it.Hide,onClick:()=>l(B),disabled:B==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:it.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:it.SortDesc,onClick:()=>{}}],ee=B=>B.subtasks&&B.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{A?A(B.id,B.name):x?.([B.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{d?.(B);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{u?.(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{u?.(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{u?.(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{A?A(B.id,B.name):x?.([B.id]);}}],Ce=p.filter(B=>B.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},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:[Ce.map((B,G)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B.id==="name"?"justify-between":"justify-center"}`,style:{...B.id==="name"?{flex:"1 1 auto",minWidth:`${B.minWidth??150}px`}:{width:`${B.width}px`,minWidth:`${B.minWidth??60}px`,maxWidth:`${B.maxWidth??2e3}px`,flexShrink:0},borderRight:G<Ce.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:K=>{K.preventDefault(),le({isOpen:true,x:K.clientX,y:K.clientY,type:"header",columnId:B.id});},onMouseEnter:K=>{K.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:K=>{K.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",flex:B.id==="name"?"1 1 auto":"none",minWidth:0},title:B.label,children:B.label}),B.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(No,{columns:p,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>U(!H),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),B.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:de===B.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:K=>{K.preventDefault(),K.stopPropagation(),S(B.id),M(K.clientX),P(B.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},B.id)),H&&jsxRuntime.jsxs("div",{ref:Le,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>U(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",children:Lt.map(({task:B,level:G},K)=>{let oe=ra(B.id),q=ne===B.id,xe={};return q&&be&&(be==="above"?(xe.borderTopWidth="2px",xe.borderTopStyle="solid",xe.borderTopColor=t.accent):be==="below"?(xe.borderBottomWidth="2px",xe.borderBottomStyle="solid",xe.borderBottomColor=t.accent):be==="child"&&(xe.backgroundColor=t.accentLight,xe.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":B.id,className:`flex items-center cursor-pointer group ${te===B.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:oe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:oe||q&&be==="child"?t.accentLight:K%2===0?t.bgPrimary:t.bgGrid,...xe},onMouseEnter:()=>$(B.id),onMouseLeave:()=>$(null),onClick:se=>{let ie=Tr(e).map(De=>De.id),at=navigator.platform.toUpperCase().indexOf("MAC")>=0?se.metaKey:se.ctrlKey;Mt(B.id,ie,at,se.shiftKey),s?.(B);},onDoubleClick:se=>{se.stopPropagation(),d?.(B);},onContextMenu:se=>{se.preventDefault(),le({isOpen:true,x:se.clientX,y:se.clientY,type:"task",task:B}),c?.(B,se);},whileHover:{backgroundColor:oe?t.accentLight:t.hoverBg},children:Ce.map((se,R)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${se.id==="name"?"justify-start":"justify-center"} ${R<Ce.length-1?"border-r":""}`,style:{...se.id==="name"?{flex:"1 1 auto",minWidth:`${se.minWidth??150}px`}:{width:`${se.width}px`,minWidth:`${se.minWidth??60}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:0},borderColor:T===B.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ve(se,B,se.id==="name"?G:0)},`${B.id}-${se.id}`))},B.id)})}),jsxRuntime.jsx(Cr,{isOpen:W.isOpen,x:W.x,y:W.y,items:W.type==="header"&&W.columnId?fe(W.columnId):W.type==="task"&&W.task?ee(W.task):[],onClose:()=>le({...W,isOpen:false}),theme:t})]})}function _l(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[m,n]=react.useState(t),[p,l]=react.useState(null),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(0),[C,D]=react.useState(0),[h,A]=react.useState(null),[w,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:m,setGhostWidth:n,connectionLine:p,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:C,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:A,isHovered:w,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(E,J)=>{r("none"),l(null),u(null),c(E),n(J),D(0),x(null),g(0);}}}function Mo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=_l(t,r),x=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:C,setDragOffset:D,ghostX:h,setGhostX:A,ghostWidth:w,setGhostWidth:L,connectionLine:T,setConnectionLine:$,hoveredTaskId:H,setHoveredTaskId:U,activeZone:E,setActiveZone:J,draggedSegmentIndex:ge,setDraggedSegmentIndex:ke,draggedSegmentStartX:Le,setDraggedSegmentStartX:Ee,segmentDragOffsetX:de,setSegmentDragOffsetX:S,hoveredSegmentIndex:F,setHoveredSegmentIndex:M,isHovered:V,setIsHovered:P,isDragging:W,isResizing:le,isConnecting:te,resetDragState:Se}=y,ne=32,Ve=8,be=e.endDate&&e.endDate<new Date&&e.progress<100,tt=e.isCriticalPath,Tt=o.name==="neutral"||o.today==="#1C1917",Dt=e.status==="completed"||e.progress===100,yt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Mt=e.isCriticalPath||be?"#DC2626":e.color?e.color:e.priority&&yt[e.priority]?yt[e.priority]:o.taskBarPrimary,mt=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),rt=r<50,Lt=r<40;react.useEffect(()=>{if(f)if(V&&!W&&!e.segments){let ee=a<100;f({task:e,x:t,y:a,width:r,height:ne,showBelow:ee});}else f(null);},[V,W,e,t,a,r,ne,f]);let Ht=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),we=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},O=ee=>Math.round(ee/s)*s,Te=ee=>{let Ce=Math.round(ee/s),B=new Date(d);return B.setDate(B.getDate()+Ce),B},$e=(ee,Ce)=>{for(let B of u){if(B.id===e.id)continue;let G=5;if(ee>=B.x-G&&ee<=B.x+B.width+G&&Ce>=B.y-G&&Ce<=B.y+B.height+G)return B.id}return null},Ue=react.useCallback((ee,Ce,B)=>{ee.preventDefault(),ee.stopPropagation();let G=x.current?.ownerSVGElement;if(!G)return;let K=G.createSVGPoint();K.x=ee.clientX,K.y=ee.clientY;let oe=K.matrixTransform(G.getScreenCTM()?.inverse()),q=B!==void 0?B:t,xe=Ce;if(!xe){let se=oe.x-q;ee.shiftKey?(xe="connect",$({x:t+r,y:a+ne/2})):ee.ctrlKey||ee.metaKey?xe="move":ee.altKey?xe=se<r/2?"resize-start":"resize-end":Lt?se<r/2?xe="move":xe="resize-end":rt?se<=mt/2?xe="resize-start":se>=r-mt/2?xe="resize-end":xe="move":se<=mt?xe="resize-start":se>=r-mt?xe="resize-end":xe="move";}g(xe),P(false),J(null),xe==="move"?D(oe.x-q):xe==="connect"?$({x:t+r,y:a+ne/2}):D(0),A(q),L(r);},[t,r,a,ne]),pt=react.useCallback(ee=>{if(b==="none")return;let Ce=x.current?.ownerSVGElement;if(!Ce)return;let B=Ce.createSVGPoint();B.x=ee.clientX,B.y=ee.clientY;let G=B.matrixTransform(Ce.getScreenCTM()?.inverse());if(b==="connect"){$({x:G.x,y:G.y});let K=$e(G.x,G.y);U(K);}else if(b==="move"){let K=G.x-C,oe=O(K);A(oe),L(r);let q=Math.round((oe-t)/s);if(v?.(e.id,q,true),e.segments&&e.segments.length>0&&ge!==null){let xe=oe-Le;S(xe);}}else if(b==="resize-start"){let K=G.x,oe=O(K),q=t+r-oe;q>=s&&(A(oe),L(q));}else if(b==="resize-end"){let K=G.x,q=O(K)-t;q>=s&&L(q);}},[b,t,r,s,C,e,O,ge,Le,$e,U,$,A,L,S,v]),X=react.useCallback(()=>{if(b!=="none"){if(b==="connect")H&&i&&i(e,H),$(null),U(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),Ce,B,G=true;if(b==="move"){if(Ce=Te(h),B=new Date(Ce.getTime()+ee),e.segments&&e.segments.length>0&&ge!==null){let K=Math.round(de/s),oe=e.segments.map((R,ie)=>{if(ie===ge){let Ae=new Date(R.startDate),at=new Date(R.endDate);return Ae.setDate(Ae.getDate()+K),at.setDate(at.getDate()+K),{startDate:Ae,endDate:at}}return R}),q=oe.flatMap(R=>[R.startDate,R.endDate]),xe=new Date(Math.min(...q.map(R=>R.getTime()))),se=new Date(Math.max(...q.map(R=>R.getTime())));l?.({...e,segments:oe},xe,se),Se(t,r);return}}else b==="resize-start"?(Ce=Te(h),B=e.endDate,Ce>=B&&(console.warn("Invalid date range: start date must be before end date"),G=false)):b==="resize-end"?(Ce=e.startDate,B=Te(h+w),B<=Ce&&(console.warn("Invalid date range: end date must be after start date"),G=false)):G=false;G&&Ce&&B&&(B.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,Ce,B));}v?.(e.id,0,false),Se(t,r);}},[b,h,w,e,l,H,i,t,r,s,Te,de,ge,Se,v]);react.useEffect(()=>{if(b==="none")return;let ee=B=>{pt(B);},Ce=()=>{X();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Ce);}},[b,pt,X]);let Q=W&&!te?h:t,ve=W&&!te?w:r,fe=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!W&&P(true),onMouseLeave:()=>{W||(P(false),J(null));},onClick:()=>!W&&m?.(e),onDoubleClick:ee=>{W||(ee.stopPropagation(),n?.(e));},onContextMenu:ee=>{ee.preventDefault(),p?.(e,ee);},children:[V&&!W&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:mt,height:ne,fill:E==="resize-start"?o.accent:"transparent",opacity:E==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>J("resize-start"),onMouseDown:ee=>Ue(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:ne,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:ee=>Ue(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-mt,y:a,width:mt,height:ne,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:ee=>Ue(ee,"resize-end")})]}),V&&!W&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ne,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:ee=>Ue(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ne,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:ee=>Ue(ee,"resize-end")}),V&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ne-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),W&&!te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:w,height:ne,rx:Ve,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:Q,y:a,width:ve,height:ne,rx:Ve,fill:Mt,"data-task-class":fe,initial:{opacity:0,scale:.95},animate:{opacity:W&&!te?.15:e.parentId?.6:V?.9:.8,scale:V&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>Ue(ee),style:{cursor:W?te?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve*(e.progress/100),height:ne,rx:Ve,fill:Mt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ee,Ce)=>{let B=(ee.startDate.getTime()-d.getTime())/864e5*s,K=(ee.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-B+s,oe=W&&b==="move"&&ge===Ce,q=F===Ce,xe=oe?B+de:B;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!W&&M(Ce),onMouseLeave:()=>!W&&M(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:xe,y:a,width:K,height:ne,rx:Ve,fill:Mt,initial:{opacity:0,scale:.95},animate:{opacity:oe||e.parentId?.6:q?.9:.8,scale:q&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:se=>{se.stopPropagation(),ke(Ce),Ee(B),Ue(se,void 0,B);},style:{cursor:W?te?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:xe,y:a,width:K*(e.progress/100),height:ne,rx:Ve,fill:Mt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Tt&&(be||tt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[tt&&!be&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve,height:ne,rx:Ve,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),be&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve,height:ne,rx:Ve,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ve>60&&!e.segments&&(()=>{let ee=c.taskLabel(e),Ce=typeof ee=="string"?ee:e.name,B=Ce.length>Math.floor(ve/8)?`${Ce.substring(0,Math.floor(ve/8))}...`:Ce;return jsxRuntime.jsx("text",{x:Q+12,y:a+ne/2,dominantBaseline:"middle",fill:Dt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Dt?"line-through":"none"},children:B})})(),ve>100&&e.progress>0&&e.progress<100&&!W&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+ve-12,y:a+ne/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&&ve>80&&!W&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+ve-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+ve-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(V||le)&&!te&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?Q-15:Q-10,y:a-5,width:rt?25:20,height:ne+10,fill:"transparent",onMouseDown:ee=>Ue(ee,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?Q-8:Q-3,y:a+6,width:rt?8:6,height:rt?ne-12:ne-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Q+ve-10,y:a-5,width:rt?25:20,height:ne+10,fill:"transparent",onMouseDown:ee=>Ue(ee,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?Q+ve:Q+ve-3,y:a+6,width:rt?8:6,height:rt?ne-12:ne-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ne/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ee=>{ee.stopPropagation(),Ue(ee,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ne/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),te&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ne/2,x2:T.x,y2:T.y,stroke:H?o.statusCompleted:o.accent,strokeWidth:H?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:H?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:H?8:6,fill:H?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),H&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(V||W)&&!te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:ve+4,height:ne+4,rx:Ve+2,fill:"none",stroke:W?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:W?.6:.4,initial:{opacity:0},animate:{opacity:W?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+w,y1:0,x2:h+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!e.segments&&!f&&(()=>{let B=a<100,G=B?a+ne+13:a-82-13,K=B?`M ${Q+ve/2-6} ${a+ne+3} L ${Q+ve/2} ${a+ne+13} L ${Q+ve/2+6} ${a+ne+3}`:`M ${Q+ve/2-6} ${a-13} L ${Q+ve/2} ${a-3} L ${Q+ve/2+6} ${a-13}`,oe=G+22,q=G+40,xe=G+55,se=G+70,R=B?G+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:B?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:B?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:K,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+ve/2-120,y:G,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:Q+ve/2,y:oe,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:Q+ve/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+ve/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ht(e.startDate)}),jsxRuntime.jsx("text",{x:Q+ve/2-110,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+ve/2-70,y:xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ht(e.endDate)}),jsxRuntime.jsx("text",{x:Q+ve/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+ve/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:we()}),jsxRuntime.jsx("text",{x:Q+ve/2+10,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+ve/2+65,y:xe,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:Q+ve/2-110,y:se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+ve/2-50,y:se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ie=>ie.name).join(", ").substring(0,30),e.assignees.map(ie=>ie.name).join(", ").length>30?"...":""]})]}),!B&&jsxRuntime.jsx("text",{x:Q+ve/2,y:R,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":rt?"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 Kl({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,m=82,n=13,p=c?o+d+n:o-m-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=p+22,u=p+40,v=p+55,f=p+70,y=c?p+m-5:o-18,x=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let D=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${D} day${D!==1?"s":""}`},g=s<50,C=s<40;return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,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:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?x(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?x(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,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:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(D=>D.name).join(", ").substring(0,30),a.assignees.map(D=>D.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+s/2,y,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:C?"Left: move \u2022 Right: resize":g?"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 Lo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,m]=react.useState(false),n=a-e,p=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(p,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;return react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:C=>{C.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Bo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=react.useState(false),c=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(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 ae={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=n=>{n.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,m=n=>{if(!d.has(n)){d.add(n),c.add(n);let p=r.get(n)||[];for(let l of p){if(!d.has(l)&&m(l))return true;if(c.has(l))return true}}return c.delete(n),false};return m(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=ae.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ae.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ae.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=ae.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(`
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _n({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},m=e.reduce((n,p)=>{let l=p.category||"Other";return n[l]||(n[l]=[]),n[l].push(p),n},{});return jsxRuntime.jsxs("div",{className:k("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:k("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(m).map(([n,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:p.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),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 jn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[m,n]=react.useState("json"),[p,l]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await xi(e,m,f);ki(y,m);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Ti(y),b=y.name.endsWith(".json")?"json":"csv",g=Ci(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:k("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:k("p-4 rounded-lg border-2 transition-all text-center",m===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:u,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"})]}),d==="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:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:k("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:k("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((f,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var Xp=["URGENT","HIGH","MEDIUM","LOW"],Jp=[{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"}],Zp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:m=[],availableLabels:n=[],availableColumns:p=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=react.useState(true),x=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=react.useCallback(h=>{r({by:h.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let A=h.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Xp.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let A=h.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let A=h.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:Jp.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Zp.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yn({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:m}){let[n,p]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&p(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:k("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 qn={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"}},Xn={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"}},Jn={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"}},er={dark:qn,light:Xn,neutral:Jn},wo="dark";var Co=react.createContext(void 0),lu="asakaa-theme";function wl({children:e,defaultTheme:t=wo,storageKey:a=lu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=er[r];Object.entries(m.colors).forEach(([p,l])=>{l&&c.style.setProperty(`--theme-${du(p)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,l])=>{let i=m.colors[p];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:er};return jsxRuntime.jsx(Co.Provider,{value:d,children:e})}function xr(){let e=react.useContext(Co);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function du(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=xr();return e?jsxRuntime.jsxs("div",{className:k("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(er).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:k("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:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.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}var Oe={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:"#06B6D4",todayLight:"rgba(6, 182, 212, 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:"#0891B2",todayLight:"rgba(8, 145, 178, 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"}};function Cl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Oe[e]||Oe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Oe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Oe[e].bgSecondary),bgGrid:r("--theme-bg-card",Oe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Oe[e].bgWeekend),border:r("--theme-border-primary",Oe[e].border),borderLight:r("--theme-border-subtle",Oe[e].borderLight),textPrimary:r("--theme-text-primary",Oe[e].textPrimary),textSecondary:r("--theme-text-secondary",Oe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Oe[e].textTertiary),accent:r("--theme-accent-primary",Oe[e].accent),accentHover:r("--theme-accent-hover",Oe[e].accentHover),accentLight:r("--theme-accent-primary",Oe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Oe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Oe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Oe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Oe[e].dependency),dependencyHover:r("--theme-border-secondary",Oe[e].dependencyHover),criticalPath:r("--theme-error",Oe[e].criticalPath),criticalPathLight:r("--theme-error",Oe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Oe[e].today):e==="neutral"?r("--theme-text-primary",Oe[e].today):r("--theme-error",Oe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Oe[e].todayLight):e==="neutral"?r("--theme-text-primary",Oe[e].todayLight):r("--theme-error",Oe[e].todayLight),milestone:r("--theme-warning",Oe[e].milestone),milestoneLight:r("--theme-warning",Oe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Oe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Oe[e].statusInProgress),statusCompleted:r("--theme-success",Oe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Oe[e].hoverBg),focusRing:r("--theme-accent-primary",Oe[e].focusRing)}}var To={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"},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"}},Tl={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"},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"}},Qn={en:To,es:Tl};function Dl(e){return Qn[e]||Qn.en}function es(e,t){let a=Dl(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 wr=react.createContext(To);function jr(){return react.useContext(wr)}function Nu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,m]=react.useState(false),[n,p]=react.useState(null),l=react.useRef(null),i=jr();if(react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&m(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){p(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===y.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"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Su({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 d=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:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&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:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Eu({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 Pu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=jr();react.useEffect(()=>{let n=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],m=c.find(n=>n.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:`${d.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,p)=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Do({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=jr(),C=u||v||f||y||x||b,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{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(Eu,{options:D,value:t,onChange:A=>a(A),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(Pu,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||g.toolbar.createTask})]}),(C||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Su,{options:h,value:s,onChange:A=>d(A),theme:e})]})]})}function No({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,d]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let n=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let p=m.current.getBoundingClientRect();d({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Cr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+p+i>u&&(f=t-p,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),m({x:f,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:l=>{p.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var it={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 Ul({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),f=react.useCallback(g=>{let C=[],D=h=>{for(let A of h)C.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&D(A.subtasks);};return D(g),C},[]),y=react.useCallback(()=>{let g=f(e);for(let C of g)if(t.has(C.id))return C;return null},[e,t,f]),x=react.useCallback((g,C)=>{let D=f(e);if(D.length===0)return;let h=y();if(!h){a(D[0].id,false);return}let A=D.findIndex(T=>T.id===h.id);if(A===-1)return;let w=g==="up"?A-1:A+1;if(w<0||w>=D.length)return;let L=D[w];a(L.id,C);},[e,y,f,a]),b=react.useCallback(g=>{if(!i)return;let C=g.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||u.current){g.key==="Escape"&&(C.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,w=Array.from(t),L=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(L&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!L.isExpanded||g.key==="ArrowLeft"&&L.isExpanded)&&p(L.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){w.length>0&&(g.preventDefault(),d(w,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){w.length>0&&(g.preventDefault(),c(w));return}if(g.key==="Tab"&&g.shiftKey){w.length>0&&(g.preventDefault(),m(w));return}if(g.key==="Enter"&&!g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"above"));return}if(g.key==="Enter"&&A){L&&(g.preventDefault(),l(L.id));return}if(g.key==="F2"){L&&(g.preventDefault(),n(L.id));return}if(g.key==="Delete"||g.key==="Backspace"&&A){w.length>0&&(g.preventDefault(),o(w));return}if(g.key==="d"&&A&&!g.shiftKey){w.length>0&&(g.preventDefault(),s(w));return}},[i,t,y,x,r,o,s,d,c,m,n,p,l]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function $l(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=react.useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=react.useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),m=react.useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:p}}function Tr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Wl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Wl(a.subtasks,t);if(r)return r}}return null}function rs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=rs(a.subtasks,t);if(r)return r}return null}function os(e,t){if(t.length===0)return e;let a=Tr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),m=new Set(t),{tasks:n,removed:p}=d(e,m);return c(n,s.id,p)}function ns(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=rs(a,r);if(!o)continue;let s=rs(a,o.id),d=(n,p,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===p&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,p,l);if(v)return v}}return null},c=(n,p,l)=>{let i=n.findIndex(u=>u.id===p);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,p,l);return n},m=d(a,o.id,r);m&&(s&&s.subtasks?c(s.subtasks,o.id,m):c(a,o.id,m));}return a}function ss(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,m)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,m))return true;return false}let p=m==="up"?n-1:n+1;return p<0||p>=d.length?false:([d[n],d[p]]=[d[p],d[n]],true)};return s(r,o,a),r}function is(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 ls(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(p=>p.id===r);if(c===-1){for(let p of d)if(p.subtasks&&o(p.subtasks))return true;return false}let m=d[c],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Gl(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=m=>{let n=m.findIndex(l=>l.id===t);if(n===-1){for(let l of m)if(l.subtasks&&c(l.subtasks))return true;return false}let p=a==="above"?n:n+1;return m.splice(p,0,d),true};return c(r),{tasks:r,newTask:d}}function ds(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ds(r.subtasks,t,a)}:r)}function cs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:cs(a.subtasks,t)}:a)}function ms(e,t){let a=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=p=>p.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,m],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:m}}function Hl(e,t,a,r){if(t===a)return e;let o=Wl(e,t);if(!o)return e;if(a){let c=(m,n)=>{if(!m.subtasks)return false;for(let p of m.subtasks)if(p.id===n||c(p,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(n=>{if(n.id===a){let p=n.subtasks||[],l=r!==void 0?r:p.length,i=[...p];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function Po({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:m,scrollTop:n,columns:p,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:C,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:A,onTaskReparent:w}){let L=react.useContext(wr),[T,z]=react.useState(null),[H,U]=react.useState(false),[E,J]=react.useState(null),[ge,ke]=react.useState(""),Le=react.useRef(null),Ee=react.useRef(null),[de,S]=react.useState(null),[F,M]=react.useState(0),[V,P]=react.useState(0),[W,ie]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[te,Se]=react.useState(null),[ne,Ve]=react.useState(null),[be,tt]=react.useState(null),Tt=react.useRef(0),Dt=5,yt=react.useRef(false);react.useEffect(()=>{function B(G){Le.current&&!Le.current.contains(G.target)&&U(false);}if(H)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[H]),react.useEffect(()=>{E&&Ee.current&&(Ee.current.focus(),Ee.current.select());},[E]),react.useEffect(()=>{if(!de)return;let B=K=>{let oe=K.clientX-F,q=V+oe;i?.(de,q);},G=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",G),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",G),document.body.style.cursor="",document.body.style.userSelect="";}},[de,F,V,i]);let{selectedTaskIds:Nt,handleTaskClick:Mt,isTaskSelected:ra}=$l(),{setIsEditing:mt}=Ul({tasks:e,selectedTaskIds:Nt,onTaskSelect:(B,G)=>{let oe=Tr(e).map(q=>q.id);Mt(B,oe,G||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:B=>{let G=Tr(e).find(K=>K.id===B);G&&O(G);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:B=>{let G=Tr(e).find(K=>K.id===B);G&&h&&h(G);},enableKeyboard:true}),rt=(B,G=0)=>{let K=[];for(let oe of B)K.push({task:oe,level:G}),oe.subtasks&&oe.subtasks.length>0&&oe.isExpanded&&K.push(...rt(oe.subtasks,G+1));return K},Lt=rt(e),Ht=48,we=B=>!B.startDate||!B.endDate?"-":`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))}d`,O=B=>{J(B.id),ke(B.name),mt(true);},Te=B=>{ge.trim()&&ge!==e.find(G=>G.id===B)?.name&&C?.(B,ge.trim()),J(null),ke(""),mt(false);},ze=()=>{J(null),ke(""),mt(false);},Ue=(B,G)=>{G.stopPropagation(),D?.(B.id);},pt=(B,G)=>{G.preventDefault(),Tt.current=G.clientY,Se(B),yt.current=false;},X=B=>{if(!te||(Math.abs(B.clientY-Tt.current)>Dt&&(yt.current=true),!yt.current))return;let K=document.querySelectorAll("[data-task-row]"),oe=null,q=null;K.forEach(xe=>{let le=xe.getBoundingClientRect(),R=xe.getAttribute("data-task-row");if(R&&R!==te&&B.clientY>=le.top&&B.clientY<=le.bottom){oe=R;let se=B.clientY-le.top,Ae=le.height;se<Ae*.25?q="above":se>Ae*.75?q="below":q="child";}}),Ve(oe),tt(q);},Q=()=>{if(yt.current&&te&&ne&&be){if(be==="child")w?.(te,ne);else if(be==="above"||be==="below"){let B=(oe,q,xe=null)=>{for(let le of oe){if(le.id===q)return xe;if(le.subtasks){let R=B(le.subtasks,q,le.id);if(R!==void 0)return R}}},G=B(e,ne,null),K=(oe,q)=>{let xe=oe.findIndex(le=>le.id===q);return be==="below"?xe+1:xe};if(G===null){let oe=K(e,ne);w?.(te,null,oe);}else {let oe=Lt.find(q=>q.task.id===G)?.task;if(oe?.subtasks){let q=K(oe.subtasks,ne);w?.(te,G,q);}}}}Se(null),Ve(null),tt(null),yt.current=false;};react.useEffect(()=>{if(te)return document.addEventListener("mousemove",X),document.addEventListener("mouseup",Q),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",Q),document.body.style.cursor="",document.body.style.userSelect="";}},[te,ne,be]);let ve=(B,G,K)=>{switch(B.id){case "name":let oe=E===G.id,q=T===G.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${K*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:q?1:.3},onMouseDown:De=>pt(G.id,De),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),G.subtasks&&G.subtasks.length>0?jsxRuntime.jsx("button",{onClick:De=>{De.stopPropagation(),m?.(G.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:G.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"}),!(G.subtasks&&G.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:G.color||"#3B82F6",opacity:G.parentId?.6:1,borderColor:G.isMilestone?t.accent:"transparent",borderWidth:G.isMilestone?"2px":"0px"},title:G.isMilestone?"Milestone":G.parentId?"Subtask":"Task"}),oe?jsxRuntime.jsx("input",{ref:Ee,type:"text",value:ge,onChange:De=>ke(De.target.value),onKeyDown:De=>{De.key==="Enter"?Te(G.id):De.key==="Escape"&&ze();},onBlur:()=>Te(G.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:De=>De.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:G.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:G.parentId?"13px":"14px",fontWeight:G.isMilestone?600:G.parentId?400:600,letterSpacing:G.parentId?"0":"-0.01em"},title:G.name,children:G.name}),q&&!oe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:De=>Ue(G,De),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:De=>{De.stopPropagation(),O(G);},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":let xe=G.startDate?typeof G.startDate=="string"?G.startDate:G.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:xe||"",onChange:De=>{u?.(G.id,{startDate:De.target.value?new Date(De.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let le=G.endDate?typeof G.endDate=="string"?G.endDate:G.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:le||"",onChange:De=>{u?.(G.id,{endDate:De.target.value?new Date(De.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:we(G)})});case "assignees":let R=r.filter(De=>G.assignees?.some(ja=>ja.name===De.name||ja.initials===De.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(Xa,{assignedUsers:R,availableUsers:r,onChange:De=>{let ja=De.map(cr=>({id:cr.id,name:cr.name,initials:cr.initials,color:cr.color}));u?.(G.id,{assignees:ja.length>0?ja:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(Hi,{status:G.status||"todo",onChange:De=>{u?.(G.id,{status:De,progress:De==="completed"?100:G.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:`${G.progress}%`,backgroundColor:G.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:[G.progress,"%"]})]});case "priority":let se={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ae={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},at=se[G.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(Ya,{priority:at,onChange:De=>{De&&u?.(G.id,{priority:Ae[De]||"medium"});}})});default:return null}},fe=B=>[{id:"hide",label:"Hide Column",icon:it.Hide,onClick:()=>l(B),disabled:B==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:it.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:it.SortDesc,onClick:()=>{}}],ee=B=>B.subtasks&&B.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{A?A(B.id,B.name):x?.([B.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{d?.(B);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{u?.(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{u?.(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{u?.(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{A?A(B.id,B.name):x?.([B.id]);}}],Ce=p.filter(B=>B.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},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:[Ce.map((B,G)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B.id==="name"?"justify-between":"justify-center"}`,style:{width:`${B.width}px`,minWidth:`${B.minWidth??(B.id==="name"?200:60)}px`,maxWidth:`${B.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:G<Ce.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:K=>{K.preventDefault(),ie({isOpen:true,x:K.clientX,y:K.clientY,type:"header",columnId:B.id});},onMouseEnter:K=>{K.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:K=>{K.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",flex:B.id==="name"?"1 1 auto":"none",minWidth:0},title:B.label,children:B.label}),B.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(No,{columns:p,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>U(!H),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),B.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:de===B.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:K=>{K.preventDefault(),K.stopPropagation(),S(B.id),M(K.clientX),P(B.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},B.id)),H&&jsxRuntime.jsxs("div",{ref:Le,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>U(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",children:Lt.map(({task:B,level:G},K)=>{let oe=ra(B.id),q=ne===B.id,xe={};return q&&be&&(be==="above"?(xe.borderTopWidth="2px",xe.borderTopStyle="solid",xe.borderTopColor=t.accent):be==="below"?(xe.borderBottomWidth="2px",xe.borderBottomStyle="solid",xe.borderBottomColor=t.accent):be==="child"&&(xe.backgroundColor=t.accentLight,xe.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":B.id,className:`flex items-center cursor-pointer group ${te===B.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:oe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:oe||q&&be==="child"?t.accentLight:K%2===0?t.bgPrimary:t.bgGrid,...xe},onMouseEnter:()=>z(B.id),onMouseLeave:()=>z(null),onClick:le=>{let se=Tr(e).map(De=>De.id),at=navigator.platform.toUpperCase().indexOf("MAC")>=0?le.metaKey:le.ctrlKey;Mt(B.id,se,at,le.shiftKey),s?.(B);},onDoubleClick:le=>{le.stopPropagation(),d?.(B);},onContextMenu:le=>{le.preventDefault(),ie({isOpen:true,x:le.clientX,y:le.clientY,type:"task",task:B}),c?.(B,le);},whileHover:{backgroundColor:oe?t.accentLight:t.hoverBg},children:Ce.map((le,R)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${le.id==="name"?"justify-start":"justify-center"} ${R<Ce.length-1?"border-r":""}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(le.id==="name"?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderColor:T===B.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ve(le,B,le.id==="name"?G:0)},`${B.id}-${le.id}`))},B.id)})}),jsxRuntime.jsx(Cr,{isOpen:W.isOpen,x:W.x,y:W.y,items:W.type==="header"&&W.columnId?fe(W.columnId):W.type==="task"&&W.task?ee(W.task):[],onClose:()=>ie({...W,isOpen:false}),theme:t})]})}function _l(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[m,n]=react.useState(t),[p,l]=react.useState(null),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(0),[C,D]=react.useState(0),[h,A]=react.useState(null),[w,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:m,setGhostWidth:n,connectionLine:p,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:C,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:A,isHovered:w,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(E,J)=>{r("none"),l(null),u(null),c(E),n(J),D(0),x(null),g(0);}}}function Mo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=_l(t,r),x=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:C,setDragOffset:D,ghostX:h,setGhostX:A,ghostWidth:w,setGhostWidth:L,connectionLine:T,setConnectionLine:z,hoveredTaskId:H,setHoveredTaskId:U,activeZone:E,setActiveZone:J,draggedSegmentIndex:ge,setDraggedSegmentIndex:ke,draggedSegmentStartX:Le,setDraggedSegmentStartX:Ee,segmentDragOffsetX:de,setSegmentDragOffsetX:S,hoveredSegmentIndex:F,setHoveredSegmentIndex:M,isHovered:V,setIsHovered:P,isDragging:W,isResizing:ie,isConnecting:te,resetDragState:Se}=y,ne=32,Ve=8,be=e.endDate&&e.endDate<new Date&&e.progress<100,tt=e.isCriticalPath,Tt=o.name==="neutral"||o.today==="#1C1917",Dt=e.status==="completed"||e.progress===100,yt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Mt=e.isCriticalPath||be?"#DC2626":e.color?e.color:e.priority&&yt[e.priority]?yt[e.priority]:o.taskBarPrimary,mt=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),rt=r<50,Lt=r<40;react.useEffect(()=>{if(f)if(V&&!W&&!e.segments){let ee=a<100;f({task:e,x:t,y:a,width:r,height:ne,showBelow:ee});}else f(null);},[V,W,e,t,a,r,ne,f]);let Ht=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),we=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},O=ee=>Math.round(ee/s)*s,Te=ee=>{let Ce=Math.round(ee/s),B=new Date(d);return B.setDate(B.getDate()+Ce),B},ze=(ee,Ce)=>{for(let B of u){if(B.id===e.id)continue;let G=5;if(ee>=B.x-G&&ee<=B.x+B.width+G&&Ce>=B.y-G&&Ce<=B.y+B.height+G)return B.id}return null},Ue=react.useCallback((ee,Ce,B)=>{ee.preventDefault(),ee.stopPropagation();let G=x.current?.ownerSVGElement;if(!G)return;let K=G.createSVGPoint();K.x=ee.clientX,K.y=ee.clientY;let oe=K.matrixTransform(G.getScreenCTM()?.inverse()),q=B!==void 0?B:t,xe=Ce;if(!xe){let le=oe.x-q;ee.shiftKey?(xe="connect",z({x:t+r,y:a+ne/2})):ee.ctrlKey||ee.metaKey?xe="move":ee.altKey?xe=le<r/2?"resize-start":"resize-end":Lt?le<r/2?xe="move":xe="resize-end":rt?le<=mt/2?xe="resize-start":le>=r-mt/2?xe="resize-end":xe="move":le<=mt?xe="resize-start":le>=r-mt?xe="resize-end":xe="move";}g(xe),P(false),J(null),xe==="move"?D(oe.x-q):xe==="connect"?z({x:t+r,y:a+ne/2}):D(0),A(q),L(r);},[t,r,a,ne]),pt=react.useCallback(ee=>{if(b==="none")return;let Ce=x.current?.ownerSVGElement;if(!Ce)return;let B=Ce.createSVGPoint();B.x=ee.clientX,B.y=ee.clientY;let G=B.matrixTransform(Ce.getScreenCTM()?.inverse());if(b==="connect"){z({x:G.x,y:G.y});let K=ze(G.x,G.y);U(K);}else if(b==="move"){let K=G.x-C,oe=O(K);A(oe),L(r);let q=Math.round((oe-t)/s);if(v?.(e.id,q,true),e.segments&&e.segments.length>0&&ge!==null){let xe=oe-Le;S(xe);}}else if(b==="resize-start"){let K=G.x,oe=O(K),q=t+r-oe;q>=s&&(A(oe),L(q));}else if(b==="resize-end"){let K=G.x,q=O(K)-t;q>=s&&L(q);}},[b,t,r,s,C,e,O,ge,Le,ze,U,z,A,L,S,v]),X=react.useCallback(()=>{if(b!=="none"){if(b==="connect")H&&i&&i(e,H),z(null),U(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),Ce,B,G=true;if(b==="move"){if(Ce=Te(h),B=new Date(Ce.getTime()+ee),e.segments&&e.segments.length>0&&ge!==null){let K=Math.round(de/s),oe=e.segments.map((R,se)=>{if(se===ge){let Ae=new Date(R.startDate),at=new Date(R.endDate);return Ae.setDate(Ae.getDate()+K),at.setDate(at.getDate()+K),{startDate:Ae,endDate:at}}return R}),q=oe.flatMap(R=>[R.startDate,R.endDate]),xe=new Date(Math.min(...q.map(R=>R.getTime()))),le=new Date(Math.max(...q.map(R=>R.getTime())));l?.({...e,segments:oe},xe,le),Se(t,r);return}}else b==="resize-start"?(Ce=Te(h),B=e.endDate,Ce>=B&&(console.warn("Invalid date range: start date must be before end date"),G=false)):b==="resize-end"?(Ce=e.startDate,B=Te(h+w),B<=Ce&&(console.warn("Invalid date range: end date must be after start date"),G=false)):G=false;G&&Ce&&B&&(B.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,Ce,B));}v?.(e.id,0,false),Se(t,r);}},[b,h,w,e,l,H,i,t,r,s,Te,de,ge,Se,v]);react.useEffect(()=>{if(b==="none")return;let ee=B=>{pt(B);},Ce=()=>{X();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Ce);}},[b,pt,X]);let Q=W&&!te?h:t,ve=W&&!te?w:r,fe=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!W&&P(true),onMouseLeave:()=>{W||(P(false),J(null));},onClick:()=>!W&&m?.(e),onDoubleClick:ee=>{W||(ee.stopPropagation(),n?.(e));},onContextMenu:ee=>{ee.preventDefault(),p?.(e,ee);},children:[V&&!W&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:mt,height:ne,fill:E==="resize-start"?o.accent:"transparent",opacity:E==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>J("resize-start"),onMouseDown:ee=>Ue(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:ne,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:ee=>Ue(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-mt,y:a,width:mt,height:ne,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:ee=>Ue(ee,"resize-end")})]}),V&&!W&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ne,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:ee=>Ue(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ne,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:ee=>Ue(ee,"resize-end")}),V&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ne-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),W&&!te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:w,height:ne,rx:Ve,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:Q,y:a,width:ve,height:ne,rx:Ve,fill:Mt,"data-task-class":fe,initial:{opacity:0,scale:.95},animate:{opacity:W&&!te?.15:e.parentId?.6:V?.9:.8,scale:V&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>Ue(ee),style:{cursor:W?te?"crosshair":ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve*(e.progress/100),height:ne,rx:Ve,fill:Mt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ee,Ce)=>{let B=(ee.startDate.getTime()-d.getTime())/864e5*s,K=(ee.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-B+s,oe=W&&b==="move"&&ge===Ce,q=F===Ce,xe=oe?B+de:B;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!W&&M(Ce),onMouseLeave:()=>!W&&M(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:xe,y:a,width:K,height:ne,rx:Ve,fill:Mt,initial:{opacity:0,scale:.95},animate:{opacity:oe||e.parentId?.6:q?.9:.8,scale:q&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>{le.stopPropagation(),ke(Ce),Ee(B),Ue(le,void 0,B);},style:{cursor:W?te?"crosshair":ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:xe,y:a,width:K*(e.progress/100),height:ne,rx:Ve,fill:Mt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Tt&&(be||tt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[tt&&!be&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve,height:ne,rx:Ve,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),be&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve,height:ne,rx:Ve,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ve>60&&!e.segments&&(()=>{let ee=c.taskLabel(e),Ce=typeof ee=="string"?ee:e.name,B=Ce.length>Math.floor(ve/8)?`${Ce.substring(0,Math.floor(ve/8))}...`:Ce;return jsxRuntime.jsx("text",{x:Q+12,y:a+ne/2,dominantBaseline:"middle",fill:Dt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Dt?"line-through":"none"},children:B})})(),ve>100&&e.progress>0&&e.progress<100&&!W&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+ve-12,y:a+ne/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&&ve>80&&!W&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+ve-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+ve-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(V||ie)&&!te&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?Q-15:Q-10,y:a-5,width:rt?25:20,height:ne+10,fill:"transparent",onMouseDown:ee=>Ue(ee,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?Q-8:Q-3,y:a+6,width:rt?8:6,height:rt?ne-12:ne-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Q+ve-10,y:a-5,width:rt?25:20,height:ne+10,fill:"transparent",onMouseDown:ee=>Ue(ee,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?Q+ve:Q+ve-3,y:a+6,width:rt?8:6,height:rt?ne-12:ne-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ne/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ee=>{ee.stopPropagation(),Ue(ee,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ne/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),te&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ne/2,x2:T.x,y2:T.y,stroke:H?o.statusCompleted:o.accent,strokeWidth:H?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:H?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:H?8:6,fill:H?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),H&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(V||W)&&!te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:ve+4,height:ne+4,rx:Ve+2,fill:"none",stroke:W?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:W?.6:.4,initial:{opacity:0},animate:{opacity:W?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+w,y1:0,x2:h+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!e.segments&&!f&&(()=>{let B=a<100,G=B?a+ne+13:a-82-13,K=B?`M ${Q+ve/2-6} ${a+ne+3} L ${Q+ve/2} ${a+ne+13} L ${Q+ve/2+6} ${a+ne+3}`:`M ${Q+ve/2-6} ${a-13} L ${Q+ve/2} ${a-3} L ${Q+ve/2+6} ${a-13}`,oe=G+22,q=G+40,xe=G+55,le=G+70,R=B?G+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:B?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:B?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:K,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+ve/2-120,y:G,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:Q+ve/2,y:oe,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:Q+ve/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+ve/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ht(e.startDate)}),jsxRuntime.jsx("text",{x:Q+ve/2-110,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+ve/2-70,y:xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ht(e.endDate)}),jsxRuntime.jsx("text",{x:Q+ve/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+ve/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:we()}),jsxRuntime.jsx("text",{x:Q+ve/2+10,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+ve/2+65,y:xe,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:Q+ve/2-110,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+ve/2-50,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(se=>se.name).join(", ").substring(0,30),e.assignees.map(se=>se.name).join(", ").length>30?"...":""]})]}),!B&&jsxRuntime.jsx("text",{x:Q+ve/2,y:R,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":rt?"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 Kl({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,m=82,n=13,p=c?o+d+n:o-m-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=p+22,u=p+40,v=p+55,f=p+70,y=c?p+m-5:o-18,x=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let D=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${D} day${D!==1?"s":""}`},g=s<50,C=s<40;return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,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:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?x(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?x(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,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:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(D=>D.name).join(", ").substring(0,30),a.assignees.map(D=>D.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+s/2,y,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:C?"Left: move \u2022 Right: resize":g?"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 Lo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,m]=react.useState(false),n=a-e,p=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(p,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;return react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:C=>{C.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Bo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=react.useState(false),c=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(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 ae={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=n=>{n.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,m=n=>{if(!d.has(n)){d.add(n),c.add(n);let p=r.get(n)||[];for(let l of p){if(!d.has(l)&&m(l))return true;if(c.has(l))return true}}return c.delete(n),false};return m(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=ae.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ae.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ae.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=ae.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(`
|
|
46
46
|
`)},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=ae.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=ae.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)=>ae.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ae.findTaskById(e,t);return !a||!a.dependencies?[]:ae.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ae.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ae.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=ae.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=>ae.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=ae.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 d=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(m=>{let n=m.startDate&&m.endDate?ae.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ae.formatDate(m.startDate):"N/A",m.endDate?ae.formatDate(m.endDate):"N/A",n>0?`${n} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:d,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ae.flattenTasks(e).map(m=>{let n=m.startDate&&m.endDate?ae.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ae.formatDate(m.startDate):"","End Date":m.endDate?ae.formatDate(m.endDate):"","Duration (days)":n>0?n:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(p=>p.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),d=[{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"]=d;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ae.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),d=ae.getEarliestStartDate(e)||new Date,c=ae.getLatestEndDate(e)||new Date,m=r.map((i,u)=>{let v=o.get(i.id),f=i.startDate&&i.endDate?ae.calculateDuration(i.startDate,i.endDate):0,y=(i.dependencies||[]).filter(x=>o.has(x)).map(x=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${o.get(x)}</PredecessorUID>
|
|
@@ -273,9 +273,9 @@
|
|
|
273
273
|
</Calendars>
|
|
274
274
|
<Tasks>${m}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,p=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=ae.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let p=n.startDate&&n.endDate?ae.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+p;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let p=n.startDate&&n.endDate?ae.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-p;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let m=[];for(let n of a){let p=r.get(n.id),l=d.get(n.id);if(p&&l){let i=l.ls-p.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ae.calculateCriticalPath(e).includes(t))return 0;let o=ae.getDependentTasks(e,t);if(o.length===0){let c=ae.getLatestEndDate(e);if(!c)return null;let m=ae.calculateDuration(a.endDate,c);return Math.max(0,m)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!s)return null;let d=ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ae.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ae.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=ae.calculateDuration(d.startDate,d.endDate),m;a!==void 0?(m=new Date(d.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=ae.calculateEndDate(m,c),p=l=>l.map(i=>i.id===d.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=ae.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let m=[],n=o.getTime(),p=1e3*60*60*24,l=ae.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=ae.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex($=>$.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/p,A=(g-n)/p*s,w=A+v*s,L=Math.max(D*s,s),T=c+b*d+12;m.push({taskId:x.id,taskName:x.name,originalX:A,previewX:w,width:L,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ae.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 d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=p=>p.map(l=>l.id===o.id?{...l,endDate:c,segments:m}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Oo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,C]=react.useState(null),D=react.useCallback(S=>{b(S);},[]),h=react.useCallback(S=>{C(S);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,L=A*w*d,T=S=>{let F=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),M=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-M);let V=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-V.getTime())/864e5+1)/7)},$=S=>{let F=S.getDay();return F===0||F===6},H=react.useCallback(S=>{let F=Math.round(S/(w*d)),M=new Date(o);return M.setDate(M.getDate()+F),M},[o,w,d]),U=react.useCallback((S,F)=>{if(F.startDate&&F.endDate)return;let M=S.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=S.clientX,V.y=S.clientY;let P=V.matrixTransform(M.getScreenCTM()?.inverse()),W=H(P.x),le=new Date(W);le.setDate(le.getDate()+1),l?.(F,W,le);},[H,l]),E=react.useMemo(()=>{let S=P=>P.map(W=>{if(W.subtasks&&W.subtasks.length>0){let le=S(W.subtasks),te=le.filter(Se=>Se.startDate&&Se.endDate);if(te.length>0){let Se=te.map(tt=>tt.startDate.getTime()),ne=te.map(tt=>tt.endDate.getTime()),Ve=new Date(Math.min(...Se)),be=new Date(Math.max(...ne));return {...W,subtasks:le,startDate:Ve,endDate:be}}return {...W,subtasks:le}}return W}),F=(P,W=[])=>{for(let le of P)W.push(le),le.subtasks&&le.subtasks.length>0&&(le.isExpanded===void 0||le.isExpanded)&&F(le.subtasks,W);return W},M=S(e);return F(M)},[e]),J=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let F=S.startDate.getTime(),M=S.endDate.getTime(),V=o.getTime(),P=(F-V)/(1e3*60*60*24),W=(M-F)/(1e3*60*60*24),le=P*w*d,te=Math.max(w*d,40),Se=Math.max(W*w*d,te);return {x:le,width:Se}},[o,w,d]),ge=react.useMemo(()=>E.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:F,width:M}=J(S),P=E.findIndex(W=>W.id===S.id)*a+12;return {id:S.id,x:F,y:P,width:M,height:32}}),[E,J]),ke=react.useCallback((S,F,M)=>{if(!M||F===0){y([]);return}let V=ae.calculateCascadePreview(e,S,F,E,o,w*d,a,48);y(V);},[e,E,o,w,d,a,48]),Le=react.useMemo(()=>{let S=[],F=new Date(o);for(;F<=s;){let P=(F.getTime()-o.getTime())/864e5*w*d;if(r==="day")S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:P}),F.setDate(F.getDate()+1);else if(r==="week"){let W=T(F);S.push({date:new Date(F),label:`Week ${W}`,x:P}),F.setDate(F.getDate()+7);}else S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:P}),F.setMonth(F.getMonth()+1);}return S},[o,s,r,w,d]),Ee=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),de=Math.max(E.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(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),Le.map((S,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${F}`)),Ee>=0&&Ee<=L&&jsxRuntime.jsx("circle",{cx:Ee,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:de,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(L,1e3),height:de,fill:t.bgPrimary}),Le.map((S,F)=>{let M=Le[F+1]?.x||L,V=$(S.date);return jsxRuntime.jsxs("g",{children:[V&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:M-S.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Ee>=0&&Ee<=L&&jsxRuntime.jsx("line",{x1:Ee,y1:0,x2:Ee,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((S,F)=>{let M=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>U(V,S),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Ee>0?Ee:100,y:F*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-${S.id}`)]})]},`row-group-${S.id}`)}),E.map((S,F)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(M=>{let V=E.find(te=>te.id===M);if(!V||!V.startDate||!V.endDate)return null;let P=E.findIndex(te=>te.id===M),W=J(V),le=J(S);return jsxRuntime.jsx(Lo,{x1:W.x+W.width,y1:P*a+a/2,x2:le.x,y2:F*a+a/2,theme:t,onDelete:()=>u?.(S.id,M),onHoverChange:h},`dep-${M}-${S.id}`)})),E.map((S,F)=>{if(!S.startDate||!S.endDate)return null;let{x:M,width:V}=J(S),P=F*a+12,W=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Bo,{task:S,x:M+V/2,y:P+16,theme:t,onClick:m},S.id):W?jsxRuntime.jsxs("g",{onClick:()=>m?.(S),onContextMenu:le=>{le.preventDefault(),le.stopPropagation(),p?.(S,le);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:M,y:P,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M+V,y2:P,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M+V,y1:P,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P+32,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsxRuntime.jsx("text",{x:M+12,y:P+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(Mo,{task:S,x:M,y:P,width:V,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:ge,onDragMove:ke,onHoverChange:D},S.id)}),f.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:F,x2:M,y2:V,onDelete:P}=g,W=M-S,le=V-F,te=S+W/2,Se=(F+V)/2,ne=`M ${S} ${F} C ${te} ${F}, ${te} ${V}, ${M} ${V}`,Ve=6,be=Math.atan2(le,W),tt=M-Ve*Math.cos(be-Math.PI/6),Tt=V-Ve*Math.sin(be-Math.PI/6),Dt=M-Ve*Math.cos(be+Math.PI/6),yt=V-Ve*Math.sin(be+Math.PI/6),Nt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ne,fill:"none",stroke:Nt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${M} ${V} L ${tt} ${Tt} M ${M} ${V} L ${Dt} ${yt}`,fill:"none",stroke:Nt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:M,cy:V,r:5,fill:Nt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:Mt=>{Mt.stopPropagation(),P();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:te,cy:Se,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:te-4,y1:Se-4,x2:te+4,y2:Se+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:te+4,y1:Se-4,x2:te-4,y2:Se+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(Kl,{tooltipData:x,theme:t})]})]})}var Uo=[{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"}];var bs=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],hs=[{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 zo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:n=[]}){let p=[...bs,...n.filter(P=>!bs.some(W=>W.id===P.id))],l=Oe[m]||Oe.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[C,D]=react.useState(null),[h,A]=react.useState(new Date),[w,L]=react.useState(false),T=react.useRef(null),$=react.useRef(null),H=react.useRef(null),U=react.useRef(null),[E,J]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[ge,ke]=react.useState({});react.useEffect(()=>{a?(J({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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&L(true)):(J({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),react.useEffect(()=>{let P=W=>{T.current&&!T.current.contains(W.target)&&u(false),$.current&&!$.current.contains(W.target)&&f(false),H.current&&!H.current.contains(W.target)&&x(false),U.current&&!U.current.contains(W.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Le=()=>{let P={};return E.name.trim()||(P.name="El nombre es requerido"),E.startDate&&E.endDate&&E.startDate>E.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),ke(P),Object.keys(P).length===0},Ee=async P=>{if(P.preventDefault(),!!Le())try{await s(E),t();}catch(W){console.error("Error submitting task:",W);}},de=(P,W)=>{J(le=>{let te={...le,[P]:W};if(P==="status"){let Se=W;Se==="todo"?te.progress=0:Se==="in-progress"?(le.progress===0||le.progress===100)&&(te.progress=50):Se==="completed"||Se==="closed"?te.progress=100:(Se==="in-review"||Se==="review")&&(te.progress=75);}if(P==="progress"){let Se=typeof W=="number"?W:parseInt(W,10);Se===100&&le.status!=="completed"?te.status="completed":Se>0&&Se<100&&le.status==="todo"?te.status="in-progress":Se===0&&le.status!=="todo"&&(te.status="todo");}return te}),ge[P]&&ke(le=>{let te={...le};return delete te[P],te});},S=p.find(P=>P.id===E.status)??bs[0],F=hs.find(P=>P.id===E.priority)??hs[1],M=Uo.find(P=>P.value===E.color)??Uo[0],V={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.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",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ee,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:E.name,onChange:P=>de("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),ge.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"}),ge.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:E.description||"",onChange:P=>de("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:T,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:S.color,backgroundColor:`${S.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),jsxRuntime.jsx("span",{style:{color:S.color},children:S.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:S.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&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:l.bgPrimary,border:`1px solid ${l.border}`},children:p.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{de("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,E.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:F.color}}),jsxRuntime.jsx("span",{children:F.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:hs.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{de("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,E.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:H,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[E.assignees&&E.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:E.assignees.slice(0,3).map((P,W)=>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:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},W))}),E.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",E.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.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:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let W=E.assignees?.some(le=>le.name===P.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:l.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=W?(E.assignees||[]).filter(te=>te.name!==P.name):[...E.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(te=>te[0]).join("").toUpperCase().slice(0,2),color:l.accent}];de("assignees",le);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{children:M.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 20px)",gap:"16px"},children:Uo.slice(0,16).map(P=>{let W=E.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{de("color",P.value),g(false);},style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:P.value,outline:W?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.15},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="start"?null:"start"),A(E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.startDate?E.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="end"?null:"end"),A(E.endDate||E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.endDate?E.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,W=new Date(P);W.setDate(P.getDate()+1);let le=new Date(P);le.setDate(P.getDate()+7);let te=new Date(P);return te.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:te}].map((ne,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:be=>be.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(de("startDate",ne.date),(!E.endDate||ne.date>E.endDate)&&de("endDate",ne.date),D("end")):(de("endDate",ne.date),(!E.startDate||ne.date<E.startDate)&&de("startDate",ne.date),D(null));},children:ne.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.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:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{de("startDate",void 0),de("endDate",void 0),D(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,W)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),W=h.getMonth(),le=new Date(P,W,1).getDay(),te=new Date(P,W+1,0).getDate(),Se=new Date,ne=[];for(let be=le-1;be>=0;be--)ne.push({day:new Date(P,W,-be).getDate(),date:new Date(P,W-1,new Date(P,W,-be).getDate()),isCurrentMonth:false});for(let be=1;be<=te;be++)ne.push({day:be,date:new Date(P,W,be),isCurrentMonth:true});let Ve=42-ne.length;for(let be=1;be<=Ve;be++)ne.push({day:be,date:new Date(P,W+1,be),isCurrentMonth:false});return ne.map((be,tt)=>{let Tt=be.date.toDateString()===Se.toDateString(),Dt=E.startDate?.toDateString()===be.date.toDateString(),yt=E.endDate?.toDateString()===be.date.toDateString(),Nt=E.startDate&&E.endDate&&be.date>=E.startDate&&be.date<=E.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:be.isCurrentMonth?Dt||yt?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:Dt?"#3B82F6":yt?"#7C3AED":Nt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Tt&&!Dt&&!yt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(de("startDate",be.date),E.endDate&&be.date>E.endDate&&de("endDate",be.date),D("end")):(de("endDate",be.date),E.startDate&&be.date<E.startDate&&de("startDate",be.date),D(null));},children:be.day},tt)})})()})]})]})]})})]}),ge.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ge.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.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:E.progress,onChange:P=>de("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"}20`,color:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},children:[E.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(!w),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${w?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("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:E.isMilestone,onChange:P=>de("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.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:l.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:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let W=E.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let le=W?(E.dependencies||[]).filter(te=>te!==P.id):[...E.dependencies||[],P.id];de("dependencies",le);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:W?`${l.accent}30`:l.bgPrimary,color:W?l.accent:l.textSecondary,border:`1px solid ${W?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Lg=['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"'],Zl=()=>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"})]}),Fg=()=>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"})}),Bg=()=>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"})}),Rg=()=>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"})}),Og=()=>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 Wo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:m}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,C]=react.useState(true),D=react.useRef(null),h=react.useRef(null),A=react.useRef(null),{enabled:w=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:$,suggestions:H=Lg,maxHistory:U=50,persistHistory:E}=a,J=E?.storageKey||"gantt-ai-history",ge=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let F=localStorage.getItem(J);if(F){let V=JSON.parse(F).map(P=>({...P,timestamp:new Date(P.timestamp)}));v(V.slice(-ge));}}catch(F){console.warn("[GanttAIAssistant] Failed to load persisted history:",F);}},[E?.enabled,J,ge]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let F=u.filter(M=>!M.isLoading).slice(-ge);localStorage.setItem(J,JSON.stringify(F));}catch(F){console.warn("[GanttAIAssistant] Failed to persist history:",F);}},[u,E?.enabled,J,ge]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let ke=react.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&o?.(F.taskId,F.updates);break;case "create_task":F.newTask&&s?.(F.newTask);break;case "delete_task":F.taskId&&d?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&m?.(F.taskId,F.dependencyFrom);break}},[o,s,d,c,m]),Le=react.useCallback(async F=>{if(!F.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};v(P=>[...P.slice(-(U-1)),M]),y(""),C(false),b(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(P=>[...P,V]);try{if($){let P=await $(F,e);v(W=>{let le=W.filter(Se=>!Se.isLoading),te={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...le,te]}),ke(P);}else v(P=>[...P.filter(le=>!le.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(P){v(W=>[...W.filter(te=>!te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,U,$,e,ke]),Ee=F=>{F.preventDefault(),Le(f);},de=F=>{y(F),D.current?.focus();};if(react.useEffect(()=>{let F=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(V=>!V),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n]),react.useEffect(()=>{if(!n)return;let F=V=>{let P=V.target;A.current&&!A.current.contains(P)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",F);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",F);}},[n]),!w)return null;let S={"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(Ke,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&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 ${S[T]} 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:()=>p(true),children:[jsxRuntime.jsx(Zl,{}),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:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[T]} 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(Zl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Rg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Bg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&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:H.slice(0,4).map((F,M)=>jsxRuntime.jsx("button",{onClick:()=>de(F),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:F.length>30?F.slice(0,30)+"...":F},M))})]}),u.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Og,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Ee,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:D,type:"text",value:f,onChange:F=>y(F.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Fg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ql(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!p)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:l}});},[]),m=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function ed({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?d.metaKey:d.ctrlKey;if(m&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&m&&d.key==="y"){d.preventDefault(),t();return}if(c&&m&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Wg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ae.formatDate(e.startDate)} - ${ae.formatDate(e.endDate)}`);let a=ae.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=>ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function td(e){return {...Wg,...e}}var Yg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},od=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:C,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:A,onProgressChange:w,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:H,onDependencyCreate:U,onDependencyDelete:E,onBeforeTaskAdd:J,onAfterTaskAdd:ge,onBeforeTaskUpdate:ke,onAfterTaskUpdate:Le,onBeforeTaskDelete:Ee,onAfterTaskDelete:de}=a,F=react.useContext(Co)?.theme,[M,V]=react.useState(F||s||"dark"),[P,W]=react.useState(d),[le,te]=react.useState(c),[Se,ne]=react.useState(1),[Ve,be]=react.useState(0),[tt,Tt]=react.useState(false),[Dt,yt]=react.useState(null),[Nt,Mt]=react.useState({isOpen:false,x:0,y:0,task:null}),[ra,mt]=react.useState(null),[rt,Lt]=react.useState(null);react.useEffect(()=>{F&&F!==M&&V(F);},[F]),react.useEffect(()=>{s&&s!==M&&V(s);},[s]);let Ht=react.useCallback(N=>{V(N),g?.(N);},[g]),{state:we,setState:O,undo:Te,redo:$e,canUndo:Ue,canRedo:pt,clearHistory:X}=Ql(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),ve=react.useRef(true);react.useEffect(()=>{if(ve.current){ve.current=false,Q.current=we;return}if(!r)return;let N=JSON.stringify(Q.current),z=JSON.stringify(we);N!==z&&(Q.current=we,r(we));},[we,r]);let fe=react.useMemo(()=>es(v,f),[v,f]),ee=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ce,B]=react.useState(()=>ee(fe));react.useEffect(()=>{B(N=>N.map(z=>({...z,label:fe.columns[z.id==="name"?"taskName":z.id]||z.label})));},[fe]);let G=react.useMemo(()=>Ce.filter(N=>N.visible).reduce((N,z)=>N+z.width,0)+60,[Ce]),K=react.useMemo(()=>Dt!==null?Math.max(280,Dt,G):Math.max(280,G),[Dt,G]),oe=react.useRef(null),q=react.useRef(null),xe=react.useRef(null),se=react.useMemo(()=>Cl(M),[M]),R=react.useMemo(()=>({theme:se,themeName:M}),[se,M]),ie=react.useMemo(()=>td(l),[l]),Ae=react.useMemo(()=>{if(!i)return we;let N=ae.calculateCriticalPath(we),z=Y=>Y.map(ce=>({...ce,isCriticalPath:N.includes(ce.id),subtasks:ce.subtasks?z(ce.subtasks):void 0}));return z(we)},[we,i]),at=Yg(le);ed({undo:Te,redo:$e,canUndo:Ue,canRedo:pt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>ae.findTaskById(we,N),addTask:(N,z)=>{O(Y=>{if(!z)return [...Y,{...N,level:0}];let ce=he=>he.map(Ne=>Ne.id===z?{...Ne,subtasks:[...Ne.subtasks||[],{...N,parentId:z,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:ce(Ne.subtasks)}:Ne);return ce(Y)});},updateTask:(N,z)=>{O(Y=>{let ce=he=>he.map(Ne=>Ne.id===N?{...Ne,...z}:Ne.subtasks?{...Ne,subtasks:ce(Ne.subtasks)}:Ne);return ce(Y)});},deleteTask:N=>{O(z=>{let Y=ce=>ce.filter(he=>he.id===N?false:(he.subtasks&&(he.subtasks=Y(he.subtasks)),true));return Y(z)});},deleteTasks:N=>{O(z=>is(z,N));},duplicateTask:N=>{O(z=>ls(z,[N]));},splitTask:(N,z,Y=3)=>{O(ce=>ae.splitTask(ce,N,z,Y));},calculateEndDate:ae.calculateEndDate,calculateDuration:ae.calculateDuration,validateDependency:(N,z)=>!ae.validateDependencies(we,N,z),getAllTasks:()=>ae.flattenTasks(we),getTasksByStatus:N=>ae.flattenTasks(we).filter(z=>z.status===N),getTasksByParent:N=>N?ae.findTaskById(we,N)?.subtasks||[]:we.filter(Y=>!Y.parentId),getCriticalPath:()=>ae.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{O(z=>os(z,[N]));},outdentTask:N=>{O(z=>ns(z,[N]));},moveTask:(N,z)=>{O(Y=>ss(Y,[N],z));},createSubtask:async N=>{let{tasks:z,newTask:Y}=ms(we,N);if(J){let ce=J({...Y,parentId:N});if((ce instanceof Promise?await ce:ce)===false)return}O(z),ge&&ge({...Y,parentId:N});},scrollToTask:N=>{let Y=ae.flattenTasks(we).findIndex(ce=>ce.id===N);if(Y!==-1&&oe.current){let ce=Y*at;oe.current.scrollTo({top:ce,behavior:"smooth"}),q.current&&q.current.scrollTo({top:ce,behavior:"smooth"});}},highlightTask:(N,z=2e3)=>{},expandTask:N=>{O(z=>{let Y=ce=>ce.map(he=>he.id===N?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:Y(he.subtasks)}:he);return Y(z)});},collapseTask:N=>{O(z=>{let Y=ce=>ce.map(he=>he.id===N?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:Y(he.subtasks)}:he);return Y(z)});},expandAll:()=>{O(N=>{let z=Y=>Y.map(ce=>({...ce,isExpanded:true,subtasks:ce.subtasks?z(ce.subtasks):void 0}));return z(N)});},collapseAll:()=>{O(N=>{let z=Y=>Y.map(ce=>({...ce,isExpanded:false,subtasks:ce.subtasks?z(ce.subtasks):void 0}));return z(N)});},undo:Te,redo:$e,canUndo:()=>Ue,canRedo:()=>pt,clearHistory:X,exportToPNG:async()=>{if(!xe.current)throw new Error("Gantt container not found");let N=await rd__default.default(xe.current,{backgroundColor:se.bgPrimary,scale:2});return new Promise((z,Y)=>{N.toBlob(ce=>{ce?z(ce):Y(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await ae.exportToPDF(we,N);},exportToExcel:async N=>{await ae.exportToExcel(we,N);},exportToJSON:()=>ae.exportToJSON(we),exportToCSV:()=>ae.exportToCSV(we),importFromJSON:N=>{let z=ae.importFromJSON(N);O(z);},getTasks:()=>we,refresh:()=>{O(N=>[...N]);},clearAll:()=>{O([]);}}),[we,Te,$e,Ue,pt,X,se,at]);let De=react.useCallback(N=>{B(z=>z.map(Y=>Y.id===N?{...Y,visible:!Y.visible}:Y));},[]),ja=react.useCallback((N,z)=>{B(Y=>Y.map(ce=>{if(ce.id!==N)return ce;let he=ce.minWidth??100,Ne=ce.maxWidth??800,kt=Math.max(he,Math.min(Ne,z));return {...ce,width:kt}}));},[]),cr=react.useCallback(N=>{O(z=>cs(z,N)),a.onTaskToggleExpand?.(N);},[a]),mr=react.useCallback((N,z)=>{if(ke&&ke(N,z)===false)return;let ce=ae.findTaskById(we,N)?.progress,he=kt=>kt.map($t=>$t.id===N?{...$t,...z}:$t.subtasks?{...$t,subtasks:he($t.subtasks)}:$t);O(he(we));let Ne=ae.findTaskById(he(we),N);Ne&&(A?.(Ne),Le?.(Ne),z.progress!==void 0&&ce!==void 0&&z.progress!==ce&&w?.(N,ce,z.progress));},[we,A,ke,Le,w]),yc=react.useCallback(N=>{N.length!==0&&(O(z=>os(z,N)),a.onTaskIndent?.(N[0]));},[a]),vc=react.useCallback(N=>{N.length!==0&&(O(z=>ns(z,N)),a.onTaskOutdent?.(N[0]));},[a]),xc=react.useCallback((N,z,Y)=>{O(ce=>Hl(ce,N,z,Y)),a.onTaskReparent?.(N,z,Y);},[a]),kc=react.useCallback((N,z)=>{N.length!==0&&(O(Y=>ss(Y,N,z)),a.onTaskMove?.(N[0],z));},[a]),ln=react.useCallback(async N=>{let z=[];for(let Y of N)Ee&&await Promise.resolve(Ee(Y))===false||z.push(Y);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):(O(Y=>is(Y,z)),z.forEach(Y=>a.onTaskDelete?.(Y))),de&&z.forEach(Y=>de(Y)));},[a,Ee,de]),wc=react.useCallback(N=>{O(z=>ls(z,N)),N.forEach(z=>a.onTaskDuplicate?.(z));},[a]),Cc=react.useCallback((N,z)=>{O(Y=>{let{tasks:ce,newTask:he}=Gl(Y,N,z);return J&&J(he)===false?Y:(a.onTaskCreate?.(he.parentId,he.position||0),ge?.(he),ce)});},[a,J,ge]),Tc=react.useCallback((N,z)=>{O(Y=>ds(Y,N,z)),a.onTaskRename?.(N,z);},[a]),dn=react.useCallback(N=>{O(z=>{let{tasks:Y}=ms(z,N);return a.onTaskCreate?.(N,0),Y});},[a]),Dc=react.useCallback((N,z,Y)=>{let ce=N.startDate?Math.round((z.getTime()-N.startDate.getTime())/864e5):0,he=$t=>$t.map(da=>da.id===N.id?{...da,startDate:z,endDate:Y,...N.segments&&{segments:N.segments}}:da.subtasks?{...da,subtasks:he(da.subtasks)}:da),Ne=he(we);Ne=ae.autoScheduleDependents(Ne,N.id,ce),O(Ne);let kt={...N,startDate:z,endDate:Y};A?.(kt);},[we,A]),Nc=react.useCallback((N,z)=>{h?.(N,z),Mt({isOpen:true,x:z.clientX,y:z.clientY,task:N});},[h]),Sc=react.useCallback((N,z)=>{let Y=ae.splitTask(we,N.id,z);O(Y),Mt({isOpen:false,x:0,y:0,task:null});},[we]),pi=react.useCallback(N=>{D?.(N),L||mt(N);},[D,L]),ui=react.useCallback((N,z,Y)=>{let ce=new Map,he=ca=>{ca.forEach(Na=>{Na.dependencies&&ce.set(Na.id,Na.dependencies),Na.subtasks&&he(Na.subtasks);});};he(Y);let Ne=ce.get(z)||[];ce.set(z,[...Ne,N]);let kt=new Set,$t=new Set,da=ca=>{if(!kt.has(ca)){kt.add(ca),$t.add(ca);let Na=ce.get(ca)||[];for(let Lr of Na){if(!kt.has(Lr)&&da(Lr))return true;if($t.has(Lr))return true}}return $t.delete(ca),false};return da(z)},[]),gi=react.useCallback((N,z)=>{if(ui(N.id,z,we)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,p=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=ae.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let p=n.startDate&&n.endDate?ae.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+p;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let p=n.startDate&&n.endDate?ae.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-p;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let m=[];for(let n of a){let p=r.get(n.id),l=d.get(n.id);if(p&&l){let i=l.ls-p.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ae.calculateCriticalPath(e).includes(t))return 0;let o=ae.getDependentTasks(e,t);if(o.length===0){let c=ae.getLatestEndDate(e);if(!c)return null;let m=ae.calculateDuration(a.endDate,c);return Math.max(0,m)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!s)return null;let d=ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ae.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ae.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=ae.calculateDuration(d.startDate,d.endDate),m;a!==void 0?(m=new Date(d.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=ae.calculateEndDate(m,c),p=l=>l.map(i=>i.id===d.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=ae.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let m=[],n=o.getTime(),p=1e3*60*60*24,l=ae.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=ae.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex(z=>z.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/p,A=(g-n)/p*s,w=A+v*s,L=Math.max(D*s,s),T=c+b*d+12;m.push({taskId:x.id,taskName:x.name,originalX:A,previewX:w,width:L,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ae.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 d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=p=>p.map(l=>l.id===o.id?{...l,endDate:c,segments:m}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Oo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,C]=react.useState(null),D=react.useCallback(S=>{b(S);},[]),h=react.useCallback(S=>{C(S);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,L=A*w*d,T=S=>{let F=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),M=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-M);let V=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-V.getTime())/864e5+1)/7)},z=S=>{let F=S.getDay();return F===0||F===6},H=react.useCallback(S=>{let F=Math.round(S/(w*d)),M=new Date(o);return M.setDate(M.getDate()+F),M},[o,w,d]),U=react.useCallback((S,F)=>{if(F.startDate&&F.endDate)return;let M=S.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=S.clientX,V.y=S.clientY;let P=V.matrixTransform(M.getScreenCTM()?.inverse()),W=H(P.x),ie=new Date(W);ie.setDate(ie.getDate()+1),l?.(F,W,ie);},[H,l]),E=react.useMemo(()=>{let S=P=>P.map(W=>{if(W.subtasks&&W.subtasks.length>0){let ie=S(W.subtasks),te=ie.filter(Se=>Se.startDate&&Se.endDate);if(te.length>0){let Se=te.map(tt=>tt.startDate.getTime()),ne=te.map(tt=>tt.endDate.getTime()),Ve=new Date(Math.min(...Se)),be=new Date(Math.max(...ne));return {...W,subtasks:ie,startDate:Ve,endDate:be}}return {...W,subtasks:ie}}return W}),F=(P,W=[])=>{for(let ie of P)W.push(ie),ie.subtasks&&ie.subtasks.length>0&&(ie.isExpanded===void 0||ie.isExpanded)&&F(ie.subtasks,W);return W},M=S(e);return F(M)},[e]),J=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let F=S.startDate.getTime(),M=S.endDate.getTime(),V=o.getTime(),P=(F-V)/(1e3*60*60*24),W=(M-F)/(1e3*60*60*24),ie=P*w*d,te=Math.max(w*d,40),Se=Math.max(W*w*d,te);return {x:ie,width:Se}},[o,w,d]),ge=react.useMemo(()=>E.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:F,width:M}=J(S),P=E.findIndex(W=>W.id===S.id)*a+12;return {id:S.id,x:F,y:P,width:M,height:32}}),[E,J]),ke=react.useCallback((S,F,M)=>{if(!M||F===0){y([]);return}let V=ae.calculateCascadePreview(e,S,F,E,o,w*d,a,48);y(V);},[e,E,o,w,d,a,48]),Le=react.useMemo(()=>{let S=[],F=new Date(o);for(;F<=s;){let P=(F.getTime()-o.getTime())/864e5*w*d;if(r==="day")S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:P}),F.setDate(F.getDate()+1);else if(r==="week"){let W=T(F);S.push({date:new Date(F),label:`Week ${W}`,x:P}),F.setDate(F.getDate()+7);}else S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:P}),F.setMonth(F.getMonth()+1);}return S},[o,s,r,w,d]),Ee=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),de=Math.max(E.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(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),Le.map((S,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${F}`)),Ee>=0&&Ee<=L&&jsxRuntime.jsx("circle",{cx:Ee,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:de,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(L,1e3),height:de,fill:t.bgPrimary}),Le.map((S,F)=>{let M=Le[F+1]?.x||L,V=z(S.date);return jsxRuntime.jsxs("g",{children:[V&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:M-S.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Ee>=0&&Ee<=L&&jsxRuntime.jsx("line",{x1:Ee,y1:0,x2:Ee,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((S,F)=>{let M=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>U(V,S),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Ee>0?Ee:100,y:F*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-${S.id}`)]})]},`row-group-${S.id}`)}),E.map((S,F)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(M=>{let V=E.find(te=>te.id===M);if(!V||!V.startDate||!V.endDate)return null;let P=E.findIndex(te=>te.id===M),W=J(V),ie=J(S);return jsxRuntime.jsx(Lo,{x1:W.x+W.width,y1:P*a+a/2,x2:ie.x,y2:F*a+a/2,theme:t,onDelete:()=>u?.(S.id,M),onHoverChange:h},`dep-${M}-${S.id}`)})),E.map((S,F)=>{if(!S.startDate||!S.endDate)return null;let{x:M,width:V}=J(S),P=F*a+12,W=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Bo,{task:S,x:M+V/2,y:P+16,theme:t,onClick:m},S.id):W?jsxRuntime.jsxs("g",{onClick:()=>m?.(S),onContextMenu:ie=>{ie.preventDefault(),ie.stopPropagation(),p?.(S,ie);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:M,y:P,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M+V,y2:P,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M+V,y1:P,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P+32,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsxRuntime.jsx("text",{x:M+12,y:P+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(Mo,{task:S,x:M,y:P,width:V,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:ge,onDragMove:ke,onHoverChange:D},S.id)}),f.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:F,x2:M,y2:V,onDelete:P}=g,W=M-S,ie=V-F,te=S+W/2,Se=(F+V)/2,ne=`M ${S} ${F} C ${te} ${F}, ${te} ${V}, ${M} ${V}`,Ve=6,be=Math.atan2(ie,W),tt=M-Ve*Math.cos(be-Math.PI/6),Tt=V-Ve*Math.sin(be-Math.PI/6),Dt=M-Ve*Math.cos(be+Math.PI/6),yt=V-Ve*Math.sin(be+Math.PI/6),Nt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ne,fill:"none",stroke:Nt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${M} ${V} L ${tt} ${Tt} M ${M} ${V} L ${Dt} ${yt}`,fill:"none",stroke:Nt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:M,cy:V,r:5,fill:Nt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:Mt=>{Mt.stopPropagation(),P();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:te,cy:Se,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:te-4,y1:Se-4,x2:te+4,y2:Se+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:te+4,y1:Se-4,x2:te-4,y2:Se+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(Kl,{tooltipData:x,theme:t})]})]})}var Uo=[{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"}];var bs=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],hs=[{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 $o({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:n=[]}){let p=[...bs,...n.filter(P=>!bs.some(W=>W.id===P.id))],l=Oe[m]||Oe.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[C,D]=react.useState(null),[h,A]=react.useState(new Date),[w,L]=react.useState(false),T=react.useRef(null),z=react.useRef(null),H=react.useRef(null),U=react.useRef(null),[E,J]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[ge,ke]=react.useState({});react.useEffect(()=>{a?(J({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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&L(true)):(J({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),react.useEffect(()=>{let P=W=>{T.current&&!T.current.contains(W.target)&&u(false),z.current&&!z.current.contains(W.target)&&f(false),H.current&&!H.current.contains(W.target)&&x(false),U.current&&!U.current.contains(W.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Le=()=>{let P={};return E.name.trim()||(P.name="El nombre es requerido"),E.startDate&&E.endDate&&E.startDate>E.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),ke(P),Object.keys(P).length===0},Ee=async P=>{if(P.preventDefault(),!!Le())try{await s(E),t();}catch(W){console.error("Error submitting task:",W);}},de=(P,W)=>{J(ie=>{let te={...ie,[P]:W};if(P==="status"){let Se=W;Se==="todo"?te.progress=0:Se==="in-progress"?(ie.progress===0||ie.progress===100)&&(te.progress=50):Se==="completed"||Se==="closed"?te.progress=100:(Se==="in-review"||Se==="review")&&(te.progress=75);}if(P==="progress"){let Se=typeof W=="number"?W:parseInt(W,10);Se===100&&ie.status!=="completed"?te.status="completed":Se>0&&Se<100&&ie.status==="todo"?te.status="in-progress":Se===0&&ie.status!=="todo"&&(te.status="todo");}return te}),ge[P]&&ke(ie=>{let te={...ie};return delete te[P],te});},S=p.find(P=>P.id===E.status)??bs[0],F=hs.find(P=>P.id===E.priority)??hs[1],M=Uo.find(P=>P.value===E.color)??Uo[0],V={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.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",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ee,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:E.name,onChange:P=>de("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),ge.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"}),ge.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:E.description||"",onChange:P=>de("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:T,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:S.color,backgroundColor:`${S.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),jsxRuntime.jsx("span",{style:{color:S.color},children:S.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:S.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&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:l.bgPrimary,border:`1px solid ${l.border}`},children:p.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{de("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,E.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:F.color}}),jsxRuntime.jsx("span",{children:F.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:hs.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{de("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,E.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:H,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[E.assignees&&E.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:E.assignees.slice(0,3).map((P,W)=>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:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},W))}),E.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",E.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.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:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let W=E.assignees?.some(ie=>ie.name===P.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:l.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=W?(E.assignees||[]).filter(te=>te.name!==P.name):[...E.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(te=>te[0]).join("").toUpperCase().slice(0,2),color:l.accent}];de("assignees",ie);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{children:M.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:Uo.slice(0,16).map(P=>{let W=E.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{de("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:W?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="start"?null:"start"),A(E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.startDate?E.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="end"?null:"end"),A(E.endDate||E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.endDate?E.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,W=new Date(P);W.setDate(P.getDate()+1);let ie=new Date(P);ie.setDate(P.getDate()+7);let te=new Date(P);return te.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:te}].map((ne,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:be=>be.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(de("startDate",ne.date),(!E.endDate||ne.date>E.endDate)&&de("endDate",ne.date),D("end")):(de("endDate",ne.date),(!E.startDate||ne.date<E.startDate)&&de("startDate",ne.date),D(null));},children:ne.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.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:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{de("startDate",void 0),de("endDate",void 0),D(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,W)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),W=h.getMonth(),ie=new Date(P,W,1).getDay(),te=new Date(P,W+1,0).getDate(),Se=new Date,ne=[];for(let be=ie-1;be>=0;be--)ne.push({day:new Date(P,W,-be).getDate(),date:new Date(P,W-1,new Date(P,W,-be).getDate()),isCurrentMonth:false});for(let be=1;be<=te;be++)ne.push({day:be,date:new Date(P,W,be),isCurrentMonth:true});let Ve=42-ne.length;for(let be=1;be<=Ve;be++)ne.push({day:be,date:new Date(P,W+1,be),isCurrentMonth:false});return ne.map((be,tt)=>{let Tt=be.date.toDateString()===Se.toDateString(),Dt=E.startDate?.toDateString()===be.date.toDateString(),yt=E.endDate?.toDateString()===be.date.toDateString(),Nt=E.startDate&&E.endDate&&be.date>=E.startDate&&be.date<=E.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:be.isCurrentMonth?Dt||yt?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:Dt?"#3B82F6":yt?"#7C3AED":Nt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Tt&&!Dt&&!yt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(de("startDate",be.date),E.endDate&&be.date>E.endDate&&de("endDate",be.date),D("end")):(de("endDate",be.date),E.startDate&&be.date<E.startDate&&de("startDate",be.date),D(null));},children:be.day},tt)})})()})]})]})]})})]}),ge.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ge.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.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:E.progress,onChange:P=>de("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"}20`,color:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},children:[E.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(!w),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${w?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("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:E.isMilestone,onChange:P=>de("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.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:l.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:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let W=E.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ie=W?(E.dependencies||[]).filter(te=>te!==P.id):[...E.dependencies||[],P.id];de("dependencies",ie);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:W?`${l.accent}30`:l.bgPrimary,color:W?l.accent:l.textSecondary,border:`1px solid ${W?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Lg=['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"'],Zl=()=>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"})]}),Fg=()=>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"})}),Bg=()=>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"})}),Rg=()=>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"})}),Og=()=>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 Wo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:m}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,C]=react.useState(true),D=react.useRef(null),h=react.useRef(null),A=react.useRef(null),{enabled:w=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:z,suggestions:H=Lg,maxHistory:U=50,persistHistory:E}=a,J=E?.storageKey||"gantt-ai-history",ge=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let F=localStorage.getItem(J);if(F){let V=JSON.parse(F).map(P=>({...P,timestamp:new Date(P.timestamp)}));v(V.slice(-ge));}}catch(F){console.warn("[GanttAIAssistant] Failed to load persisted history:",F);}},[E?.enabled,J,ge]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let F=u.filter(M=>!M.isLoading).slice(-ge);localStorage.setItem(J,JSON.stringify(F));}catch(F){console.warn("[GanttAIAssistant] Failed to persist history:",F);}},[u,E?.enabled,J,ge]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let ke=react.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&o?.(F.taskId,F.updates);break;case "create_task":F.newTask&&s?.(F.newTask);break;case "delete_task":F.taskId&&d?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&m?.(F.taskId,F.dependencyFrom);break}},[o,s,d,c,m]),Le=react.useCallback(async F=>{if(!F.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};v(P=>[...P.slice(-(U-1)),M]),y(""),C(false),b(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(P=>[...P,V]);try{if(z){let P=await z(F,e);v(W=>{let ie=W.filter(Se=>!Se.isLoading),te={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...ie,te]}),ke(P);}else v(P=>[...P.filter(ie=>!ie.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(P){v(W=>[...W.filter(te=>!te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,U,z,e,ke]),Ee=F=>{F.preventDefault(),Le(f);},de=F=>{y(F),D.current?.focus();};if(react.useEffect(()=>{let F=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(V=>!V),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n]),react.useEffect(()=>{if(!n)return;let F=V=>{let P=V.target;A.current&&!A.current.contains(P)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",F);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",F);}},[n]),!w)return null;let S={"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(Ke,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&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 ${S[T]} 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:()=>p(true),children:[jsxRuntime.jsx(Zl,{}),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:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[T]} 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(Zl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Rg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Bg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&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:H.slice(0,4).map((F,M)=>jsxRuntime.jsx("button",{onClick:()=>de(F),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:F.length>30?F.slice(0,30)+"...":F},M))})]}),u.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Og,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Ee,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:D,type:"text",value:f,onChange:F=>y(F.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Fg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ql(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!p)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:l}});},[]),m=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function ed({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?d.metaKey:d.ctrlKey;if(m&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&m&&d.key==="y"){d.preventDefault(),t();return}if(c&&m&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Wg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ae.formatDate(e.startDate)} - ${ae.formatDate(e.endDate)}`);let a=ae.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=>ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function td(e){return {...Wg,...e}}var Yg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},od=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:C,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:A,onProgressChange:w,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:z,onTaskSetInProgress:H,onDependencyCreate:U,onDependencyDelete:E,onBeforeTaskAdd:J,onAfterTaskAdd:ge,onBeforeTaskUpdate:ke,onAfterTaskUpdate:Le,onBeforeTaskDelete:Ee,onAfterTaskDelete:de}=a,F=react.useContext(Co)?.theme,[M,V]=react.useState(F||s||"dark"),[P,W]=react.useState(d),[ie,te]=react.useState(c),[Se,ne]=react.useState(1),[Ve,be]=react.useState(0),[tt,Tt]=react.useState(false),[Dt,yt]=react.useState(null),[Nt,Mt]=react.useState({isOpen:false,x:0,y:0,task:null}),[ra,mt]=react.useState(null),[rt,Lt]=react.useState(null);react.useEffect(()=>{F&&F!==M&&V(F);},[F]),react.useEffect(()=>{s&&s!==M&&V(s);},[s]);let Ht=react.useCallback(N=>{V(N),g?.(N);},[g]),{state:we,setState:O,undo:Te,redo:ze,canUndo:Ue,canRedo:pt,clearHistory:X}=Ql(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),ve=react.useRef(true);react.useEffect(()=>{if(ve.current){ve.current=false,Q.current=we;return}if(!r)return;let N=JSON.stringify(Q.current),$=JSON.stringify(we);N!==$&&(Q.current=we,r(we));},[we,r]);let fe=react.useMemo(()=>es(v,f),[v,f]),ee=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ce,B]=react.useState(()=>ee(fe));react.useEffect(()=>{B(N=>N.map($=>({...$,label:fe.columns[$.id==="name"?"taskName":$.id]||$.label})));},[fe]);let G=react.useMemo(()=>Ce.filter(N=>N.visible).reduce((N,$)=>N+$.width,0)+60,[Ce]),K=react.useMemo(()=>Dt!==null?Math.max(280,Dt,G):Math.max(280,G),[Dt,G]),oe=react.useRef(null),q=react.useRef(null),xe=react.useRef(null),le=react.useMemo(()=>Cl(M),[M]),R=react.useMemo(()=>({theme:le,themeName:M}),[le,M]),se=react.useMemo(()=>td(l),[l]),Ae=react.useMemo(()=>{if(!i)return we;let N=ae.calculateCriticalPath(we),$=Y=>Y.map(ce=>({...ce,isCriticalPath:N.includes(ce.id),subtasks:ce.subtasks?$(ce.subtasks):void 0}));return $(we)},[we,i]),at=Yg(ie);ed({undo:Te,redo:ze,canUndo:Ue,canRedo:pt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>ae.findTaskById(we,N),addTask:(N,$)=>{O(Y=>{if(!$)return [...Y,{...N,level:0}];let ce=he=>he.map(Ne=>Ne.id===$?{...Ne,subtasks:[...Ne.subtasks||[],{...N,parentId:$,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:ce(Ne.subtasks)}:Ne);return ce(Y)});},updateTask:(N,$)=>{O(Y=>{let ce=he=>he.map(Ne=>Ne.id===N?{...Ne,...$}:Ne.subtasks?{...Ne,subtasks:ce(Ne.subtasks)}:Ne);return ce(Y)});},deleteTask:N=>{O($=>{let Y=ce=>ce.filter(he=>he.id===N?false:(he.subtasks&&(he.subtasks=Y(he.subtasks)),true));return Y($)});},deleteTasks:N=>{O($=>is($,N));},duplicateTask:N=>{O($=>ls($,[N]));},splitTask:(N,$,Y=3)=>{O(ce=>ae.splitTask(ce,N,$,Y));},calculateEndDate:ae.calculateEndDate,calculateDuration:ae.calculateDuration,validateDependency:(N,$)=>!ae.validateDependencies(we,N,$),getAllTasks:()=>ae.flattenTasks(we),getTasksByStatus:N=>ae.flattenTasks(we).filter($=>$.status===N),getTasksByParent:N=>N?ae.findTaskById(we,N)?.subtasks||[]:we.filter(Y=>!Y.parentId),getCriticalPath:()=>ae.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{O($=>os($,[N]));},outdentTask:N=>{O($=>ns($,[N]));},moveTask:(N,$)=>{O(Y=>ss(Y,[N],$));},createSubtask:async N=>{let{tasks:$,newTask:Y}=ms(we,N);if(J){let ce=J({...Y,parentId:N});if((ce instanceof Promise?await ce:ce)===false)return}O($),ge&&ge({...Y,parentId:N});},scrollToTask:N=>{let Y=ae.flattenTasks(we).findIndex(ce=>ce.id===N);if(Y!==-1&&oe.current){let ce=Y*at;oe.current.scrollTo({top:ce,behavior:"smooth"}),q.current&&q.current.scrollTo({top:ce,behavior:"smooth"});}},highlightTask:(N,$=2e3)=>{},expandTask:N=>{O($=>{let Y=ce=>ce.map(he=>he.id===N?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:Y(he.subtasks)}:he);return Y($)});},collapseTask:N=>{O($=>{let Y=ce=>ce.map(he=>he.id===N?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:Y(he.subtasks)}:he);return Y($)});},expandAll:()=>{O(N=>{let $=Y=>Y.map(ce=>({...ce,isExpanded:true,subtasks:ce.subtasks?$(ce.subtasks):void 0}));return $(N)});},collapseAll:()=>{O(N=>{let $=Y=>Y.map(ce=>({...ce,isExpanded:false,subtasks:ce.subtasks?$(ce.subtasks):void 0}));return $(N)});},undo:Te,redo:ze,canUndo:()=>Ue,canRedo:()=>pt,clearHistory:X,exportToPNG:async()=>{if(!xe.current)throw new Error("Gantt container not found");let N=await rd__default.default(xe.current,{backgroundColor:le.bgPrimary,scale:2});return new Promise(($,Y)=>{N.toBlob(ce=>{ce?$(ce):Y(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await ae.exportToPDF(we,N);},exportToExcel:async N=>{await ae.exportToExcel(we,N);},exportToJSON:()=>ae.exportToJSON(we),exportToCSV:()=>ae.exportToCSV(we),importFromJSON:N=>{let $=ae.importFromJSON(N);O($);},getTasks:()=>we,refresh:()=>{O(N=>[...N]);},clearAll:()=>{O([]);}}),[we,Te,ze,Ue,pt,X,le,at]);let De=react.useCallback(N=>{B($=>$.map(Y=>Y.id===N?{...Y,visible:!Y.visible}:Y));},[]),ja=react.useCallback((N,$)=>{B(Y=>Y.map(ce=>{if(ce.id!==N)return ce;let he=ce.minWidth??100,Ne=ce.maxWidth??800,kt=Math.max(he,Math.min(Ne,$));return {...ce,width:kt}}));},[]),cr=react.useCallback(N=>{O($=>cs($,N)),a.onTaskToggleExpand?.(N);},[a]),mr=react.useCallback((N,$)=>{if(ke&&ke(N,$)===false)return;let ce=ae.findTaskById(we,N)?.progress,he=kt=>kt.map(zt=>zt.id===N?{...zt,...$}:zt.subtasks?{...zt,subtasks:he(zt.subtasks)}:zt);O(he(we));let Ne=ae.findTaskById(he(we),N);Ne&&(A?.(Ne),Le?.(Ne),$.progress!==void 0&&ce!==void 0&&$.progress!==ce&&w?.(N,ce,$.progress));},[we,A,ke,Le,w]),yc=react.useCallback(N=>{N.length!==0&&(O($=>os($,N)),a.onTaskIndent?.(N[0]));},[a]),vc=react.useCallback(N=>{N.length!==0&&(O($=>ns($,N)),a.onTaskOutdent?.(N[0]));},[a]),xc=react.useCallback((N,$,Y)=>{O(ce=>Hl(ce,N,$,Y)),a.onTaskReparent?.(N,$,Y);},[a]),kc=react.useCallback((N,$)=>{N.length!==0&&(O(Y=>ss(Y,N,$)),a.onTaskMove?.(N[0],$));},[a]),ln=react.useCallback(async N=>{let $=[];for(let Y of N)Ee&&await Promise.resolve(Ee(Y))===false||$.push(Y);$.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete($):(O(Y=>is(Y,$)),$.forEach(Y=>a.onTaskDelete?.(Y))),de&&$.forEach(Y=>de(Y)));},[a,Ee,de]),wc=react.useCallback(N=>{O($=>ls($,N)),N.forEach($=>a.onTaskDuplicate?.($));},[a]),Cc=react.useCallback((N,$)=>{O(Y=>{let{tasks:ce,newTask:he}=Gl(Y,N,$);return J&&J(he)===false?Y:(a.onTaskCreate?.(he.parentId,he.position||0),ge?.(he),ce)});},[a,J,ge]),Tc=react.useCallback((N,$)=>{O(Y=>ds(Y,N,$)),a.onTaskRename?.(N,$);},[a]),dn=react.useCallback(N=>{O($=>{let{tasks:Y}=ms($,N);return a.onTaskCreate?.(N,0),Y});},[a]),Dc=react.useCallback((N,$,Y)=>{let ce=N.startDate?Math.round(($.getTime()-N.startDate.getTime())/864e5):0,he=zt=>zt.map(da=>da.id===N.id?{...da,startDate:$,endDate:Y,...N.segments&&{segments:N.segments}}:da.subtasks?{...da,subtasks:he(da.subtasks)}:da),Ne=he(we);Ne=ae.autoScheduleDependents(Ne,N.id,ce),O(Ne);let kt={...N,startDate:$,endDate:Y};A?.(kt);},[we,A]),Nc=react.useCallback((N,$)=>{h?.(N,$),Mt({isOpen:true,x:$.clientX,y:$.clientY,task:N});},[h]),Sc=react.useCallback((N,$)=>{let Y=ae.splitTask(we,N.id,$);O(Y),Mt({isOpen:false,x:0,y:0,task:null});},[we]),pi=react.useCallback(N=>{D?.(N),L||mt(N);},[D,L]),ui=react.useCallback((N,$,Y)=>{let ce=new Map,he=ca=>{ca.forEach(Na=>{Na.dependencies&&ce.set(Na.id,Na.dependencies),Na.subtasks&&he(Na.subtasks);});};he(Y);let Ne=ce.get($)||[];ce.set($,[...Ne,N]);let kt=new Set,zt=new Set,da=ca=>{if(!kt.has(ca)){kt.add(ca),zt.add(ca);let Na=ce.get(ca)||[];for(let Lr of Na){if(!kt.has(Lr)&&da(Lr))return true;if(zt.has(Lr))return true}}return zt.delete(ca),false};return da($)},[]),gi=react.useCallback((N,$)=>{if(ui(N.id,$,we)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
277
277
|
|
|
278
|
-
Task dependencies must flow in one direction only.`);return}let Y=ce=>ce.map(he=>{if(he.id
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let Y=ce=>ce.map(he=>{if(he.id===$){let Ne=he.dependencies||[];if(!Ne.includes(N.id))return {...he,dependencies:[...Ne,N.id]}}return he.subtasks?{...he,subtasks:Y(he.subtasks)}:he});O(Y(we)),U?.(N.id,$);},[we,U,ui]),fi=react.useCallback((N,$)=>{let Y=ce=>ce.map(he=>{if(he.id===N&&he.dependencies){let Ne=he.dependencies.filter(kt=>kt!==$);return {...he,dependencies:Ne}}return he.subtasks?{...he,subtasks:Y(he.subtasks)}:he});O(Y(we)),E?.(N,$);},[we,E]),{startDate:Ec,endDate:Pc}=react.useMemo(()=>{let N=we.filter(Ne=>Ne.startDate&&Ne.endDate);if(N.length===0){let Ne=new Date,kt=new Date(Ne);kt.setDate(kt.getDate()-30);let zt=new Date(Ne);return zt.setDate(zt.getDate()+60),{startDate:kt,endDate:zt}}let $=N.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),Y=new Date(Math.min(...$.map(Ne=>Ne.getTime()))),ce=new Date(Math.max(...$.map(Ne=>Ne.getTime()))),he=P==="day"?7:P==="week"?14:30;return Y.setDate(Y.getDate()-he),ce.setDate(ce.getDate()+he),{startDate:Y,endDate:ce}},[we,P]),Mc=react.useCallback(async()=>{if(!xe.current)return;let N=await rd__default.default(xe.current,{backgroundColor:le.bgPrimary,scale:2}),$=document.createElement("a");$.download="gantt-chart.png",$.href=N.toDataURL("image/png"),$.click();},[le]),Ac=react.useCallback(async()=>{await ae.exportToPDF(we);},[we]),Ic=react.useCallback(async()=>{await ae.exportToExcel(we);},[we]),Lc=react.useCallback(()=>{let N=ae.exportToCSV(we),$=new Blob([N],{type:"text/csv;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL($),Y.download="gantt-chart.csv",Y.click(),URL.revokeObjectURL(Y.href);},[we]),Fc=react.useCallback(()=>{let N=ae.exportToJSON(we),$=new Blob([N],{type:"application/json;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL($),Y.download="gantt-chart.json",Y.click(),URL.revokeObjectURL(Y.href);},[we]),Bc=react.useCallback(()=>{ae.exportToMSProject(we,"Gantt Project","project.xml");},[we]),Rc=N=>{N.preventDefault(),Tt(true);};return react.useEffect(()=>{let N=q.current,$=oe.current;if(!N||!$)return;let Y=$.querySelector(".gantt-taskgrid-content"),ce=()=>{let kt=N.scrollTop;be(kt),Y&&(Y.style.transform=`translateY(-${kt}px)`);},he=kt=>{if(tt&&$){let da=$.parentElement?.getBoundingClientRect()?.left||0,ca=kt.clientX-da,Na=280,Lr=Math.min(window.innerWidth-300,800);ca>=Na&&ca<=Lr&&yt(ca);}},Ne=()=>{Tt(false);};return N.addEventListener("scroll",ce),document.addEventListener("mousemove",he),document.addEventListener("mouseup",Ne),()=>{N.removeEventListener("scroll",ce),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Ne);}},[tt]),jsxRuntime.jsx(wr.Provider,{value:fe,children:jsxRuntime.jsx(gn.Provider,{value:R,children:jsxRuntime.jsxs("div",{ref:xe,className:"flex flex-col h-full w-full",style:{backgroundColor:le.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Do,{theme:le,timeScale:P,onTimeScaleChange:W,zoom:Se,onZoomChange:ne,currentTheme:M,onThemeChange:Ht,rowDensity:ie,onRowDensityChange:te,showThemeSelector:m,showCreateTaskButton:y,createTaskLabel:x,onCreateTask:b,onExportPNG:n?Mc:void 0,onExportPDF:n?Ac:void 0,onExportExcel:n?Ic:void 0,onExportCSV:n?Lc:void 0,onExportJSON:n?Fc:void 0,onExportMSProject:n?Bc:void 0}),jsxRuntime.jsxs("div",{ref:oe,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:K,overflow:"hidden"},children:jsxRuntime.jsx(Po,{tasks:Ae,theme:le,rowHeight:at,availableUsers:p,templates:se,onTaskClick:C,onTaskDblClick:pi,onTaskContextMenu:h,onTaskToggle:cr,scrollTop:Ve,columns:Ce,onToggleColumn:De,onColumnResize:ja,onTaskUpdate:mr,onTaskIndent:yc,onTaskOutdent:vc,onTaskMove:kc,onMultiTaskDelete:ln,onTaskDuplicate:wc,onTaskCreate:Cc,onTaskRename:Tc,onCreateSubtask:dn,onOpenTaskModal:C?N=>C(N):void 0,onDeleteRequest:(N,$)=>Lt({taskId:N,taskName:$}),onTaskReparent:xc})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Rc}),jsxRuntime.jsx("div",{ref:q,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Oo,{tasks:Ae,theme:le,rowHeight:at,timeScale:P,startDate:Ec,endDate:Pc,zoom:Se,templates:se,onTaskClick:C,onTaskDblClick:pi,onTaskContextMenu:Nc,onTaskDateChange:Dc,onDependencyCreate:gi,onDependencyDelete:fi})})]}),Nt.task&&jsxRuntime.jsx(Cr,{isOpen:Nt.isOpen,x:Nt.x,y:Nt.y,theme:le,onClose:()=>Mt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=Nt.task;return N?N.subtasks&&N.subtasks.length>0?[{id:"addSubtask",label:fe.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{T?T(N):dn(N.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:fe.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[{id:"edit",label:fe.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{L?L(N):mt(N);}},{id:"addSubtask",label:fe.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{T?T(N):dn(N.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:fe.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{z?z(N):mr(N.id,{status:"todo",progress:0});},disabled:N.status==="todo"},{id:"setInProgress",label:fe.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{H?H(N):mr(N.id,{status:"in-progress"});},disabled:N.status==="in-progress"},{id:"markComplete",label:fe.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{mr(N.id,{status:"completed",progress:100});},disabled:N.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:fe.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{if(!N.startDate||!N.endDate){console.warn("Cannot split task without dates");return}let Y=N.startDate.getTime(),ce=N.endDate.getTime(),he=Y+(ce-Y)/2,Ne=new Date(he);Sc(N,Ne);},disabled:!N.startDate||!N.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:fe.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[]})()}),ra&&jsxRuntime.jsx($o,{isOpen:true,onClose:()=>mt(null),task:ra,onSubmit:N=>{mr(ra.id,N),mt(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:rt&&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:()=>Lt(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:N=>N.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:le.bgSecondary,border:`1px solid ${le.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${le.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:le.textPrimary,fontFamily:"Inter, sans-serif"},children:[fe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:le.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:le.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:le.textPrimary},children:['"',rt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:le.bgPrimary,borderTop:`1px solid ${le.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:le.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=le.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ln([rt.taskId]),Lt(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:N=>{N.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Wo,{tasks:we,theme:le,config:u,onTasksUpdate:O,onTaskUpdate:mr,onTaskCreate:N=>{O($=>[...$,N]);},onTaskDelete:N=>{ln([N]);},onDependencyCreate:(N,$)=>{let Y=ae.findTaskById(we,N);Y&&gi(Y,$);},onDependencyDelete:fi})]})})})});var nd=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
279
279
|
|
|
280
280
|
AVAILABLE COMMANDS:
|
|
281
281
|
1. move_task - Move a task to a different date
|
|
@@ -320,7 +320,7 @@ If ambiguous, ask for clarification in the message field.`;function sd(e){return
|
|
|
320
320
|
${id(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",d=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${d}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function id(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function La(e,t){let a=id(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return d.every(n=>m.includes(n))})}function xs(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 i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}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 u={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(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=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(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=m[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let i=p[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function ks(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 ws(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 ld(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 dd(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 n=r[1].trim(),p=r[2].trim(),l=La(t,n),i=xs(p);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),p=o[2].trim(),l=La(t,n),i=ks(p);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.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 n=s[1].trim(),p=s[2].trim(),l=La(t,n),i=ws(p);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),p=d[2].trim(),l=La(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),p=c[2].trim(),l=La(t,n),i=La(t,p);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),p=La(t,n);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function cd(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 qg(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 Xg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ho(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let l=a.find(i=>i.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ho(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let d=p=>{if(p)return typeof p=="string"?new Date(p):p},c=d(e.startDate),m=d(e.endDate),n=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:qg(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:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function md(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:Xg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function pd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ho(r,e,t))}var Cs={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"}},Ts={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"}},_o={en:Cs,es:Ts};function Ds(e){return _o[e]||_o.en}function Vo(e,t){let a=Ds(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 bd(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(...bd(r.subtasks,t+1));return a}function lf({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 hd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:m="en",customTranslations:n,showSearch:p=true,showHierarchy:l=true}=t,i=Vo(m,n),u=c==="dark",[v,f]=react.useState(new Set),[y,x]=react.useState("startDate"),[b,g]=react.useState("asc"),[C,D]=react.useState("");react.useMemo(()=>{let T=new Set;function $(H){for(let U of H)U.subtasks?.length&&(T.add(U.id),$(U.subtasks));}$(e),f(T);},[e]);let h=react.useCallback(T=>{f($=>{let H=new Set($);return H.has(T)?H.delete(T):H.add(T),H}),a.onTaskToggleExpand?.(T);},[a]),A=react.useCallback(T=>{y===T?g($=>$==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),w=react.useMemo(()=>{let T=bd(e);if(C.trim()){let H=C.toLowerCase();T=T.filter(U=>U.name.toLowerCase().includes(H));}let $=[];for(let H of T){let U=H.level===0;H.level>0&&(U=true),(U||C.trim())&&$.push(H);}return C.trim()&&$.sort((H,U)=>{let E,J;switch(y){case "name":E=H.name.toLowerCase(),J=U.name.toLowerCase();break;case "startDate":E=H.startDate?.getTime()||0,J=U.startDate?.getTime()||0;break;case "endDate":E=H.endDate?.getTime()||0,J=U.endDate?.getTime()||0;break;case "progress":E=H.progress||0,J=U.progress||0;break;case "status":E=H.status||"todo",J=U.status||"todo";break;default:return 0}return E<J?b==="asc"?-1:1:E>J?b==="asc"?1:-1:0}),$},[e,C,y,b]),L=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:k("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:C,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:k("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"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:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:k("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"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:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("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((T,$)=>{let H=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:k("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),h(T.id);},className:k("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:H?jsxRuntime.jsx(lucideReact.ChevronDown,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(lf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:k("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:k("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),L(T.startDate)]}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),L(T.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:k("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),w.length===0&&C&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:k("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:k(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Ns={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"},Ss={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"},Es={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"},Ko={dark:Ns,light:Ss,neutral:Es};function yd(e){return Ko[e]||Ko.dark}var Ps={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"}},Ms={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"}},Yo={en:Ps,es:Ms};function Zr(e){return Yo[e]||Yo.en}function qo(e,t){let a=Zr(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 vd(e){let t=Zr(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 xd(e,t=0,a=true){let r=Zr(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 kf(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 Bs(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 Cd({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 Dd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:m="dark",locale:n="en",customTranslations:p}=t,l=qo(n,p),i=m==="dark",[u,v]=react.useState(r||new Date),[f,y]=react.useState(null),[x,b]=react.useState(null),[g,C]=react.useState(null),[D,h]=react.useState(new Date),[A,w]=react.useState({}),L=4,T=3,[$,H]=react.useState(false),[U,E]=react.useState(false),[J,ge]=react.useState(false),[ke,Le]=react.useState(null),[Ee,de]=react.useState(""),[S,F]=react.useState(void 0),[M,V]=react.useState(null),[P,W]=react.useState(false),[le,te]=react.useState(false),[Se,ne]=react.useState(null),[Ve,be]=react.useState(false),[tt,Tt]=react.useState(new Date),Dt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),yt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Nt=react.useCallback(()=>{v(new Date);},[]),Mt=react.useMemo(()=>{let O=u.getFullYear(),Te=u.getMonth(),$e=new Date(O,Te,1),Ue=new Date(O,Te+1,0),pt=$e.getDay(),X=Ue.getDate(),Q=kf(e),ve=new Date;ve.setHours(0,0,0,0);let fe=[],ee=pt,Ce=new Date(O,Te,0).getDate();for(let G=ee-1;G>=0;G--){let K=new Date(O,Te-1,Ce-G);fe.push({date:K,isCurrentMonth:false,isToday:false,isWeekend:K.getDay()===0||K.getDay()===6,events:Q.filter(oe=>Bs(K,oe)).map(oe=>({id:oe.id,title:oe.name,start:oe.startDate,end:oe.endDate,task:oe}))});}for(let G=1;G<=X;G++){let K=new Date(O,Te,G),oe=K.getTime()===ve.getTime();fe.push({date:K,isCurrentMonth:true,isToday:oe,isWeekend:K.getDay()===0||K.getDay()===6,events:Q.filter(q=>Bs(K,q)).map(q=>({id:q.id,title:q.name,start:q.startDate,end:q.endDate,task:q}))});}let B=42-fe.length;for(let G=1;G<=B;G++){let K=new Date(O,Te+1,G);fe.push({date:K,isCurrentMonth:false,isToday:false,isWeekend:K.getDay()===0||K.getDay()===6,events:Q.filter(oe=>Bs(K,oe)).map(oe=>({id:oe.id,title:oe.name,start:oe.startDate,end:oe.endDate,task:oe}))});}return fe},[u,e]),ra=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],mt=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),rt=react.useCallback((O,Te)=>{if(!f)return;let $e={...f,[O]:Te};y($e),a.onTaskUpdate?.($e);},[f,a]),Lt=react.useCallback(O=>{if(!f)return;let Te=f.progress||0;O==="completed"?Te=100:O==="todo"&&(Te=0);let $e={...f,status:O,progress:Te};y($e),a.onTaskUpdate?.($e),H(false);},[f,a]),Ht=react.useCallback((O,Te)=>{if(!f)return;let $e={...f,startDate:O,endDate:Te};y($e),a.onTaskUpdate?.($e);},[f,a]),we=react.useCallback(()=>{H(false),E(false),C(null);},[]);return o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",i?"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:k("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:mt}),jsxRuntime.jsx("button",{onClick:Nt,className:k("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Dt,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:k("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:yt,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-5 h-5",i?"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:ra.map(O=>jsxRuntime.jsx("div",{className:k("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:k("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-white/5":"bg-gray-200"),children:Mt.map((O,Te)=>{let $e=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:k("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?$e?"bg-[#1A1D21]":O.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":$e?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ue=A[Te]||L,pt=O.events.slice(0,Ue),X=O.events.length-Ue;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[pt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:k("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Cd,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),w(ve=>({...ve,[Te]:Ue+T}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",n==="es"?"M\xC1S":"MORE"]}),Ue>L&&O.events.length>L&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),w(ve=>({...ve,[Te]:L}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ue=Te>=28,pt=Te%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ke===Te?Le(null):(Le(Te),de(""),F(void 0),V(null),ne(null),W(false),te(false),be(false),Tt(O.date));},className:k("w-5 h-5 rounded flex items-center justify-center transition-all",ke===Te?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:k("w-3.5 h-3.5 transition-transform",ke===Te&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===Te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),de(""),F(void 0),V(null),ne(null),W(false),te(false),be(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:k("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",pt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),W(false),te(false),be(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:X=>de(X.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:k("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&Ee.trim()){let Q=t.availableUsers?.find(fe=>fe.id===M),ve=Se||O.date;a.onTaskCreate?.({name:Ee.trim(),startDate:ve,endDate:ve,priority:S,assignees:Q?[Q]:void 0}),de(""),F(void 0),V(null),ne(null),Le(null);}X.key==="Escape"&&(Le(null),de(""),F(void 0),V(null),ne(null));}})}),jsxRuntime.jsxs("div",{className:k("px-2.5 py-2 flex items-center justify-between border-t",i?"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:X=>{X.stopPropagation(),W(!P),te(false);},className:k("p-1 rounded transition-colors",S?S==="urgent"||S==="high"?"text-red-400 bg-red-500/20":S==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"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:P&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),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(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),W(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===X.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),be(!Ve),W(false),te(false),Tt(Se||O.date);},className:k("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Se?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"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||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:k("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Q=new Date(X);Q.setDate(X.getDate()+1);let ve=new Date(X);ve.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let fe=new Date(X);fe.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let ee=new Date(X);ee.setDate(X.getDate()+14);let Ce=new Date(X);return Ce.setDate(X.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:X,display:X.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:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:fe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((G,K)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ne(G.date),be(false);},children:[jsxRuntime.jsx("span",{children:G.label}),jsxRuntime.jsx("span",{className:k("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:G.display})]},K))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:k("text-xs font-medium",i?"text-white":"text-gray-900"),children:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Tt(new Date),className:k("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Tt(new Date(tt.getFullYear(),tt.getMonth()-1)),className:k("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Tt(new Date(tt.getFullYear(),tt.getMonth()+1)),className:k("p-0.5 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:k("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=tt.getFullYear(),Q=tt.getMonth(),ve=new Date(X,Q,1).getDay(),fe=new Date(X,Q+1,0).getDate(),ee=new Date(X,Q,0).getDate(),Ce=new Date,B=[];for(let K=ve-1;K>=0;K--)B.push({dayNum:ee-K,isCurrentMonth:false,date:new Date(X,Q-1,ee-K)});for(let K=1;K<=fe;K++)B.push({dayNum:K,isCurrentMonth:true,date:new Date(X,Q,K)});let G=42-B.length;for(let K=1;K<=G;K++)B.push({dayNum:K,isCurrentMonth:false,date:new Date(X,Q+1,K)});return B.map((K,oe)=>{let q=K.date.toDateString()===Ce.toDateString(),xe=(Se||O.date).toDateString()===K.date.toDateString();return jsxRuntime.jsx("button",{className:k("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!K.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),K.isCurrentMonth&&(i?"text-white":"text-gray-900"),q&&"ring-1 ring-[#3B82F6]",xe&&"bg-[#7C3AED] text-white",!xe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ne(K.date),be(false);},children:K.dayNum},oe)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),te(!le),W(false);},className:k("p-1 rounded transition-colors",M?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:M?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===M)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===M)?.initials||t.availableUsers?.find(X=>X.id===M)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{V(null),te(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!M&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:k("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{V(X.id),te(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",M===X.id&&(i?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:k("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Ee.trim()){let X=t.availableUsers?.find(ve=>ve.id===M),Q=Se||O.date;a.onTaskCreate?.({name:Ee.trim(),startDate:Q,endDate:Q,priority:S,assignees:X?[X]:void 0}),de(""),F(void 0),V(null),ne(null),Le(null);}},disabled:!Ee.trim(),className:k("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ee.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:k("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},Te)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),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:k("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:k("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:k("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:k("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:k("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"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:k("p-1.5 rounded transition-colors",i?"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:k("p-1.5 rounded transition-colors",i?"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:()=>y(null),className:k("p-1.5 rounded transition-colors",i?"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 O=f.progress===100?0:100,$e={...f,progress:O,status:O===100?"completed":"todo"};y($e),a.onTaskUpdate?.($e);},className:k("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:k("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.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:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{we(),H(!$);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>Lt(O.id),className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,Te)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},Te)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{C(g?null:"start"),h(f.startDate||new Date);},className:k("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:k("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>C(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:k("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:k("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,Te=new Date(O);Te.setDate(O.getDate()+1);let $e=new Date(O);$e.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let Ue=new Date(O);Ue.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let pt=new Date(O);pt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let X=new Date(O);X.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:$e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ue,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:pt,display:pt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((fe,ee)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Ce=f.endDate&&fe.date>f.endDate?fe.date:f.endDate;Ht(fe.date,Ce),C("end");}else {let Ce=f.startDate&&fe.date<f.startDate?fe.date:f.startDate;Ht(Ce,fe.date),C(null);}},children:[jsxRuntime.jsx("span",{children:fe.label}),jsxRuntime.jsx("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:fe.display})]},ee))})(),jsxRuntime.jsx("div",{className:k("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ht(void 0,void 0),C(null);},className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"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:k("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="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:k("font-medium",i?"text-white":"text-gray-900"),children:D.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:()=>h(new Date),className:k("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:k("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()+1)),className:k("p-1 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:k("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=D.getFullYear(),Te=D.getMonth(),$e=new Date(O,Te,1).getDay(),Ue=new Date(O,Te+1,0).getDate(),pt=new Date(O,Te,0).getDate(),X=new Date,Q=[];for(let fe=$e-1;fe>=0;fe--)Q.push({day:pt-fe,isCurrentMonth:false,date:new Date(O,Te-1,pt-fe)});for(let fe=1;fe<=Ue;fe++)Q.push({day:fe,isCurrentMonth:true,date:new Date(O,Te,fe)});let ve=42-Q.length;for(let fe=1;fe<=ve;fe++)Q.push({day:fe,isCurrentMonth:false,date:new Date(O,Te+1,fe)});return Q.map((fe,ee)=>{let Ce=fe.date.toDateString()===X.toDateString(),B=f.startDate?.toDateString()===fe.date.toDateString(),G=f.endDate?.toDateString()===fe.date.toDateString(),K=B||G,oe=f.startDate&&f.endDate&&fe.date>=f.startDate&&fe.date<=f.endDate;return jsxRuntime.jsx("button",{className:k("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!fe.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),fe.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#3B82F6]",B&&"bg-[#3B82F6] text-white",G&&!B&&"bg-[#7C3AED] text-white",oe&&!K&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let q=new Date(fe.date);if(g==="start"){let xe=f.endDate&&q>f.endDate?q:f.endDate;Ht(q,xe),C("end");}else {let xe=f.startDate&&q<f.startDate?q:f.startDate;Ht(xe,q),C(null);}},children:fe.day},ee)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{we(),E(!U);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>E(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"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(O=>jsxRuntime.jsxs("button",{onClick:()=>{rt("priority",O.id),E(false);},className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.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:k("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[J?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let Te=parseInt(O.target.value),$e=f.status;Te===100?$e="completed":Te>0?$e="in-progress":$e="todo";let Ue={...f,progress:Te,status:$e};y(Ue),a.onTaskUpdate?.(Ue);},onBlur:()=>ge(false),className:k("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"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:()=>ge(true),className:k("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm mt-2 transition-colors",i?"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:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:k("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:k("p-1 rounded transition-colors",i?"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:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:k("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:k("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:k("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:k("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:k("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:k("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:k("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:k("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),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:()=>b(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:k("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",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:k("p-1 rounded",i?"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:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),y(O.task);},className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Cd,{task:O.task}),jsxRuntime.jsx("span",{className:k("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Rs={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"},Os={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"},Us={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"},Qo={dark:Rs,light:Os,neutral:Us};function Nd(e){return Qo[e]||Qo.dark}function Cf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[m,n]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=react.useMemo(()=>{let u=p.length,v=new Set(p.flatMap(x=>x.assignedUserIds||[])).size,f=p.map(x=>x.priority).filter(Boolean),y=new Set(p.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[p]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:k("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,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:k("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.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"})]})})]},u.id))})})]})}var Ed={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Qr(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 eo(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 Pd(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 Md({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let m=react.useMemo(()=>({...Ed,...d}),[d]),[n,p]=react.useState(new Set),l=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let C=g.timestamp.toISOString().split("T")[0],D=b.get(C);D?D.push(g):b.set(C,[g]);}),Array.from(b.entries()).sort((g,C)=>C[0].localeCompare(g[0])).map(([g,C])=>({date:new Date(g),events:C.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(C=>{b.add(C.userId),g.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{p(g=>{let C=new Set(g);return C.has(b)?C.delete(b):C.add(b),C});},y=b=>{let C=new Date().getTime()-b.getTime(),D=Math.floor(C/6e4),h=Math.floor(C/36e5),A=Math.floor(C/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:A<7?`${A}d ago`:b.toLocaleDateString()},x=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:k("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:k("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[eo(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,C)=>{let D=n.has(g.id),h=s===g.id,A=Pd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:k("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:eo(g.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),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:[m.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Qr(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),f(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([w,L])=>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(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},w)),g.metadata&&Object.keys(g.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(g.metadata).map(([w,L])=>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(L)})]},w))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function Id({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:m,className:n}){let p=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:k("history-replay-empty",n),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:k("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&eo(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&Qr(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:k("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:Qr(u)},u.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:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(u=>jsxRuntime.jsxs("button",{className:k("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:k("history-replay-start",n),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 $s(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 zs(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 Ld(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 Fd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Pf(e,t,a,r,o,s=100){let d=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;d.forEach(p=>{let l=a/2,i=r/2;p.vx+=(l-p.x)*o.centerForce*n,p.vy+=(i-p.y)*o.centerForce*n,d.forEach(u=>{if(p.id===u.id)return;let v=p.x-u.x,f=p.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);p.vx+=v/y*x,p.vy+=f/y*x;});}),t.forEach(p=>{let l=c.get(typeof p.source=="string"?p.source:p.source.id),i=c.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return d}function Bd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:m}){let n=react.useRef(null),[p,l]=react.useState([]),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(1),[C,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Pf(e,t,a.width,a.height,a,150);l(U);},[e,t,a]);let h=react.useCallback((U,E)=>{a.enableDragging&&(E.stopPropagation(),u(U));},[a.enableDragging]),A=react.useCallback(U=>{if(!i||!n.current)return;let J=n.current.getBoundingClientRect(),ge=(U.clientX-J.left-C.x)/b,ke=(U.clientY-J.top-C.y)/b;l(Le=>Le.map(Ee=>Ee.id===i?{...Ee,x:ge,y:ke,fx:ge,fy:ke}:Ee));},[i,b,C]),w=react.useCallback(()=>{u(null);},[]),L=react.useCallback((U,E)=>{E.stopPropagation(),c?.({type:"node-click",node:U,position:{x:E.clientX,y:E.clientY}});},[c]),T=react.useCallback((U,E)=>{E.stopPropagation(),c?.({type:"edge-click",edge:U,position:{x:E.clientX,y:E.clientY}});},[c]),$=react.useCallback(U=>{let E=p.find(J=>J.id===U);return E?{x:E.x,y:E.y}:{x:0,y:0}},[p]),H=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let E=U.card.priority;return E==="URGENT"?"#ef4444":E==="HIGH"?"#f59e0b":E==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:k("relationships-graph-empty",m),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:k("relationships-graph",m),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:d.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:d.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:()=>g(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:$s(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Ld(U)," ",zs(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let E=$(typeof U.source=="string"?U.source:U.source.id),J=$(typeof U.target=="string"?U.target:U.target.id),ge=Fd(U.type),ke=y===U.id,Le=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-edge",ke&&"hovered",Le&&"critical"),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:Ee=>T(U,Ee),children:[jsxRuntime.jsx("line",{x1:E.x,y1:E.y,x2:J.x,y2:J.y,stroke:$s(U.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:ge?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsxRuntime.jsx("text",{x:(E.x+J.x)/2,y:(E.y+J.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:zs(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(U=>{let E=v===U.id,J=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-node",E&&"hovered",J&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:ge=>h(U.id,ge),onMouseEnter:()=>f(U.id),onMouseLeave:()=>f(null),onClick:ge=>L(U,ge),children:[jsxRuntime.jsx("circle",{r:J?a.nodeSize*1.2:a.nodeSize,fill:H(U),stroke:J?"#fbbf24":"#ffffff",strokeWidth:J?3:2,opacity:E?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ud({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=react.useState(""),[c,m]=react.useState(false),[n,p]=react.useState(null),[l,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),p(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){m(true),p(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},x=()=>{l&&(a(l),f());};return e?jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,g)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:b=>d(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,g)=>jsxRuntime.jsx("button",{onClick:()=>d(b),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},g))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ws={"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 Af={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},If={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 Lf(e,t,a){let r=Ws[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function to(e){return `$${e.toFixed(4)}`}var Gs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Lf(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),m=a.reduce((l,i)=>l+i.duration,0),n={},p={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:p,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=d).length,m=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},sr=new Gs;function Wd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(sr.getStats()),[s,d]=react.useState(sr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(sr.getStats()),d(sr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=sr.getRecentOperations(5);return jsxRuntime.jsxs(Ke,{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: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.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:to(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(([m,n])=>{let p=r.costsByFeature[m]||0,l=r.totalOperations>0?n/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:m.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:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:to(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:to(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 _d({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[m,n]=react.useState(""),[p,l]=react.useState(""),[i,u]=react.useState(false),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(null),C=react.useRef(null),D=i||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let T=$=>{$.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let h=()=>{D||(c(""),n(""),l(""),f(null),x(null),g(null),t());},A=async()=>{if(!(!d.trim()||D)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{y&&(a(y),h());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:T=>T.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:h,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((T,$)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",$+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.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"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:d,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>n(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>l(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,$)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?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:A,disabled:!d.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function an({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&co(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(y,x,b)=>{r(g=>{let C=g.cards.find(T=>T.id===y);if(!C)return g;let D=C.columnId,h={...C,columnId:x,position:b},A=g.cards.map(T=>T.id===y?h:T),w=g.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter($=>$!==y)};if(T.id===x){let $=A.filter(H=>H.columnId===x).sort((H,U)=>H.position-U.position);return {...T,cardIds:$.map(H=>H.id)}}return T}),L={...g,cards:A,columns:w};return o(L),L});},[o]),d=react.useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(D=>D.id===y?{...D,...x}:D),C={...b,cards:g};return o(C),C});},[o]),c=react.useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},C=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),D={...b,cards:[...b.cards,g],columns:C};return o(D),D});},[o]),m=react.useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),C=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(A=>A!==y)}:h),D={...x,cards:g,columns:C};return o(D),D});},[o]),n=react.useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},C={...b,columns:[...b.columns,g]};return o(C),C});},[o]),p=react.useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(D=>D.id===y?{...D,...x}:D),C={...b,columns:g};return o(C),C});},[o]),l=react.useCallback(async y=>{r(x=>{let b=x.cards.filter(D=>D.columnId!==y),g=x.columns.filter(D=>D.id!==y),C={...x,cards:b,columns:g};return o(C),C});},[o]),i=react.useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=react.useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=react.useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:m,onColumnCreate:n,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:m,deleteColumn:l,clearBoard:v}}}function jd({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=an({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(m,n,p={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...p});},addColumn:(m,n)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:n??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var ao={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Yd={by:"none",order:"asc"};function qd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...ao,...e}),[s,d]=react.useState({...Yd,...t}),c=react.useCallback(f=>{o(y=>({...y,...f}));},[]),m=react.useCallback(f=>{d(y=>({...y,...f}));},[]),n=react.useCallback(()=>{o(ao),d(Yd);},[]),p=react.useCallback(()=>{a&&o({...ao,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...ao,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...ao,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),C=String(x.getDate()).padStart(2,"0"),D=`${b}-${g}-${C}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let A=h.endDate||h.dueDate;if(!A)return false;let w;if(typeof A=="string")w=A.split("T")[0]||A;else {let L=A.getUTCFullYear(),T=String(A.getUTCMonth()+1).padStart(2,"0"),$=String(A.getUTCDate()).padStart(2,"0");w=`${L}-${T}-${$}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let L=new Date(D+"T00:00:00"),T=new Date(w+"T00:00:00"),$=new Date(L);return $.setDate($.getDate()+7),T>=L&&T<=$;case "custom":if(r.dateRange){let H=typeof A=="string"?new Date(A):A;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let C=x.createdAt?new Date(x.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;g=C-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=h[x.priority||"LOW"],w=h[b.priority||"LOW"];g=A-w;break;case "dueDate":let L=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!L)return 1;if(!T)return -1;let $=typeof L=="string"?new Date(L).getTime():L.getTime(),H=typeof T=="string"?new Date(T).getTime():T.getTime();g=$-H;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let U=x.estimatedTime||0,E=b.estimatedTime||0;g=U-E;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:m,resetFilters:n,filterMyTasks:p,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var Jd,Zd;if(typeof window<"u")try{let e=so("ai");Jd=e.generateObject,Zd=e.generateText;}catch{}function Qd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Jd&&Zd&&e.apiKey),d=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function _s(){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 ec(e){let{cards:t}=e,[a,r]=_s(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(w=>w.columnId===f.columnId).sort((w,L)=>w.position-L.position),b=x.findIndex(w=>w.id===a.lastSelectedCardId),g=x.findIndex(w=>w.id===l),[C,D]=b<g?[b,g]:[g,b],h=x.slice(C,D+1).map(w=>w.id),A=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:A,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),p=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:d,clearSelection:c,selectAll:m,toggleCard:n,getSelectedCards:p}}var tc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function ac(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...tc,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(D=>D.columnId===x).length,createdAt:new Date};d(D=>[...D,C]);},[o.minCardsPerStack,s]),m=react.useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=react.useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),p=react.useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=react.useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(C=>C!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=react.useCallback(async f=>{let y=t.filter(D=>D.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(D);});}),b.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(D);});}),g.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(y.forEach(D=>{D.priority&&(C.has(D.priority)||C.set(D.priority,[]),C.get(D.priority).push(D));}),C.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${A} ${h} Priority`,cardIds:D.map(w=>w.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of y){let A=(await r.findSimilar(D,y)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let w=[D.id,...A.map(T=>T.card.id)],L=A.reduce((T,$)=>T+$.similarity,0)/A.length;x.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:L});}}return x.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:m,toggleStack:n,addToStack:p,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var rc=react.createContext(null);function oc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(m=>{let{Column:n}=so("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=so("@libxai/core");d.set(m.id,new n(m));});let c=null;if(t?.board){let{Board:m}=so("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(rc.Provider,{value:{store:o},children:e})}function rn(){let e=react.useContext(rc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function oo(){let e=rn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(b=>{e.updateBoard(b);},[e]),m=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,C)=>{e.moveCard(b,g,C);},[e]),y=react.useCallback(b=>e.getCard(b),[e]),x=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:m,updateColumn:n,deleteColumn:p,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function sc(e){let{cards:t}=oo();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 ic(e="position",t="asc"){let{cards:a}=oo();return react.useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=m-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var on=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=yi.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 d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Xf=new on;function dc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:m}){let n=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=p.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=m?m(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function cc(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 pc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:m,horizontal:n=true}){let p=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=m?m(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function uc(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 gc(e,t=10){return e>t}var Ys={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},qs={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Xs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Js={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Zs={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Qs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ei={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ti={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)"},ai={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)"},ri={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},oi={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}},ni={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}},nn={spacing:Ys,borderRadius:qs,fontSize:Xs,fontWeight:Js,lineHeight:Zs,zIndex:Qs,duration:ei,easing:ti,shadows:ai,opacity:ri,kanban:oi,gantt:ni};function fc(e,t,a){return e[t]??a}function si(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)?si(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Qf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ii(e="asakaa"){let t=si(nn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=Qf(o);a.push(` ${s}: ${d};`);}return `:root {
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function id(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function La(e,t){let a=id(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return d.every(n=>m.includes(n))})}function xs(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 i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}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 u={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(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=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(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=m[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let i=p[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function ks(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 ws(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 ld(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 dd(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 n=r[1].trim(),p=r[2].trim(),l=La(t,n),i=xs(p);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),p=o[2].trim(),l=La(t,n),i=ks(p);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.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 n=s[1].trim(),p=s[2].trim(),l=La(t,n),i=ws(p);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),p=d[2].trim(),l=La(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),p=c[2].trim(),l=La(t,n),i=La(t,p);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),p=La(t,n);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function cd(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 qg(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 Xg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ho(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let l=a.find(i=>i.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ho(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let d=p=>{if(p)return typeof p=="string"?new Date(p):p},c=d(e.startDate),m=d(e.endDate),n=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:qg(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:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function md(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:Xg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function pd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ho(r,e,t))}var Cs={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"}},Ts={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"}},_o={en:Cs,es:Ts};function Ds(e){return _o[e]||_o.en}function Vo(e,t){let a=Ds(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 bd(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(...bd(r.subtasks,t+1));return a}function lf({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 hd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:m="en",customTranslations:n,showSearch:p=true,showHierarchy:l=true}=t,i=Vo(m,n),u=c==="dark",[v,f]=react.useState(new Set),[y,x]=react.useState("startDate"),[b,g]=react.useState("asc"),[C,D]=react.useState("");react.useMemo(()=>{let T=new Set;function z(H){for(let U of H)U.subtasks?.length&&(T.add(U.id),z(U.subtasks));}z(e),f(T);},[e]);let h=react.useCallback(T=>{f(z=>{let H=new Set(z);return H.has(T)?H.delete(T):H.add(T),H}),a.onTaskToggleExpand?.(T);},[a]),A=react.useCallback(T=>{y===T?g(z=>z==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),w=react.useMemo(()=>{let T=bd(e);if(C.trim()){let H=C.toLowerCase();T=T.filter(U=>U.name.toLowerCase().includes(H));}let z=[];for(let H of T){let U=H.level===0;H.level>0&&(U=true),(U||C.trim())&&z.push(H);}return C.trim()&&z.sort((H,U)=>{let E,J;switch(y){case "name":E=H.name.toLowerCase(),J=U.name.toLowerCase();break;case "startDate":E=H.startDate?.getTime()||0,J=U.startDate?.getTime()||0;break;case "endDate":E=H.endDate?.getTime()||0,J=U.endDate?.getTime()||0;break;case "progress":E=H.progress||0,J=U.progress||0;break;case "status":E=H.status||"todo",J=U.status||"todo";break;default:return 0}return E<J?b==="asc"?-1:1:E>J?b==="asc"?1:-1:0}),z},[e,C,y,b]),L=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:k("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:C,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:k("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"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:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:k("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"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:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>A("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((T,z)=>{let H=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:z*.02},className:k("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),h(T.id);},className:k("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:H?jsxRuntime.jsx(lucideReact.ChevronDown,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(lf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:k("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:k("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),L(T.startDate)]}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),L(T.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:k("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),w.length===0&&C&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:k("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:k(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Ns={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"},Ss={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"},Es={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"},Ko={dark:Ns,light:Ss,neutral:Es};function yd(e){return Ko[e]||Ko.dark}var Ps={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"}},Ms={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"}},Yo={en:Ps,es:Ms};function Zr(e){return Yo[e]||Yo.en}function qo(e,t){let a=Zr(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 vd(e){let t=Zr(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 xd(e,t=0,a=true){let r=Zr(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 kf(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 Bs(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 Cd({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 Dd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:m="dark",locale:n="en",customTranslations:p}=t,l=qo(n,p),i=m==="dark",[u,v]=react.useState(r||new Date),[f,y]=react.useState(null),[x,b]=react.useState(null),[g,C]=react.useState(null),[D,h]=react.useState(new Date),[A,w]=react.useState({}),L=4,T=3,[z,H]=react.useState(false),[U,E]=react.useState(false),[J,ge]=react.useState(false),[ke,Le]=react.useState(null),[Ee,de]=react.useState(""),[S,F]=react.useState(void 0),[M,V]=react.useState(null),[P,W]=react.useState(false),[ie,te]=react.useState(false),[Se,ne]=react.useState(null),[Ve,be]=react.useState(false),[tt,Tt]=react.useState(new Date),Dt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),yt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Nt=react.useCallback(()=>{v(new Date);},[]),Mt=react.useMemo(()=>{let O=u.getFullYear(),Te=u.getMonth(),ze=new Date(O,Te,1),Ue=new Date(O,Te+1,0),pt=ze.getDay(),X=Ue.getDate(),Q=kf(e),ve=new Date;ve.setHours(0,0,0,0);let fe=[],ee=pt,Ce=new Date(O,Te,0).getDate();for(let G=ee-1;G>=0;G--){let K=new Date(O,Te-1,Ce-G);fe.push({date:K,isCurrentMonth:false,isToday:false,isWeekend:K.getDay()===0||K.getDay()===6,events:Q.filter(oe=>Bs(K,oe)).map(oe=>({id:oe.id,title:oe.name,start:oe.startDate,end:oe.endDate,task:oe}))});}for(let G=1;G<=X;G++){let K=new Date(O,Te,G),oe=K.getTime()===ve.getTime();fe.push({date:K,isCurrentMonth:true,isToday:oe,isWeekend:K.getDay()===0||K.getDay()===6,events:Q.filter(q=>Bs(K,q)).map(q=>({id:q.id,title:q.name,start:q.startDate,end:q.endDate,task:q}))});}let B=42-fe.length;for(let G=1;G<=B;G++){let K=new Date(O,Te+1,G);fe.push({date:K,isCurrentMonth:false,isToday:false,isWeekend:K.getDay()===0||K.getDay()===6,events:Q.filter(oe=>Bs(K,oe)).map(oe=>({id:oe.id,title:oe.name,start:oe.startDate,end:oe.endDate,task:oe}))});}return fe},[u,e]),ra=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],mt=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),rt=react.useCallback((O,Te)=>{if(!f)return;let ze={...f,[O]:Te};y(ze),a.onTaskUpdate?.(ze);},[f,a]),Lt=react.useCallback(O=>{if(!f)return;let Te=f.progress||0;O==="completed"?Te=100:O==="todo"&&(Te=0);let ze={...f,status:O,progress:Te};y(ze),a.onTaskUpdate?.(ze),H(false);},[f,a]),Ht=react.useCallback((O,Te)=>{if(!f)return;let ze={...f,startDate:O,endDate:Te};y(ze),a.onTaskUpdate?.(ze);},[f,a]),we=react.useCallback(()=>{H(false),E(false),C(null);},[]);return o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",i?"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:k("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:mt}),jsxRuntime.jsx("button",{onClick:Nt,className:k("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Dt,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:k("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:yt,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-5 h-5",i?"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:ra.map(O=>jsxRuntime.jsx("div",{className:k("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:k("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-white/5":"bg-gray-200"),children:Mt.map((O,Te)=>{let ze=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:k("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?ze?"bg-[#1A1D21]":O.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":ze?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ue=A[Te]||L,pt=O.events.slice(0,Ue),X=O.events.length-Ue;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[pt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:k("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Cd,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),w(ve=>({...ve,[Te]:Ue+T}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",n==="es"?"M\xC1S":"MORE"]}),Ue>L&&O.events.length>L&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),w(ve=>({...ve,[Te]:L}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ue=Te>=28,pt=Te%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ke===Te?Le(null):(Le(Te),de(""),F(void 0),V(null),ne(null),W(false),te(false),be(false),Tt(O.date));},className:k("w-5 h-5 rounded flex items-center justify-center transition-all",ke===Te?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:k("w-3.5 h-3.5 transition-transform",ke===Te&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===Te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),de(""),F(void 0),V(null),ne(null),W(false),te(false),be(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:k("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",pt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),W(false),te(false),be(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:X=>de(X.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:k("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&Ee.trim()){let Q=t.availableUsers?.find(fe=>fe.id===M),ve=Se||O.date;a.onTaskCreate?.({name:Ee.trim(),startDate:ve,endDate:ve,priority:S,assignees:Q?[Q]:void 0}),de(""),F(void 0),V(null),ne(null),Le(null);}X.key==="Escape"&&(Le(null),de(""),F(void 0),V(null),ne(null));}})}),jsxRuntime.jsxs("div",{className:k("px-2.5 py-2 flex items-center justify-between border-t",i?"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:X=>{X.stopPropagation(),W(!P),te(false);},className:k("p-1 rounded transition-colors",S?S==="urgent"||S==="high"?"text-red-400 bg-red-500/20":S==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"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:P&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),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(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),W(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===X.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),be(!Ve),W(false),te(false),Tt(Se||O.date);},className:k("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Se?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"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||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:k("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Q=new Date(X);Q.setDate(X.getDate()+1);let ve=new Date(X);ve.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let fe=new Date(X);fe.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let ee=new Date(X);ee.setDate(X.getDate()+14);let Ce=new Date(X);return Ce.setDate(X.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:X,display:X.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:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:fe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((G,K)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ne(G.date),be(false);},children:[jsxRuntime.jsx("span",{children:G.label}),jsxRuntime.jsx("span",{className:k("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:G.display})]},K))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:k("text-xs font-medium",i?"text-white":"text-gray-900"),children:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Tt(new Date),className:k("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Tt(new Date(tt.getFullYear(),tt.getMonth()-1)),className:k("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Tt(new Date(tt.getFullYear(),tt.getMonth()+1)),className:k("p-0.5 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:k("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=tt.getFullYear(),Q=tt.getMonth(),ve=new Date(X,Q,1).getDay(),fe=new Date(X,Q+1,0).getDate(),ee=new Date(X,Q,0).getDate(),Ce=new Date,B=[];for(let K=ve-1;K>=0;K--)B.push({dayNum:ee-K,isCurrentMonth:false,date:new Date(X,Q-1,ee-K)});for(let K=1;K<=fe;K++)B.push({dayNum:K,isCurrentMonth:true,date:new Date(X,Q,K)});let G=42-B.length;for(let K=1;K<=G;K++)B.push({dayNum:K,isCurrentMonth:false,date:new Date(X,Q+1,K)});return B.map((K,oe)=>{let q=K.date.toDateString()===Ce.toDateString(),xe=(Se||O.date).toDateString()===K.date.toDateString();return jsxRuntime.jsx("button",{className:k("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!K.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),K.isCurrentMonth&&(i?"text-white":"text-gray-900"),q&&"ring-1 ring-[#3B82F6]",xe&&"bg-[#7C3AED] text-white",!xe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ne(K.date),be(false);},children:K.dayNum},oe)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),te(!ie),W(false);},className:k("p-1 rounded transition-colors",M?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:M?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===M)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===M)?.initials||t.availableUsers?.find(X=>X.id===M)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{V(null),te(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!M&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:k("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{V(X.id),te(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",M===X.id&&(i?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:k("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Ee.trim()){let X=t.availableUsers?.find(ve=>ve.id===M),Q=Se||O.date;a.onTaskCreate?.({name:Ee.trim(),startDate:Q,endDate:Q,priority:S,assignees:X?[X]:void 0}),de(""),F(void 0),V(null),ne(null),Le(null);}},disabled:!Ee.trim(),className:k("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ee.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:k("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},Te)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),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:k("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:k("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:k("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:k("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:k("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"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:k("p-1.5 rounded transition-colors",i?"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:k("p-1.5 rounded transition-colors",i?"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:()=>y(null),className:k("p-1.5 rounded transition-colors",i?"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 O=f.progress===100?0:100,ze={...f,progress:O,status:O===100?"completed":"todo"};y(ze),a.onTaskUpdate?.(ze);},className:k("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:k("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.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:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{we(),H(!z);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>Lt(O.id),className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,Te)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},Te)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{C(g?null:"start"),h(f.startDate||new Date);},className:k("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:k("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>C(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:k("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:k("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,Te=new Date(O);Te.setDate(O.getDate()+1);let ze=new Date(O);ze.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let Ue=new Date(O);Ue.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let pt=new Date(O);pt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let X=new Date(O);X.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ze,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ue,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:pt,display:pt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((fe,ee)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Ce=f.endDate&&fe.date>f.endDate?fe.date:f.endDate;Ht(fe.date,Ce),C("end");}else {let Ce=f.startDate&&fe.date<f.startDate?fe.date:f.startDate;Ht(Ce,fe.date),C(null);}},children:[jsxRuntime.jsx("span",{children:fe.label}),jsxRuntime.jsx("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:fe.display})]},ee))})(),jsxRuntime.jsx("div",{className:k("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ht(void 0,void 0),C(null);},className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"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:k("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="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:k("font-medium",i?"text-white":"text-gray-900"),children:D.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:()=>h(new Date),className:k("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:k("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()+1)),className:k("p-1 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:k("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=D.getFullYear(),Te=D.getMonth(),ze=new Date(O,Te,1).getDay(),Ue=new Date(O,Te+1,0).getDate(),pt=new Date(O,Te,0).getDate(),X=new Date,Q=[];for(let fe=ze-1;fe>=0;fe--)Q.push({day:pt-fe,isCurrentMonth:false,date:new Date(O,Te-1,pt-fe)});for(let fe=1;fe<=Ue;fe++)Q.push({day:fe,isCurrentMonth:true,date:new Date(O,Te,fe)});let ve=42-Q.length;for(let fe=1;fe<=ve;fe++)Q.push({day:fe,isCurrentMonth:false,date:new Date(O,Te+1,fe)});return Q.map((fe,ee)=>{let Ce=fe.date.toDateString()===X.toDateString(),B=f.startDate?.toDateString()===fe.date.toDateString(),G=f.endDate?.toDateString()===fe.date.toDateString(),K=B||G,oe=f.startDate&&f.endDate&&fe.date>=f.startDate&&fe.date<=f.endDate;return jsxRuntime.jsx("button",{className:k("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!fe.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),fe.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#3B82F6]",B&&"bg-[#3B82F6] text-white",G&&!B&&"bg-[#7C3AED] text-white",oe&&!K&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let q=new Date(fe.date);if(g==="start"){let xe=f.endDate&&q>f.endDate?q:f.endDate;Ht(q,xe),C("end");}else {let xe=f.startDate&&q<f.startDate?q:f.startDate;Ht(xe,q),C(null);}},children:fe.day},ee)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{we(),E(!U);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>E(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"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(O=>jsxRuntime.jsxs("button",{onClick:()=>{rt("priority",O.id),E(false);},className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.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:k("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[J?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let Te=parseInt(O.target.value),ze=f.status;Te===100?ze="completed":Te>0?ze="in-progress":ze="todo";let Ue={...f,progress:Te,status:ze};y(Ue),a.onTaskUpdate?.(Ue);},onBlur:()=>ge(false),className:k("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"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:()=>ge(true),className:k("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm mt-2 transition-colors",i?"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:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:k("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:k("p-1 rounded transition-colors",i?"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:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:k("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:k("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:k("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:k("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:k("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:k("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:k("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:k("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),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:()=>b(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:k("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",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:k("p-1 rounded",i?"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:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),y(O.task);},className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Cd,{task:O.task}),jsxRuntime.jsx("span",{className:k("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Rs={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"},Os={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"},Us={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"},Qo={dark:Rs,light:Os,neutral:Us};function Nd(e){return Qo[e]||Qo.dark}function Cf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[m,n]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=react.useMemo(()=>{let u=p.length,v=new Set(p.flatMap(x=>x.assignedUserIds||[])).size,f=p.map(x=>x.priority).filter(Boolean),y=new Set(p.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[p]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:k("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,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:k("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.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"})]})})]},u.id))})})]})}var Ed={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Qr(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 eo(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 Pd(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 Md({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let m=react.useMemo(()=>({...Ed,...d}),[d]),[n,p]=react.useState(new Set),l=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let C=g.timestamp.toISOString().split("T")[0],D=b.get(C);D?D.push(g):b.set(C,[g]);}),Array.from(b.entries()).sort((g,C)=>C[0].localeCompare(g[0])).map(([g,C])=>({date:new Date(g),events:C.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(C=>{b.add(C.userId),g.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{p(g=>{let C=new Set(g);return C.has(b)?C.delete(b):C.add(b),C});},y=b=>{let C=new Date().getTime()-b.getTime(),D=Math.floor(C/6e4),h=Math.floor(C/36e5),A=Math.floor(C/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:A<7?`${A}d ago`:b.toLocaleDateString()},x=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:k("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:k("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[eo(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,C)=>{let D=n.has(g.id),h=s===g.id,A=Pd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:k("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:eo(g.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),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:[m.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Qr(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),f(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([w,L])=>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(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},w)),g.metadata&&Object.keys(g.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(g.metadata).map(([w,L])=>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(L)})]},w))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function Id({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:m,className:n}){let p=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:k("history-replay-empty",n),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:k("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&eo(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&Qr(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:k("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:Qr(u)},u.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:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(u=>jsxRuntime.jsxs("button",{className:k("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:k("history-replay-start",n),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 zs(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 $s(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 Ld(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 Fd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Pf(e,t,a,r,o,s=100){let d=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;d.forEach(p=>{let l=a/2,i=r/2;p.vx+=(l-p.x)*o.centerForce*n,p.vy+=(i-p.y)*o.centerForce*n,d.forEach(u=>{if(p.id===u.id)return;let v=p.x-u.x,f=p.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);p.vx+=v/y*x,p.vy+=f/y*x;});}),t.forEach(p=>{let l=c.get(typeof p.source=="string"?p.source:p.source.id),i=c.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return d}function Bd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:m}){let n=react.useRef(null),[p,l]=react.useState([]),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(1),[C,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Pf(e,t,a.width,a.height,a,150);l(U);},[e,t,a]);let h=react.useCallback((U,E)=>{a.enableDragging&&(E.stopPropagation(),u(U));},[a.enableDragging]),A=react.useCallback(U=>{if(!i||!n.current)return;let J=n.current.getBoundingClientRect(),ge=(U.clientX-J.left-C.x)/b,ke=(U.clientY-J.top-C.y)/b;l(Le=>Le.map(Ee=>Ee.id===i?{...Ee,x:ge,y:ke,fx:ge,fy:ke}:Ee));},[i,b,C]),w=react.useCallback(()=>{u(null);},[]),L=react.useCallback((U,E)=>{E.stopPropagation(),c?.({type:"node-click",node:U,position:{x:E.clientX,y:E.clientY}});},[c]),T=react.useCallback((U,E)=>{E.stopPropagation(),c?.({type:"edge-click",edge:U,position:{x:E.clientX,y:E.clientY}});},[c]),z=react.useCallback(U=>{let E=p.find(J=>J.id===U);return E?{x:E.x,y:E.y}:{x:0,y:0}},[p]),H=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let E=U.card.priority;return E==="URGENT"?"#ef4444":E==="HIGH"?"#f59e0b":E==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:k("relationships-graph-empty",m),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:k("relationships-graph",m),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:d.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:d.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:()=>g(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:zs(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Ld(U)," ",$s(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let E=z(typeof U.source=="string"?U.source:U.source.id),J=z(typeof U.target=="string"?U.target:U.target.id),ge=Fd(U.type),ke=y===U.id,Le=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-edge",ke&&"hovered",Le&&"critical"),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:Ee=>T(U,Ee),children:[jsxRuntime.jsx("line",{x1:E.x,y1:E.y,x2:J.x,y2:J.y,stroke:zs(U.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:ge?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsxRuntime.jsx("text",{x:(E.x+J.x)/2,y:(E.y+J.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:$s(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(U=>{let E=v===U.id,J=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-node",E&&"hovered",J&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:ge=>h(U.id,ge),onMouseEnter:()=>f(U.id),onMouseLeave:()=>f(null),onClick:ge=>L(U,ge),children:[jsxRuntime.jsx("circle",{r:J?a.nodeSize*1.2:a.nodeSize,fill:H(U),stroke:J?"#fbbf24":"#ffffff",strokeWidth:J?3:2,opacity:E?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ud({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=react.useState(""),[c,m]=react.useState(false),[n,p]=react.useState(null),[l,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),p(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){m(true),p(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},x=()=>{l&&(a(l),f());};return e?jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,g)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:b=>d(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,g)=>jsxRuntime.jsx("button",{onClick:()=>d(b),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},g))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ws={"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 Af={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},If={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 Lf(e,t,a){let r=Ws[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function to(e){return `$${e.toFixed(4)}`}var Gs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Lf(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),m=a.reduce((l,i)=>l+i.duration,0),n={},p={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:p,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=d).length,m=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},sr=new Gs;function Wd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(sr.getStats()),[s,d]=react.useState(sr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(sr.getStats()),d(sr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=sr.getRecentOperations(5);return jsxRuntime.jsxs(Ke,{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: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.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:to(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(([m,n])=>{let p=r.costsByFeature[m]||0,l=r.totalOperations>0?n/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:m.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:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:to(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:to(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 _d({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[m,n]=react.useState(""),[p,l]=react.useState(""),[i,u]=react.useState(false),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(null),C=react.useRef(null),D=i||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let T=z=>{z.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let h=()=>{D||(c(""),n(""),l(""),f(null),x(null),g(null),t());},A=async()=>{if(!(!d.trim()||D)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{y&&(a(y),h());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:T=>T.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:h,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((T,z)=>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:["#",z+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.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"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:d,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>n(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>l(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,z)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},z))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?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:A,disabled:!d.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function an({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&co(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(y,x,b)=>{r(g=>{let C=g.cards.find(T=>T.id===y);if(!C)return g;let D=C.columnId,h={...C,columnId:x,position:b},A=g.cards.map(T=>T.id===y?h:T),w=g.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter(z=>z!==y)};if(T.id===x){let z=A.filter(H=>H.columnId===x).sort((H,U)=>H.position-U.position);return {...T,cardIds:z.map(H=>H.id)}}return T}),L={...g,cards:A,columns:w};return o(L),L});},[o]),d=react.useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(D=>D.id===y?{...D,...x}:D),C={...b,cards:g};return o(C),C});},[o]),c=react.useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},C=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),D={...b,cards:[...b.cards,g],columns:C};return o(D),D});},[o]),m=react.useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),C=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(A=>A!==y)}:h),D={...x,cards:g,columns:C};return o(D),D});},[o]),n=react.useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},C={...b,columns:[...b.columns,g]};return o(C),C});},[o]),p=react.useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(D=>D.id===y?{...D,...x}:D),C={...b,columns:g};return o(C),C});},[o]),l=react.useCallback(async y=>{r(x=>{let b=x.cards.filter(D=>D.columnId!==y),g=x.columns.filter(D=>D.id!==y),C={...x,cards:b,columns:g};return o(C),C});},[o]),i=react.useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=react.useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=react.useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:m,onColumnCreate:n,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:m,deleteColumn:l,clearBoard:v}}}function jd({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=an({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(m,n,p={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...p});},addColumn:(m,n)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:n??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var ao={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Yd={by:"none",order:"asc"};function qd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...ao,...e}),[s,d]=react.useState({...Yd,...t}),c=react.useCallback(f=>{o(y=>({...y,...f}));},[]),m=react.useCallback(f=>{d(y=>({...y,...f}));},[]),n=react.useCallback(()=>{o(ao),d(Yd);},[]),p=react.useCallback(()=>{a&&o({...ao,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...ao,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...ao,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),C=String(x.getDate()).padStart(2,"0"),D=`${b}-${g}-${C}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let A=h.endDate||h.dueDate;if(!A)return false;let w;if(typeof A=="string")w=A.split("T")[0]||A;else {let L=A.getUTCFullYear(),T=String(A.getUTCMonth()+1).padStart(2,"0"),z=String(A.getUTCDate()).padStart(2,"0");w=`${L}-${T}-${z}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let L=new Date(D+"T00:00:00"),T=new Date(w+"T00:00:00"),z=new Date(L);return z.setDate(z.getDate()+7),T>=L&&T<=z;case "custom":if(r.dateRange){let H=typeof A=="string"?new Date(A):A;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let C=x.createdAt?new Date(x.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;g=C-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=h[x.priority||"LOW"],w=h[b.priority||"LOW"];g=A-w;break;case "dueDate":let L=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!L)return 1;if(!T)return -1;let z=typeof L=="string"?new Date(L).getTime():L.getTime(),H=typeof T=="string"?new Date(T).getTime():T.getTime();g=z-H;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let U=x.estimatedTime||0,E=b.estimatedTime||0;g=U-E;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:m,resetFilters:n,filterMyTasks:p,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var Jd,Zd;if(typeof window<"u")try{let e=so("ai");Jd=e.generateObject,Zd=e.generateText;}catch{}function Qd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Jd&&Zd&&e.apiKey),d=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function _s(){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 ec(e){let{cards:t}=e,[a,r]=_s(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(w=>w.columnId===f.columnId).sort((w,L)=>w.position-L.position),b=x.findIndex(w=>w.id===a.lastSelectedCardId),g=x.findIndex(w=>w.id===l),[C,D]=b<g?[b,g]:[g,b],h=x.slice(C,D+1).map(w=>w.id),A=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:A,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),p=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:d,clearSelection:c,selectAll:m,toggleCard:n,getSelectedCards:p}}var tc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function ac(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...tc,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(D=>D.columnId===x).length,createdAt:new Date};d(D=>[...D,C]);},[o.minCardsPerStack,s]),m=react.useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=react.useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),p=react.useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=react.useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(C=>C!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=react.useCallback(async f=>{let y=t.filter(D=>D.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(D);});}),b.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(D);});}),g.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(y.forEach(D=>{D.priority&&(C.has(D.priority)||C.set(D.priority,[]),C.get(D.priority).push(D));}),C.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${A} ${h} Priority`,cardIds:D.map(w=>w.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of y){let A=(await r.findSimilar(D,y)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let w=[D.id,...A.map(T=>T.card.id)],L=A.reduce((T,z)=>T+z.similarity,0)/A.length;x.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:L});}}return x.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:m,toggleStack:n,addToStack:p,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var rc=react.createContext(null);function oc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(m=>{let{Column:n}=so("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=so("@libxai/core");d.set(m.id,new n(m));});let c=null;if(t?.board){let{Board:m}=so("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(rc.Provider,{value:{store:o},children:e})}function rn(){let e=react.useContext(rc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function oo(){let e=rn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(b=>{e.updateBoard(b);},[e]),m=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,C)=>{e.moveCard(b,g,C);},[e]),y=react.useCallback(b=>e.getCard(b),[e]),x=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:m,updateColumn:n,deleteColumn:p,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function sc(e){let{cards:t}=oo();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 ic(e="position",t="asc"){let{cards:a}=oo();return react.useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=m-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var on=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=yi.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 d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Xf=new on;function dc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:m}){let n=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=p.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=m?m(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function cc(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 pc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:m,horizontal:n=true}){let p=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=m?m(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function uc(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 gc(e,t=10){return e>t}var Ys={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},qs={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Xs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Js={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Zs={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Qs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ei={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ti={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)"},ai={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)"},ri={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},oi={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}},ni={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}},nn={spacing:Ys,borderRadius:qs,fontSize:Xs,fontWeight:Js,lineHeight:Zs,zIndex:Qs,duration:ei,easing:ti,shadows:ai,opacity:ri,kanban:oi,gantt:ni};function fc(e,t,a){return e[t]??a}function si(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)?si(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Qf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ii(e="asakaa"){let t=si(nn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=Qf(o);a.push(` ${s}: ${d};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
326
|
}`}function no(e,t="asakaa"){let a=[],r=si(e);for(let[o,s]of Object.entries(r)){let d=`--${t}-color-${o}`;a.push(` ${d}: ${s};`);}return `:root {
|
|
@@ -350,5 +350,5 @@ ${no(di,"asakaa").split(`
|
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
352
|
`}var eb=({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 hc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=xr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([d,c])=>{let m=d,n=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(eb,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},m)})})}
|
|
353
|
-
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=Wd;exports.AI_FEATURES=If;exports.AI_MODELS=Ws;exports.AddCardButton=Nn;exports.AddColumnButton=Dn;exports.AttachmentUploader=Hr;exports.BoardProvider=oc;exports.BulkOperationsToolbar=xo;exports.BurnDownChart=On;exports.CalendarBoard=Dd;exports.Card=Sa;exports.CardDetailModal=An;exports.CardDetailModalV2=Fn;exports.CardHistoryReplay=Id;exports.CardHistoryTimeline=Md;exports.CardRelationshipsGraph=Bd;exports.CardStack=Cf;exports.CardTemplateSelector=_n;exports.CircuitBreaker=mn;exports.Column=fr;exports.ColumnManager=No;exports.CommandPalette=Pn;exports.ConfigMenu=Yn;exports.ContextMenu=Cr;exports.DEFAULT_SHORTCUTS=Vr;exports.DEFAULT_TEMPLATES=Hn;exports.DateRangePicker=Fr;exports.DependenciesSelector=Rr;exports.DependencyLine=Lo;exports.DistributionCharts=Un;exports.EditableColumnTitle=vn;exports.ErrorBoundary=br;exports.ExportImportModal=jn;exports.FilterBar=Kn;exports.GANTT_AI_SYSTEM_PROMPT=nd;exports.GanttAIAssistant=Wo;exports.GanttBoard=od;exports.GanttI18nContext=wr;exports.GanttMilestone=Bo;exports.GanttToolbar=Do;exports.GenerateGanttTasksDialog=_d;exports.GeneratePlanModal=Ud;exports.GroupBySelector=Wn;exports.KanbanBoard=Ua;exports.KanbanToolbar=Cn;exports.KanbanViewAdapter=Wr;exports.KeyboardShortcutsHelp=Gn;exports.ListView=hd;exports.MenuIcons=it;exports.PluginManager=on;exports.PrioritySelector=Ya;exports.RATE_LIMITS=Af;exports.SwimlaneBoardView
|
|
353
|
+
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=Wd;exports.AI_FEATURES=If;exports.AI_MODELS=Ws;exports.AddCardButton=Nn;exports.AddColumnButton=Dn;exports.AttachmentUploader=Hr;exports.BoardProvider=oc;exports.BulkOperationsToolbar=xo;exports.BurnDownChart=On;exports.CalendarBoard=Dd;exports.Card=Sa;exports.CardDetailModal=An;exports.CardDetailModalV2=Fn;exports.CardHistoryReplay=Id;exports.CardHistoryTimeline=Md;exports.CardRelationshipsGraph=Bd;exports.CardStack=Cf;exports.CardTemplateSelector=_n;exports.CircuitBreaker=mn;exports.Column=fr;exports.ColumnManager=No;exports.CommandPalette=Pn;exports.ConfigMenu=Yn;exports.ContextMenu=Cr;exports.DEFAULT_SHORTCUTS=Vr;exports.DEFAULT_TEMPLATES=Hn;exports.DateRangePicker=Fr;exports.DependenciesSelector=Rr;exports.DependencyLine=Lo;exports.DistributionCharts=Un;exports.EditableColumnTitle=vn;exports.ErrorBoundary=br;exports.ExportImportModal=jn;exports.FilterBar=Kn;exports.GANTT_AI_SYSTEM_PROMPT=nd;exports.GanttAIAssistant=Wo;exports.GanttBoard=od;exports.GanttI18nContext=wr;exports.GanttMilestone=Bo;exports.GanttToolbar=Do;exports.GenerateGanttTasksDialog=_d;exports.GeneratePlanModal=Ud;exports.GroupBySelector=Wn;exports.KanbanBoard=Ua;exports.KanbanToolbar=Cn;exports.KanbanViewAdapter=Wr;exports.KeyboardShortcutsHelp=Gn;exports.ListView=hd;exports.MenuIcons=it;exports.PluginManager=on;exports.PrioritySelector=Ya;exports.RATE_LIMITS=Af;exports.SwimlaneBoardView=zn;exports.TaskBar=Mo;exports.TaskFormModal=$o;exports.TaskGrid=Po;exports.ThemeModal=Zn;exports.ThemeProvider=wl;exports.ThemeSwitcher=hc;exports.Timeline=Oo;exports.UserAssignmentSelector=Xa;exports.VelocityChart=Rn;exports.VirtualGrid=pc;exports.VirtualList=dc;exports.aiUsageTracker=sr;exports.borderRadius=qs;exports.calculatePosition=lo;exports.calendarDarkTheme=Rs;exports.calendarEnTranslations=Ps;exports.calendarEsTranslations=Ms;exports.calendarLightTheme=Os;exports.calendarNeutralTheme=Us;exports.calendarThemes=Qo;exports.calendarTranslations=Yo;exports.cardToGanttTask=Ho;exports.cardsToGanttTasks=pd;exports.cn=k;exports.createKanbanView=rl;exports.createRetryWrapper=Hc;exports.darkTheme=qn;exports.darkTokenTheme=sn;exports.defaultTheme=wo;exports.designTokens=nn;exports.duration=ei;exports.easing=ti;exports.exportTokensToCSS=bc;exports.findTaskByName=La;exports.fontSize=Xs;exports.fontWeight=Js;exports.formatCost=to;exports.ganttEnTranslations=To;exports.ganttEsTranslations=Tl;exports.ganttTaskToCardUpdate=md;exports.ganttThemes=Oe;exports.ganttTokens=ni;exports.ganttTranslations=Qn;exports.ganttUtils=ae;exports.generateCSSVariables=ii;exports.generateCompleteCSS=ci;exports.generateInitialPositions=zc;exports.generateTasksContext=sd;exports.generateThemeVariables=no;exports.getCalendarTheme=Nd;exports.getCalendarTranslations=Zr;exports.getListViewTheme=yd;exports.getListViewTranslations=Ds;exports.getMonthNames=vd;exports.getToken=fc;exports.getTranslations=Dl;exports.getWeekdayNames=xd;exports.kanbanTokens=oi;exports.lightTheme=Xn;exports.lightTokenTheme=li;exports.lineHeight=Zs;exports.listViewDarkTheme=Ns;exports.listViewEnTranslations=Cs;exports.listViewEsTranslations=Ts;exports.listViewLightTheme=Ss;exports.listViewNeutralTheme=Es;exports.listViewThemes=Ko;exports.listViewTranslations=_o;exports.mergeCalendarTranslations=qo;exports.mergeListViewTranslations=Vo;exports.mergeTranslations=es;exports.neutralTheme=Jn;exports.neutralTokenTheme=di;exports.opacity=ri;exports.parseLocalCommand=dd;exports.parseNaturalDate=xs;exports.parseNaturalDuration=ks;exports.parseProgress=ws;exports.parseStatus=ld;exports.pluginManager=Xf;exports.retrySyncOperation=Gc;exports.retryWithBackoff=co;exports.shadows=ai;exports.shouldVirtualizeGrid=gc;exports.spacing=Ys;exports.themes=er;exports.useAI=Qd;exports.useBoard=jd;exports.useBoardCore=oo;exports.useBoardStore=rn;exports.useCardStacking=ac;exports.useDragState=kn;exports.useFilteredCards=sc;exports.useFilters=qd;exports.useGanttI18n=jr;exports.useKanbanState=an;exports.useKeyboardShortcuts=vl;exports.useMultiSelect=ec;exports.useSelectionState=_s;exports.useSortedCards=ic;exports.useTheme=xr;exports.useVirtualGrid=uc;exports.useVirtualList=cc;exports.validateAIResponse=cd;exports.withErrorBoundary=Sn;exports.wouldCreateCircularDependency=po;exports.zIndex=Qs;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|